Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IPv6 Support #12

Closed
giacomitti opened this issue Jul 2, 2021 · 5 comments · Fixed by #13
Closed

IPv6 Support #12

giacomitti opened this issue Jul 2, 2021 · 5 comments · Fixed by #13
Labels
enhancement New feature or request

Comments

@giacomitti
Copy link

What about implement IPv6 support in script?

Regards.

@mrikirill mrikirill added the enhancement New feature or request label Jul 6, 2021
@mrikirill
Copy link
Owner

By following this article A zones support ipv4 only. AAAA zones for ipv6. As an idea script probably can detect ipv4 and use A zone upd (current case) and ipv6 use AAAA zone

@smoetje
Copy link
Contributor

smoetje commented Jul 8, 2021

Synology doesn't give ipv6 address as an input parameter by default, so it'll have to be via by retrieving ipv6 with file_get_contents('https://api64.ipify.org'). I tried some simulations in the existing code with some quick coding and works fine.

However after checking the script itself will need some recoding, in particular now how jsons are being parsed when getting responses from the Cloudflare api and how it's recorded in the hostList array. E.g. now jsons are parsed on array element number 0. But after checking I noticed element 0 sometimes contains A and sometimes AAAA (or both in element 0 and 1 or opposite). not reliable.

I am working on it now and'll post it when done.

@mrikirill mrikirill mentioned this issue Jul 8, 2021
@mrikirill mrikirill linked a pull request Jul 8, 2021 that will close this issue
@mrikirill
Copy link
Owner

mrikirill commented Jul 8, 2021

Added getting a zone type by ip type:
IPv4 = zone A
IPv6 = zone AAAA
as @smoetje has mentioned I've added getting ip from https://api64.ipify.org instead of if Synology input param

@smoetje
Copy link
Contributor

smoetje commented Jul 24, 2021

There are some serious issues after these modifications. When you have IPV6 it basically only updates the IPV6 and no longer IPV4. It's due how the hostlist array is built and parsed afterwards based on recordsId. Basically every DNS record has a separate RecordId for A and another RecordId for AAAA . I fixed the script where now IPV4 and IPV6 are both recognized. If there's no IPV6, then only IPV4 will be updated.

I completely fixed it and over here it works now for both IPV4 and IPV6. Personally I would've done some things completely different (e.g. the way how the hostslist array is constructed, the api calls, etc) and extend it with the supported error messages accepted by DSM. But the one I have will do just fine now, these changes will be for another occasion...

@smoetje
Copy link
Contributor

smoetje commented Jul 25, 2021

Personally I would've done some things completely different (e.g. the way how the hostslist array is constructed, the api calls, etc) and extend it with the supported error messages accepted by DSM. But the one I have will do just fine now, these changes will be for another occasion...

I have been further thinking on this: A new target-array which contains RecordId keys instead of fullname can simply things. Because fullname can contain 1 or 2 values, a RecordId is always unique after further figuring-out the Cloudflare api.

I made a pull request of with my (properly working) changes. Further improvement is in the progress, I'll get back to it...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants