Open mmakaay opened 8 months ago
Trying curl against the TransIP API shows me that I have the following record:
{"name":"@","expire":300,"type":"A","content":"192.87.156.100"}
Performing this query:
curl -X PATCH \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ****" \ -d '
{
"dnsEntry": {
"name": "@",
"expire": 60,
"type": "A",
"content": "77.174.229.213"
}
}
' \
"https://api.transip.nl/v6/domains/makaay.nl/dns"
Does result in the error that I see in the logs:
{"error":"Could not find match for DNS entry '@ 60 A'"}
I think this means that the issue is to be found at the TransIP API side of things here, and not directly in go-transip-dyndns.
Hmmm, interestingly enough, my curl-based patch request does work when the expire time matches the current expire time as defined in the TransIP DNS! I was able to update the DNS entry using the structure:
{
"dnsEntry": {
"name": "@",
"expire": 300,
"type": "A",
"content": "77.174.229.213"
}
}
Apparently, the expire time is included by the TransIP API in finding the record to update, which is a bit weird IYAM. By playing with the expiry time in the records that I defined, I am able to change the output of transip-dyndns:
DEBUG - Log level set to debug...
DEBUG - Found IP address. (145.144.245.6)
2024-02-22 15:27:34 - β Could not update the record to update here-is.makaay.nl [A] - Could not find match for DNS entry 'here-is 300 A'
2024-02-22 15:27:34 - π Record updated @.makaay.nl [A] to 145.144.245.6
In this case, the @
record has a TTL that matches the active TTL and here-is.makaay.nl
has a mismatching TTL.
And when I make sure tat the TTL matches for both the records, then both get updated correctly.
TL;DR: when the active TTL from the TransIP DNS server differs from the ttl:
field as defined in the TOML config, then updating the content for a DNS record through the TransIP API results in an error: "Could not find match for DNS entry '@
I think a good solution would be to:
[[record]] ttl
is only used when creating a new DNS recordAnd thanks for this project! Except for the little speed bump from above, it made it really simple to setup my own dyndns based on my TransIP domains π
Update: the original title of the issue reported issues with updating the @ entery in DNS, but I changed it after finding out the actual issue at hand. See this message for the TL;DR
I have setup transip-dyndns (latest version) and a configuration file with these records to update:
When the target records already contain the correct IP addresses as content, things are peachy:
However, when my IP address changes, updating the
@
entry fails. Here is what happens if I update the@
record and then run the program (last line with added line break for readability):