The response parser only checked the transaction ID, the QR bit, the
presence of a question, and the RCODE. It then took the queried name
from the response's own question section, so a forged reply that guessed
the 16-bit ID and supplied its own question could have its answers
accepted for an arbitrary name. CNAME-following decisions were taken on
a packet whose ID was never verified, since only the final hop was
checked.
Validate every hop in send_query_following_cnames: check_response now
takes the queried name and type and rejects any response whose single
question does not echo them, alongside the existing ID, QR, and RCODE
checks. The parse_* functions become pure extractors that run on an
already-validated response, anchoring CNAME resolution on the verified
question.
Gating the apple reader on target_os = "macos" left iOS, tvOS, and
watchOS on the generic Unix reader, which parses /etc/resolv.conf. On
iOS the sandbox hides that file, so the resolver fell back to the public
nameservers. hickory routed every Apple target through
SystemConfiguration. Gate on target_vendor = "apple" to match, and
exclude the same vendor from the Unix reader.
The mock UDP/TCP servers returned responses with no question section,
which a real server never does. Now that the resolver rejects
question-less responses, the mocks must echo the question to stay
realistic. Pairs with the question-section validation change.
The Unix resolv.conf parser recognizes nameserver, search, domain, and
options ndots, and silently ignores the rest. Record that timeout,
attempts, rotate, and sortlist are dropped on purpose: iroh imposes its
own timeouts and attempt budget, orders nameservers by measured RTT, and
selects addresses itself, so honoring them would not change behavior.
`name_matches` accepted every answer record when the parsed response
carried no question section, so a spoofed reply that guessed the 16-bit
transaction ID could inject records for an arbitrary name. A well-formed
response always echoes the query's question (RFC 1035 Section 4.1.2).
Reject question-less responses in `check_response` and tighten the
now-unreachable `name_matches` fallback to match nothing.
macOS does not reliably keep /etc/resolv.conf in sync with the live
resolver configuration, so the generic Unix reader could miss the
nameservers the system is actually using. The old hickory-resolver path
read the primary resolver from the SystemConfiguration framework on
Apple targets; the rewrite routed macOS through the resolv.conf reader
and lost that.
Add an apple module that reads ServerAddresses and SearchDomains from
the dynamic store key State:/Network/Global/DNS, and dispatch macOS to
it. This restores the previous source of truth for the default resolver.
Scoped per-domain resolvers (VPN split-DNS) live under other keys and
were not read by the old path either, so they remain out of scope.
The simple-dns resolver only special-cased localhost and otherwise went
straight to the network, dropping the hosts-file overrides the old
hickory-backed resolver honored through its use_hosts_file default. An
operator pinning a relay or discovery origin to a fixed address in
/etc/hosts (self-hosted relays, CI and Docker setups) saw the name go to
real DNS and resolve to nothing or to the wrong address.
Parse the hosts file once at construction when system defaults are in
use, and check it ahead of the cache for IPv4 and IPv6 lookups. Reading
it at construction mirrors reading /etc/resolv.conf and performs no
network IO, so it is safe on the reset path.
## Description
I ran tests that check for holepunching with one interface working for
holepunching among 16 configured interfaces in a loop 300 times, and
they didn't fail once. We should probably expect this to not regress or
be flaky.
Also added a version of these tests with 32 interfaces. These tests
consistently fail, so they're behind an `#[ignore]` annotation for now.
## Change checklist
<!-- Remove any that are not relevant. -->
- [x] Self-review.
---------
Co-authored-by: Franz Heinzmann <frando@unbiskant.org>
## Description
This simply fixes the docs to fix#4350.
## Breaking Changes
n/a
## Notes & open questions
The values and interactions of these keep alive and idle timers are
still a bit messy. They need to be cleaned up in noq first though. But
we're also limited now that everything is 1.0.
## Change checklist
- [x] Self-review.
- [x] 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.
The reaper now holds a Weak reference to the pool and exits once the pool
is dropped, instead of holding the connections alive behind an
AbortOnDropHandle. Dropping the pool (e.g. when a network change rebuilds
the resolver) now closes its idle sockets immediately rather than waiting
for the task abort to propagate, and there is no join handle to store.
Plain-TCP and DNS-over-TLS queries previously opened a fresh connection
every time, paying the TCP (and for DoT, TLS) handshake on each lookup.
Add a small per-nameserver connection pool that checks a connection out
for exclusive use and returns it on success, so the handshake is
amortized across repeated queries to the same server.
Idle connections are dropped on checkout once older than IDLE_TIMEOUT and
capped per nameserver; a background task sweeps connections that no
checkout touches, so a nameserver queried once does not pin a socket open.
UDP stays unpooled (a fresh source port per query helps prevent cache
poisoning) and DoH reuses connections inside reqwest already.
A major network change rebuilds the resolver via `reset()` to pick up new
nameservers. It used to start with an empty cache, so lookups went cold
exactly during the transition (e.g. WiFi to 5G) and reconnects stranded
while DNS was still in flux. Make `DnsCache` Arc-backed and carry it into
the rebuilt resolver, so cached records keep serving until the new
nameservers settle.
Closes#4037
## Description
Uses https://github.com/taiki-e/install-action/ instead of binstall
directly. This also passes `--force` which hopefully fixes the
occasional failures we had with binstall apparently not installing for
real.
## Description
- Add a type.
- Skip the redundant "bug: " prefix in the description.
- Ask for trace logs instead of debug.
- Remove the default.md because github already offers the "empty" one
which is the same and is a bit confusing right.
## Breaking Changes
n/a
## Notes & open questions
n/a
## Change checklist
- [x] Self-review.
## Description
The `unstable-custom-transport` feature enables custom transport and
custom path selection. For the latter, we were missing an export of
`FourTuple` used in the then-public `PathSelector` trait.
Also adds a warning that these APIs are unstable.
## Notes & open questions
<!-- Any notes, remarks or open questions you have to make about the PR.
-->
## Change checklist
<!-- Remove any that are not relevant. -->
- [x] Self-review.
- [x] 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.
- [x] Tests if relevant.
- [x] All breaking changes documented.
## Description
We have a `doc_hidden` functions `Endpoint::net_report` and
`Endpoint::last_net_report`. This PR put `iroh::Endpoint::net_report`
behind a new feature `unstable-net-report` instead, together with the
items exposed via these functions (i.e. `NetReport` and contained
items).
Also marked the `NetReport` and `Probe` items as `non_exhaustive`, and
removes `iroh::Endpoint::last_net_report` to keep the unstable API
surface small (you can just call `Endpoint::net_report().get()` to get
the latest net report).
## Breaking Changes
None, because we don't consider the previous `doc(hidden)` API as public
API.
Listing the changes nevertheless here (but not marking the PR as
breaking):
* changed: `iroh::Endpoint::net_report` is now gated behind
`unstable-net-report` feature
* removed: `iroh::Endpoint::last_net_report`. Use
`iroh::Endpoint::net_report().get()` instead.
* removed: `iroh::NetReport`. it is now available only with the
`unstable-net-report` feature under
`iroh::unstable_net_report::NetReport`
## Notes & open questions
<!-- Any notes, remarks or open questions you have to make about the PR.
-->
## Change checklist
<!-- Remove any that are not relevant. -->
- [x] Self-review.
- [x] 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.
- [x] All breaking changes documented.
## Description
This allows to set `hostname = ["relay.foo.org", "relay.bar.org"]` in
the iroh-relay TOML config.
Setting a single string like previously, `hostname = "relay.foo.org"` ,
is still accepted as well, so this is not a breaking change to config
formats.
It also adds enviroment variables to override the ACME directory URL to
allow using the ACME adaptor with other servers than letsencrypt.
Finally, this adds a test script that tests the setup with a
locally-running `pebble` ACME server. I confirmed locally that it works.
Not sure if we want to run it in CI as well.
## Breaking Changes
<!-- Optional, if there are any breaking changes document them,
including how to migrate older code. -->
## Notes & open questions
<!-- Any notes, remarks or open questions you have to make about the PR.
-->
## Change checklist
<!-- Remove any that are not relevant. -->
- [x] Self-review.
- [x] 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.
- [x] Tests if relevant.
On a fresh resolver, fallback nameservers are queried in list order, and the DoH entries sat behind all twelve UDP servers. On a network that silently drops UDP/53 the lookup timed out before DoH was ever tried -- the exact case it exists for.
Move the DoH entries just after the two fastest UDP primaries so they land within the happy-eyeballs first wave (MAX_CONCURRENT_QUERIES). On a working network UDP still answers before the staggered DoH attempts start, so no TLS handshake is wasted; when port 53 is blocked DoH is raced immediately. A test pins a DoH entry within the first wave.
Narrow items that are only reachable within their own module to private: the internal Nameserver type (and its fields and constructor), DnsConfig::from_nameservers, attrs::endpoint_id_from_txt_name, and TxtAttrs::from_strings.
Carry an optional TLS server name per nameserver internally, so DNS-over-TLS and DNS-over-HTTPS can be configured against providers whose certificates cover a hostname rather than the IP.
Add Builder::with_tls_nameserver and Builder::with_https_nameserver; the existing tuple-based with_nameserver/with_nameservers and the DnsProtocol enum are unchanged, so the change is additive. DoT uses the name for SNI; DoH addresses the URL by hostname with the connection pinned to the configured IP via reqwest, avoiding a bootstrap resolution loop.
Confirmed via the live certificates that Cloudflare, Google and Quad9 all carry their anycast IPs as iPAddress SANs, so IP-addressed DNS-over-HTTPS validates for every fallback entry.
Order nameservers by smoothed RTT relative to a neutral baseline so a measured-fast server stays ahead of an idle or recovering one, instead of unprobed or decayed servers sorting as fastest.
Verify the host and query type on a DNS cache hit, so a 64-bit key collision returns a miss rather than another name's records.
Fall back to public resolvers only when neither the system nor the builder provides a nameserver, so explicit servers are no longer mixed behind the fallback set; drop the now-redundant system_with_fallback. Correct the DoH-by-IP certificate comment.
Replace the fixed-stagger fan-out in send_query with a bounded happy-eyeballs loop: try the historically fastest nameserver first, start the next after a short delay or as soon as the in-flight one fails, and cap concurrency so a long nameserver list no longer blasts every server.
Track a per-nameserver smoothed RTT (EWMA on success, penalty on failure, read-time decay) to order servers and re-probe demoted ones, so the list is self-healing.
Expand the fallback to Cloudflare, Google and Quad9 over UDP (v4 and v6, primary and secondary) plus DNS-over-HTTPS when a crypto provider is available, so resolution still works when one provider is down or plain DNS is blocked.
Refactor the system config type to DnsConfig with system, fallback, from_nameservers and system_with_fallback constructors.
Move the per-platform system DNS readers into unix, windows and android submodules under dns::system_config, each exposing read_system_dns().
Android no longer forwards to hickory_resolver: its JNI reader, which reads the active network's DNS servers from LinkProperties.getDnsServers(), is inlined and adapted to return SystemDnsConfig. install_android_jni_context moves alongside it and is re-exported at the crate root unchanged.
Add jni (android) and ipconfig (windows) as platform dependencies.
## Description
The [README of the iroh
crate](https://github.com/n0-computer/iroh/tree/main/iroh) is the first
thing people see on https://crates.io/crates/iroh or
https://lib.rs/iroh, and we should improve it.
Right now it mostly talks about structured events, which is a very minor
thing in the grand scheme of things. And it has no code example.
This PR improves the README. Happy to discuss or iterate.
## Description
Updates to the latest noq main, especially due to this bug fix:
https://github.com/n0-computer/noq/pull/695
That fix makes `switch_client_dual_to_v4` non-flaky.
## Breaking Changes
None
## Change checklist
<!-- Remove any that are not relevant. -->
- [x] Self-review.
## Description
This is a cleanup pass over all docs of public items. Fixes typos, odd
grammar, non-adherence to doc guidelines, and other minor things.