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

Public IP package to work over HTTPs and DNS #158

Merged
merged 43 commits into from
Mar 21, 2021
Merged

Conversation

qdm12
Copy link
Owner

@qdm12 qdm12 commented Jan 28, 2021

⚠️ Most added lines come from go.sum which you can ignore since I added the miekg/dns package, required to resolve Chaos records for Cloudflare

  • Base code for HTTP fetching of public IP address for IP4or6, IP4 and IP6
  • Base code for DNS fetching of public IP address for IP4or6, IP4 and IP6 (refers to Feature request: use DNS queries instead of HTTPS requests to determine IP address #136)
  • Thread safety for all fetchers
  • Cycle between selected providers - sequentially in a ring
  • Cycle between selected fetch methods (dns, http) - at random
  • Add some unit tests
    • HTTP: full coverage
    • DNS
      • How to mock resolver???
      • Add unit tests for miekg/dns... or just trust in the integration test
      • Add moare unit tests although that's not really necessary
  • Add integration tests
    • HTTP
    • DNS
      • Google
      • Cloudflare; add support for Chaos records
  • Assign each IP method to the right IP version for http to avoid breaking changes and add comment to remove on next major version bump. Add an exported method to do so in the publicip/http package which returns what ipversions the provider supports No need, there are already separated IP_METHOD environment variables for each IP version
  • CSV IP methods providers for both HTTP and DNS
  • Document CSV providers behavior
  • Document cycling for HTTP fetcher is sequential and not random selection No one cares

Next PR

  • Add publicip protocol environment variable PUBLICIP_METHOD to select http, dns or both (indicate it will cycle between each at random uniformly distributed)
  • Change environment variables naming e.g. IP_METHOD -> PUBLICIP_HTTP_IP_PROVIDER while keeping retrocompatibility
  • Add environment variable PUBLICIP_DNS_IP_PROVIDER (valid for ip4or6, ip4 and ip6)

And in another PR

  • Put ipinfo package from gluetun in there to get country and other information on an IP address, with the option to have more providers. It won't be used for this program but should be part of the package.

@qdm12 qdm12 merged commit 0a89666 into master Mar 21, 2021
@qdm12 qdm12 deleted the public-ip-package branch March 21, 2021 21:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
DDNS Updater
  
Awaiting triage
Development

Successfully merging this pull request may close these issues.

None yet

1 participant