mirror of
https://github.com/hickory-dns/hickory-dns.git
synced 2026-04-25 11:15:54 +03:00
[PR #3449] [MERGED] resolver: add Ipv6AndIpv4 strategy #3851
Labels
No labels
blocked
breaking-change
bug
bug:critical
bug:tests
cleanup
compliance
compliance
compliance
crate:all
crate:client
crate:native-tls
crate:proto
crate:recursor
crate:resolver
crate:resolver
crate:rustls
crate:server
crate:util
dependencies
docs
duplicate
easy
easy
enhance
enhance
enhance
feature:dns-over-https
feature:dns-over-quic
feature:dns-over-tls
feature:dnsssec
feature:global_lb
feature:mdns
feature:tsig
features:edns
has workaround
ops
perf
platform:WASM
platform:android
platform:fuchsia
platform:linux
platform:macos
platform:windows
pull-request
question
test
tools
tools
trust
unclear
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/hickory-dns#3851
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/hickory-dns/hickory-dns/pull/3449
Author: @Jeidnx
Created: 1/30/2026
Status: ✅ Merged
Merged: 2/16/2026
Merged by: @djc
Base:
main← Head:ipv6_first_lookup📝 Commits (4)
80496acresolver: factor out parallel lookup logic15342fdresolver: add Ipv6AndIpv4 lookup strategy1a59f44resolver: simplify rt_then_swap33432a6resolver: make Ipv6AndIpv4 the default lookup strategy📊 Changes
3 files changed (+125 additions, -46 deletions)
View changed files
📝
crates/resolver/src/config.rs(+4 -2)📝
crates/resolver/src/lookup_ip.rs(+107 -39)📝
tests/integration-tests/tests/integration/lookup_tests.rs(+14 -5)📄 Description
This strategy also tries to query A and AAAA, but crucially orders the result to prefer AAAA records.
Since we can't really have a happy eyeballs implementation without a mechanism to stream dns responses, the next best thing is to give clients both AAAA and A.
This allows them to implement "happy eyeballs -like", by resolving and connecting to both v6 and v4 simultaneously, and preferring the v6 connection.edit: after sleeping over this, the above doesn't make a ton of sense. If a client wanted to implement "happy eyeballs -like", the ordering of the records wouldn't really matter i suppose.
What this does accomplishes is to make sure clients have the option to always prefer ipv6 addresses, when they try connections in the order of the lookup response.
See also this issue in reqwest and this comment by seanmonstar
On the implementation: I just copied the TODO comments, but unsure if they still really apply here. If there would exist a streaming interface, it wouldn't make sense to order the responses. Instead i imagine there would be one option to just stream the responses as soon as they come in, and one option which implements happy eyeballs.
Also maybe consider making this Ipv6AndIpv4 Strategy the default?
And i didn't add any test, since i couldn't find any tests for any of the strategies. If wanted, i could try to add some integration tests for the strategies.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.