Skip to content

No IP cache used if IP is not mismatched when godns is started #136

@demifiend9

Description

@demifiend9

Describe the bug

If the domain IP is same as current IP, godns keeps quering the api repeatedly even though IP update is not needed.

time="2022-03-08T16:32:01+05:30" level=info msg="GoDNS started, entering main loop..."
time="2022-03-08T16:32:01+05:30" level=info msg="Creating DNS handler with provider:Cloudflare"
time="2022-03-08T16:32:01+05:30" level=info msg="Checking IP for domain example.com"
time="2022-03-08T16:32:02+05:30" level=info msg="Querying records with type:AAAA"
time="2022-03-08T16:32:03+05:30" level=info msg="Record OK: gg.example.com - 2401:4900:xxxxxxxxxxxxxxxxxxxxxxx\r\n"
time="2022-03-08T16:32:03+05:30" level=info msg="Record OK: ff.example.com - 2401:4900:xxxxxxxxxxxxxxxxxxxxxxx\r\n"
time="2022-03-08T16:38:16+05:30" level=info msg="Checking IP for domain example.com"
time="2022-03-08T16:38:17+05:30" level=info msg="Querying records with type:AAAA"
time="2022-03-08T16:38:18+05:30" level=info msg="Record OK: gg.example.com - 2401:4900:xxxxxxxxxxxxxxxxxxxxxxx\r\n"
time="2022-03-08T16:38:18+05:30" level=info msg="Record OK: ff.example.com - 2401:4900:xxxxxxxxxxxxxxxxxxxxxxx\r\n"
time="2022-03-08T16:39:18+05:30" level=info msg="Checking IP for domain example.com"
time="2022-03-08T16:39:19+05:30" level=info msg="Querying records with type:AAAA"
time="2022-03-08T16:39:20+05:30" level=info msg="Record OK: gg.example.com - 2401:4900:xxxxxxxxxxxxxxxxxxxxxxx\r\n"
time="2022-03-08T16:39:20+05:30" level=info msg="Record OK: ff.example.com - 2401:4900:xxxxxxxxxxxxxxxxxxxxxxx\r\n"
time="2022-03-08T16:40:20+05:30" level=info msg="Checking IP for domain example.com"
time="2022-03-08T16:40:22+05:30" level=info msg="Querying records with type:AAAA"
time="2022-03-08T16:40:23+05:30" level=info msg="Record OK: gg.example.com - 2401:4900:xxxxxxxxxxxxxxxxxxxxxxx\r\n"
time="2022-03-08T16:40:23+05:30" level=info msg="Record OK: ff.example.com - 2401:4900:xxxxxxxxxxxxxxxxxxxxxxx\r\n"
time="2022-03-08T16:41:23+05:30" level=info msg="Checking IP for domain example.com"
time="2022-03-08T16:41:24+05:30" level=info msg="Querying records with type:AAAA"
time="2022-03-08T16:41:25+05:30" level=info msg="Record OK: gg.example.com - 2401:4900:xxxxxxxxxxxxxxxxxxxxxxx\r\n"
time="2022-03-08T16:41:25+05:30" level=info msg="Record OK: ff.example.com - 2401:4900:xxxxxxxxxxxxxxxxxxxxxxx\r\n"

Cache is made only after IP is updated once

time="2022-03-08T17:25:11+05:30" level=info msg="IP mismatch: Current(2401:4900:xxxxxxxxxxxxxxxxxxxxxxx) vs Cloudflare(2401:4900:xxxxxxxxxxxxxxxxxxxxxxx)\r\n"
time="2022-03-08T17:25:13+05:30" level=info msg="Record updated: gg.example.com - 2401:4900:xxxxxxxxxxxxxxxxxxxxxxx"
time="2022-03-08T17:25:13+05:30" level=info msg="IP mismatch: Current(2401:4900:xxxxxxxxxxxxxxxxxxxxxxx) vs Cloudflare(2401:4900:xxxxxxxxxxxxxxxxxxxxxxx)\r\n"
time="2022-03-08T17:25:14+05:30" level=info msg="Record updated: ff.example.com - 2401:4900:xxxxxxxxxxxxxxxxxxxxxxx"
time="2022-03-08T17:35:14+05:30" level=info msg="IP is the same as cached one (2401:4900:xxxxxxxxxxxxxxxxxxxxxxx). Skip update.\n"
time="2022-03-08T17:36:14+05:30" level=info msg="IP is the same as cached one (2401:4900:xxxxxxxxxxxxxxxxxxxxxxx). Skip update.\n"
time="2022-03-08T17:37:14+05:30" level=info msg="IP is the same as cached one (2401:4900:xxxxxxxxxxxxxxxxxxxxxxx). Skip update.\n"
time="2022-03-08T17:38:14+05:30" level=info msg="IP is the same as cached one (2401:4900:xxxxxxxxxxxxxxxxxxxxxxx). Skip update.\n"
time="2022-03-08T17:39:14+05:30" level=info msg="IP is the same as cached one (2401:4900:xxxxxxxxxxxxxxxxxxxxxxx). Skip update.\n"
time="2022-03-08T17:40:14+05:30" level=info msg="IP is the same as cached one (2401:4900:xxxxxxxxxxxxxxxxxxxxxxx). Skip update.\n"
time="2022-03-08T17:41:14+05:30" level=info msg="IP is the same as cached one (2401:4900:xxxxxxxxxxxxxxxxxxxxxxx). Skip update.\n"
time="2022-03-08T17:42:14+05:30" level=info msg="IP is the same as cached one (2401:4900:xxxxxxxxxxxxxxxxxxxxxxx). Skip update.\n"

The frequency of this issue

  • This issue is easy to reproduce.
  • This issue is not easy to reproduce.

Steps to Reproduce
Start godns when no ip update is needed

Expected behavior
Even if IP update is not needed when godns is started, IP cache should be made and used, to minimise the amount of api calls done.

Environment (please complete the following information):

  • DNS Provider: Cloudflare
  • OS: Windows 10

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions