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

Lookup public IP using HTTP #14

Merged
merged 2 commits into from
Jul 24, 2024
Merged

Lookup public IP using HTTP #14

merged 2 commits into from
Jul 24, 2024

Conversation

carlhoerberg
Copy link
Contributor

@carlhoerberg carlhoerberg commented Jul 23, 2024

WHY are these changes introduced?

Both OpenDNS and Google DNS has problems looking up the public IP on IPv6 connections. Lookup up using HTTP (TCP) seems more stable. The lookup time is about 110ms longer with this mechanism.

checkip.amazonaws.com for now only resolvs to IPv4 addresses. If that would change we would need to lookup the A address of the domain and connect to that IP manually. It's like 2 more lines of code only, if connect_timeout isn't needed, then it's a bit more involved.

WHAT is this pull request doing?

Looking up the public IP using HTTP.

HOW can this pull request be tested?

Specs

@carlhoerberg carlhoerberg requested a review from a team as a code owner July 23, 2024 01:13
lib/sparoid.rb Outdated Show resolved Hide resolved
Both OpenDNS and Google DNS has problems looking up the public IP on
IPv6 connections. Lookup up using HTTP (TCP) seems more stable. The
lookup time is about 110ms longer with this mechanism.

checkip.amazonaws.com for now only resolvs to IPv4 addresses. If that
would change we would need to lookup the A address of the domain and
connect to that IP manually. It's like 2 more lines of code only, if
connect_timeout isn't needed, then it's a bit more involved.
run CI for main and PR, not both, and cache bundle install, add some
newer ruby versions
@carlhoerberg carlhoerberg merged commit 6efde94 into main Jul 24, 2024
5 checks passed
@carlhoerberg carlhoerberg deleted the lookup_ip_by_http branch July 24, 2024 02:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants