Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I wanted to be able to remove txt records after successful verification. I intend to be able to monitor domains in an automated fashion using scripts and watching for a lingering txt record on a domain indicates something is wrong somewhere and needs attention. In order to facilitate this I just added a new endpoint, to not mess with the existing public api in any way, and update the DB for the necessary functionality. Right now this fits in with minimal modification, the majority is duplicate code for test cases, and adds the ability for things like acme.sh to be able to remove records after validation.
Added /delete API endpoint to call DB.Delete, structured off /update - Functionally nearly identical with just some strings and the DB call adjusted.
Added test functions, structured off update tests, for the API for the delete endpoint.
Added DB.Delete function to DB to set the LastUpdate to 0 for the record being deleted.
Changed DB.GetTXTForDomain to only return records with LastUpdate > 0
Adjusted the test function TestResolveTXT to include tests for multiple records and deleting records. This update created a new function to reduce copy/paste, this code lives in hasExpectedResolveTXTs
Adjusted the test function hasExpectedTXTAnswer to handle checking for the correct number of records, and verifying all expected records are returned
My first time with go/working with github for stuff so apologies if I missed anything or did something wrong.