linode_api4-python
linode_api4-python copied to clipboard
[Feature]: documentation: DDNS example
Description
I'd like my Linodes and my home system to automatically update their A and AAAA records in my domain when rebooted or receiving a new address via DHCP. An example script to do that would be most helpful. Perhaps added after the other examples in the README. An example with "[remote_addr]" would be ideal, but it's not clear how to get the library to choose between IPv4 and IPv6 to update the A vs AAAA record.
Some info on forcing IPv4/IPv6 in requests: https://github.com/psf/requests/issues/1691 https://stackoverflow.com/questions/33046733/force-requests-to-use-ipv4-ipv6
Given how complicated that is, it does seem easier to find one's own address first using a website that only responds to IPv4 or IPv6 but not both and then use the address discovered in the Linode v4 API. Perhaps the API server can provide two URLs just for that purpose, one on each transport.
With the above clues I was able to produce this. I suggest adding it to the examples.
https://github.com/SpareSimian/LinodeDDNS