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.49k stars 218 forks source link

Docker Image not updating public ip address as per interval configuration #229

Closed fishjojo1 closed 5 months ago

fishjojo1 commented 5 months ago

Describe the bug
The docker image does not update the public ip(at least for cloudflare) as per the interval argument in the configuration file

The frequency of this issue

Steps to Reproduce
docker run -d --name godns --restart=always -v /home/<user>/godns/config.json:/config.json timothyye/godns:latest

the docker container runs correctly one time, managing to update the ip address

docker logs (on start)

time="2024-02-05T09:28:20Z" level=info msg="Creating DNS handler with provider: Cloudflare"
time="2024-02-05T09:28:20Z" level=info msg="GoDNS started, starting the DNS manager..."
time="2024-02-05T09:28:20Z" level=info msg="Checking IP for domain domain.com"
time="2024-02-05T09:28:22Z" level=info msg="Querying records with type: A"
time="2024-02-05T09:28:22Z" level=info msg="Record OK: domain.com - ip"
time="2024-02-05T09:28:22Z" level=info msg="Record OK: www.domain.com - ip"
time="2024-02-05T09:28:22Z" level=info msg="Checking IP for domain domain.com"
time="2024-02-05T09:28:23Z" level=info msg="Querying records with type: A"
time="2024-02-05T09:28:24Z" level=info msg="Record OK: domain.com -  ip"
time="2024-02-05T09:28:24Z" level=info msg="Checking IP for domain domain.com"
time="2024-02-05T09:28:25Z" level=info msg="Querying records with type: A"
time="2024-02-05T09:28:26Z" level=info msg="IP mismatch: Current( ip) vs Cloudflare(69.69.69.69)" --> manages to change correctly
time="2024-02-05T09:28:26Z" level=info msg="Record updated: blogdomain.com -  ip"
time="2024-02-05T09:28:26Z" level=info msg="Record OK: domain.com -  ip"

after 10mins(expected to be 5mins), there is no change in the docker logs output nor any change in the cloudflare ip addr(i set it back to a wrong ip)

Your GoDNS configuration


{
  "provider": "Cloudflare",
  "email": "mail.com",
  "password": "",
  "domains": [
    {
      "domain_name": "domain.com",
      "sub_domains": ["www", "@", "blog"]
    }
  ],
  "resolver": "8.8.8.8",
  "ip_urls": ["https://api.seeip.org/","https://ifconfig.me/ip"],
  "ip_type": "IPv4",
  "interval": 30,
  "socks5_proxy": "",
  "proxied": true
}```

**Expected behavior**  
After 5 mins, a wrongly set ip record on blog.domain.com should be updated to reflect the correct ip and corresponding logs should be seen in the docker logs output

**Screenshots**  
If applicable, add screenshots to help explain your problem.

**Environment (please complete the following information):**  
 - DNS Provider: cloudflare
 - OS: ubuntu server
 - docker version: 24.0.5
 - image version: latest(as per writing)

**Additional context**  
Add any other context about the problem here.
fishjojo1 commented 5 months ago

Update: the same issue occurs with systemctl as well. Am i misunderstanding something about the configuration? xd

fishjojo1 commented 5 months ago

Ah...I misunderstood the config options. Read thru the source and just realised it caches the ip. Thanks for the great tool and apologies for any inconveniences caused :)

TimothyYe commented 5 months ago

https://github.com/TimothyYe/godns?tab=readme-ov-file#display-debug-info

If you enable the debug_info feature, you will get more detailed debug information.