Skip to content

Refactor(hostname): Skip DNSLink for local IP addresses to avoid DNS queries #880

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

Merged
merged 4 commits into from
Mar 12, 2025

Conversation

gitsrc
Copy link
Contributor

@gitsrc gitsrc commented Mar 11, 2025

This PR refactors the hostname handling logic to skip DNSLink lookups for IP addresses.

The hasDNSLinkRecord function now explicitly checks if the provided hostname is an IP address. If it is an IP address, the function immediately returns false, skipping the DNSLink lookup.

This change avoids unnecessary DNS queries when the hostname is an IP address. This improves efficiency and reduces potential delays, especially in local development environments where DNS lookups for IPs are not needed and can sometimes cause issues.

Closes #879

@gitsrc gitsrc requested review from lidel and a team as code owners March 11, 2025 11:58
@gitsrc gitsrc changed the title Refactor(hostname): Skip DNSLink lookup for local IP addresses to avo… Refactor(hostname): Skip DNSLink for local IP addresses to avoid DNS queries Mar 11, 2025
@gammazero gammazero self-assigned this Mar 11, 2025
@gammazero
Copy link
Contributor

Turns out that we need to igore app IP addresses, not just localhost.

@gammazero gammazero merged commit cf6b088 into ipfs:main Mar 12, 2025
12 checks passed
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.

Slow responses to requests on 127.0.0.1 when DNSLink enabled
2 participants