Open DougieLawson opened 4 years ago
Hi Dougie,
Great to hear that someone else is making use of my script. I didn't know that the DNS v2 API was out of beta, that is good. I have just released a new 1.0.1 version that uses the new v2 endpoint.
I am not quite clear why this change needed though?
https://api.mythic-beasts.com/dns/v2
should work for either IPv4 or IPv6 and the -4
and -6
switches should already allow you to force a particular version - mainly for use with the dynamic
command.
nick.
Hi Nick,
That's why I did it as an issue. My problem is that my IPv6 isn't permanent, it's done with a 6to4 tunnel by my TP-Link router. So I wanted to be certain that I was hitting an IPv6 address when I'm doing IPv6 stuff on their API (as that gives a nudge that I need to hit my router with a bigger stick when it doesn't work).
One day, PlusNet will do a proper IPv6 service (like Sky) and it'll all become moot.
I spent some more time hacking your script today as it didn't like my psuedo RFC1035 zone file.
--- delphyne~~ 2020-07-02 00:05:52.498924094 +0000
+++ delphyne 2020-07-02 00:06:56.478475137 +0000
@@ -265,7 +265,7 @@
echo "Getting zone ${zone}" >&2
response_format="$(mime_type_for_format)"
- http_request get "/zones/${zone}/records"
+ http_request get "/zones/${zone}/records?exclude-generated&exclude-template"
}
# Usage: delphyne dynamic <hostname>
@@ -309,7 +309,7 @@
fi
response_format='application/json'
- result="$(http_request put "/zones/${zone}/records?exclude-generated" "@${filename}")"
+ result="$(http_request put "/zones/${zone}/records?exclude-generated&exclude-template" "@${filename}")"
display_message "${result}"
echo >&2
}
Thanks for building this script (it's Google's #5 hit for "Mythic Beasts DNS V2 script"), it's saved me a bunch of pain and I've learned some more shell script. In the process I've also found jg which is a neat JSON parsing library. My domain is now fully transferred to Mythic Beasts from Ionos. I've now got a complete script to update stuff when PlusNet renew my IP address (which is getting a full scale test as we're dropping the power on Monday while my EV charger gets installed).
Rgds, Dougie
I think I need to add an option for this, as it could be useful to fetch generated and template records:
http_request get "/zones/${zone}/records?exclude-generated&exclude-template"
I should definitely merge this in; I don't use templates but I think putting a zone will be broken without this option:
result="$(http_request put "/zones/${zone}/records?exclude-generated&exclude-template" "@${filename}")"
How exciting to be getting an EV/EV charger!
Thanks Nick, let me know when you've coded it - so I can beta test it.
The reason I want fetch without templates/generated is so I can pull it down, edit it (with a sed script generated by a python program (yes, I am crazy)) to update my IPv4 & IPv6 addresses then publish it.
More exciting than the charger was getting the Kia e-Nero two weeks ago, it's a brilliant car with 400Km WLTP range (although the lead time for delivery was excessive).
I've just switched my domain to Mythic Beasts. So I've hacked your script to run with the IPv4 or IPv6 API rather than the beta endpoint. I've set a default of IPv4.