-
Notifications
You must be signed in to change notification settings - Fork 302
feat: add a DNS resolver trait #3473
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
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 tasks
68a623a
to
0254fd6
Compare
Documentation for this PR has been generated and is available at: https://n0-computer.github.io/iroh/pr/3473/docs/iroh/ Last updated: 2025-09-30T07:48:29Z |
This was referenced Sep 29, 2025
dignifiedquire
approved these changes
Sep 29, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good to me
github-merge-queue bot
pushed a commit
that referenced
this pull request
Sep 30, 2025
## Description Based on #3473 In addition to the trait added in #3473 ,this adds a builder to allow setting more than one custom nameserver on the default hickory resolver, and to allow using other protocols than UDP. The additional protocols are DNS over TCP, TLS, and HTTPS. For the latter two I enabled the `https` feature of `hickory-resolver` - this doesn't add any new dependencies, as tokio-rustls and h2 are in the tree already through reqwest. ## Breaking Changes <!-- Optional, if there are any breaking changes document them, including how to migrate older code. --> ## Notes & open questions There's two more protocols [supported by hickory](https://docs.rs/hickory-proto/latest/hickory_proto/xfer/enum.Protocol.html) though behind non-default feature flags: Quic and H3. If there's demand, we could enable those too. ## Change checklist <!-- Remove any that are not relevant. --> - [ ] Self-review. - [ ] Documentation updates following the [style guide](https://rust-lang.github.io/rfcs/1574-more-api-documentation-conventions.html#appendix-a-full-conventions-text), if relevant. - [ ] Tests if relevant. - [ ] All breaking changes documented. - [ ] List all breaking changes in the above "Breaking Changes" section. - [ ] Open an issue or PR on any number0 repos that are affected by this breaking change. Give guidance on how the updates should be handled or do the actual updates themselves. The major ones are: - [ ] [`quic-rpc`](https://github.com/n0-computer/quic-rpc) - [ ] [`iroh-gossip`](https://github.com/n0-computer/iroh-gossip) - [ ] [`iroh-blobs`](https://github.com/n0-computer/iroh-blobs) - [ ] [`dumbpipe`](https://github.com/n0-computer/dumbpipe) - [ ] [`sendme`](https://github.com/n0-computer/sendme)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Replaces #2116
Fixes #3468
This adds a
Resolver
trait to abstract over DNS resolution. It contains methods to resolve IPv4 or IPv6 addresses, and TXT records. Because the trait needs to be dyn-compatible for our usage (we don't want to have a generic for the DNS resolver on the Endpoint), all methods return boxed futures that contain boxed iterators.To not pay the cost of boxing when using the default hickory-based resolver, the iroh
DnsResolver
internally contains an enum which is either the default resolver or the boxed custom resolver.Users can implement the
Resolver
trait on whatever struct to use a completely custom DNS resolver.Breaking Changes
Changes in
iroh_relay::dns
(reexported fromiroh::dns
):DnsResolver::lookup_txt
now returnsimpl Iterator<Item = TxtRecord>
TxtLookup
andTXT
are removed.Changes in
iroh_relay::node_info
(reexported fromiroh::discovery
):NodeInfo::from_txt_lookup
now takesdomain_name: String, lookup: impl Iterator<Item = crate::dns::TxtRecordData>
Moved items:
iroh_relay::node_info::LookupError
was moved toiroh_relay::dns::LookupError
Notes & open questions
We likely want to still add a builder for our DnsResolver to allow setting a few more of the common options on the hickory resolver. But with this, people that want to use some completely custom way of resolving DNS records can do so.
Change checklist
quic-rpc
iroh-gossip
iroh-blobs
dumbpipe
sendme