oscartbeaumont / netlify-dynamic-dns

A Dynamic DNS Client For Netlify Managed DNS
MIT License
61 stars 18 forks source link

ident.me not returning json anymore? #9

Closed musikele closed 3 years ago

musikele commented 3 years ago

Hi there, when I run this script on my Synology NAS I get this output:

2020/11/17 14:34:19 Updating IPv4 Record...
Error: error: retrieving your public ipv4 address: json: cannot unmarshal number into Go value of type pkg.apiResponse

After debugging a little bit, with my limited GO knowledge, I think the problem is in file clientip.go , function GetPublicIPv4(). It seems to expect a json, while the answer is a plaintext string containing the ip only.

Also, I tried to manually call https://v4.ident.me/.json and i couldn't find any documentation about the json response type.

Probably by fixing those functions to parse the plain string as IP address we'd the script may continue to work?

oscartbeaumont commented 3 years ago

Sorry, it has taken so long but this is finally fixed. I have rebuilt the codebase and moved to OpenDNS which is faster than the HTTP method and will also not change the format of the IP that is returned as was the issue here.