refactor(iroh-dns): use n0-dns-resolver instead of hickory-resolver#4419
Open
Frando wants to merge 11 commits into
Open
refactor(iroh-dns): use n0-dns-resolver instead of hickory-resolver#4419Frando wants to merge 11 commits into
Frando wants to merge 11 commits into
Conversation
|
Documentation for this PR has been generated and is available at: https://n0-computer.github.io/iroh/pr/4419/docs/iroh/ Last updated: 2026-07-22T08:42:31Z |
Contributor
|
lol android failing |
18 tasks
New error variants were inserted before InvalidResponse, shifting its discriminant from 5 to 8 and failing the semver check. Append the new variants after it instead so no existing discriminant moves.
The endpoint's default DNS resolver was built with `DnsResolver::builder().tls_client_config(..).build()`, which does not opt into the system DNS configuration, so it never read /etc/resolv.conf and only queried the public fallback resolvers. In sandboxed setups where the system resolver is the only reachable one (e.g. patchbay's lab DNS, which serves relay.test), every lookup failed and fell through to the unreachable fallback, timing out the tests. Add `.with_system_defaults()` so the default resolver reads the system nameservers, as it did before the n0-dns-resolver migration.
Member
Author
|
I'm marking this as ready for review. The main review target should be https://github.com/n0-computer/n0-dns-resolver. So if someone is up for reviewing this, that would be great. Can just open issues over there with findings. We'd then release n0-dns-resolver 0.10 once happy, and update this branch to use it. Deferring publishing though until we have some review. |
Frando
marked this pull request as ready for review
July 22, 2026 08:47
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
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
This replaces our use of
hickory-resolverwith a new crate,n0-dns-resolver. It is more lightweight, yet should cover all features we need. Being owned by us, it will also allow to tune things for our usecases better, if needed.The DNS resolver in
n0-dns-resolverwas built in a PR to iroh initially, see #4036. This PR supersedes #4036, which has the history of the new resolver.n0-dns-resolverhas since been expanded slightly.It adds one feature: We now allow to configure a
FallbackMode:On
main, we would unconditionally fall back to using Google's nameservers if reading the system config fails. I never liked this, because it means that there's no way to configure iroh's DNS resolver to use system config, but never fall back to Google. So this adds a configuration (which is natively supported by n0-dns-resolver, which also includes a static list of DNS servers from Google, Cloudflare, Quad9): Use fallback only if system config cannot be loaded for whatever reason, or never use fallback, or use fallback as a deferred second tier of nameservers (if primary tier from system conf doesnt reply, use the fallback). The latter is the default now, and will make DNS resolution more reliable, as iroh will now survive a badly configured host system as long as IP connectivity to the fallback servers (UDP or TCP) exists.Breaking Changes
None, this is all internal.
Notes & open questions
n0-dns-resolver still needs review scrutiny. It is reasonably small:
i.e. around 6k lines in total, with 2.1k lines of Rust code (rest is tests, blanks, comments).
simple-dnsis the main dependency, but it is in our tree regardless.It has 6k rust code, 12k total. So both combined have 8k rust code, 18k total.
Whereas
hickory-resolver,hickory-net,hickory-protocombined have about 28k rust, 78k total, which explains the binary size reduction.Binary size savings
Size comparison for a size-optimized release, a simple binary with iroh and tokio as only dependencies:
5.4MBforirohonmain4.8MBforirohpatched to this PRSo binary size savings of about 600KB or more than 10%.
Change checklist
proposed change and wrote an as clear and concise description as
they could.
intented effect.