TimothyYe / godns

A dynamic DNS client tool that supports AliDNS, Cloudflare, Google Domains, DNSPod, HE.net & DuckDNS & DreamHost, etc, written in Go.
https://timothyye.github.io/godns/
Apache License 2.0
1.5k stars 220 forks source link

Determining own IP stopped working with https://api.ip.sb/ip #141

Closed belidzs closed 2 years ago

belidzs commented 2 years ago

Describe the bug
As of this morning godns started reporting issues with determining my public IP, so it's reverting to the interface IP address instead.

Curiously, changing ip_url to https://api.ipify.org resolves this issue. I can access both URLs from my desktop computer using the same network, and both services seem to provide the exact same response.

I suspect this has something to do with the SSL layer which I unfortunately couldn't confirm by raising godns' log level.

The frequency of this issue

Steps to Reproduce

  1. Configure "ip_url": "https://api.ip.sb/ip"
  2. Confirm console is reporting errors

Your GoDNS configuration

        {
          "provider": "Cloudflare",
          "login_token": "x",
          "domains": [
            {
              "domain_name": "x",
              "sub_domains": ["x"]
            }
          ],
          "resolver": "192.168.0.1",
          "ip_url": "https://api.ip.sb/ip",
          "ip_type": "IPv4",
          "interval": 120,
          "socks5_proxy": "",
          "debug_info": true
        }

Expected behavior

  1. GoDNS should be able to determine my public IP using https://api.ip.sb/ip and change the A record accordingly

Screenshots
N/A

Environment (please complete the following information):

Additional context

time="2022-03-31T12:58:57+02:00" level=info msg="GoDNS started, entering main loop..."
time="2022-03-31T12:58:57+02:00" level=info msg="Creating DNS handler with provider:Cloudflare"
time="2022-03-31T12:58:57+02:00" level=error msg="get ip online failed. Fallback to get ip from interface if possible."
time="2022-03-31T12:58:57+02:00" level=error msg="Error in GetCurrentIP:failed to get online IP:403"
time="2022-03-31T12:58:57+02:00" level=debug msg="Going to sleep, will start next checking in 120 seconds...\r\n"
TimothyYe commented 2 years ago

@belidzs Thanks for the feedback, someone also mentioned this issue #140, it is due to the API https://api.ip.sb/ip blocking requests without user-agent. Later I'll change the default config file and use https://api.ipify.org/ as the default API.

tboerger commented 2 years ago

Same happened to me, I'm using https://ifconfig.co now.

TimothyYe commented 2 years ago

Updated the default API in the config file and README.