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.
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
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
Updates `ed25519-dalek` to `=3.0.0-rc.0` and `curve25519-dalek` to
`=5.0.0-rc.0`. Not sure if the final release will be made in time. We
can do a minor release though once the final version comes out. It will
be "semi-breaking" but there's nothing we can do about it then (builds
will break for people who have `=3.0.0-rc.0` in their *own* Cargo.toml).
## Description
This was an oversight. In general we should prefer potable_atomic since
it falls back to normal atomics on 64 bit but also works on 32 bit
platforms.
I think this should be uncontroversial since we already use portable
atomics elsewhere.
Needed to get iroh to work on esp32 and other 32 bit platforms.
## Breaking Changes
None
## Notes & open questions
Note: this is not a breaking change and does not need to go in before
1.0
## 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)
## Description
Previously noq always allowed the server to migrate during the
handshake. So now we just always override that setting.
## Breaking Changes
n/a
## Notes & open questions
Some tests manually create noq::TransportConfig, they have been manually
adjusted. From the public API this isn't possible.
## Change checklist
- [ ] Self-review.
## Description
Patches noq to https://github.com/n0-computer/noq/pull/672
Makes iroh successfully holepunch when the server is behind a hard NAT
and the client is behind an easy NAT. The reverse aready worked before.
## Breaking Changes
n/a
## Notes & open questions
(@flub hijacked this PR)
Once https://github.com/n0-computer/noq/pull/672 is merged I'll update
this PR to point to noq main again before merging.
## Change checklist
- [x] Self-review.
- [x] Tests if relevant.
---------
Co-authored-by: Floris Bruynooghe <flub@n0.computer>
## Description
Updates to the latest main, including `#[non_exhaustive]` changes to
`PathEvent`: https://github.com/n0-computer/noq/pull/648
## Notes & open questions
Adding a `#[cfg(test)] panic!()` to ensure we keep the versions in noq
and iroh in sync and see iroh tests failing when we add more path
events.
## Change checklist
<!-- Remove any that are not relevant. -->
- [x] Self-review.
## Description
This makes `Endpoint::close` in most cases (no packet loss) much faster:
- It is basically instant (or rather - its performance independent of
the network) when all connections that were open were already closed
remotely (we waited for `connection.closed().await` before calling
`Endpoint::close`).
- It takes ~1 RTT (the worst RTT among all connections that is), when we
initiated the close locally immediately before calling
`Endpoint::close`. The round trip is the CONNECTION_CLOSE frame going
one way and coming back. This only works if we didn't experience any
packet loss.
Fixes https://github.com/n0-computer/iroh/issues/4201
This is a sort of "batch" of work to make this happen:
- It depends on the noq feature to only wait for *entering* the draining
state, not exiting it, allowing us to close the socket earlier:
https://github.com/n0-computer/noq/pull/651
- It fixes [a
bug](https://github.com/n0-computer/iroh/blob/main/iroh/src/socket/transports.rs#L252-L254)
where we cut off all packet receiving after *entering* `Endpoint::close`
(this is too early! it doesn't allow `noq::Endpoint::wait_idle` to do
its job!)
- It fixes another bug in `Runtime::close` where that would always wait
for all `EndpointDriver` and `ConnectionDriver`s to run to completion,
even if we know we can short-circuit (because we know we've waited for
`wait_idle`!).
It also contains some small logging impovements (I was able to remove
`Socket::public_key` because it was only used for logging in a redundant
way).
## Breaking Changes
None.
## Notes & open questions
- [x] Depends on one noq PR to be merged.
## 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.
## Description
Adds two integration tests that demonstrate embedding the relay inside
an external HTTP server:
- `tests/relay_hyper.rs`: serves a `RelayServiceWithNotify` directly via
hyper.
- `tests/relay_axum.rs`: uses axum, its `Router` and its
`WebSocketUpgrade` for the `/relay` route. Then passes the client stream
to the relay `Clients`. Does not use `RelayServeWthNotfy`.
Also exports the type aliases
`iroh_relay::server::http_server::BytesBody`, `HyperError`, and
`HyperResult` so that external code can name the response and error
types of `RelayServiceWithNotify`'s hyper service.
## Change checklist
<!-- Remove any that are not relevant. -->
- [x] Self-review.
## Description
Updates `noq` and adapts iroh to the changes in
https://github.com/n0-computer/noq/pull/617 by reexporting
`noq::Closed`.
## Breaking Changes
* changed: The `OnClosed` future returned from
`iroh::endpoint::WeakConnectionHandle::closed` now resolves to
`iroh::endpoint::Closed`, a struct with public fields for the close
reason, connection stats, and path stats.
## Notes & open questions
It would be nice to have the `TransportAddr` available for the path
stats, but we don't have that info available for paths that were already
closed earlier. Use the new APIs in #4188 instead if this needed.
## 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
When constructing our DnsResolver we call into
`hickory_resolver::read_system_conf`, which on Android uses JNI by going
through `ndk_context` to call `LinkProperties.getDnsServers()`. This
works fine when `ndk_context` has been initialized with a real `JavaVM`
and `Application` context but panics unconditionally if `ndk_context`
has not been initialized. The initialization can either be done manually
or, usually, through a glue crate like `android-activity` or `ndk-glue`.
This means that constructing an iroh endpoint on Android panics if
`ndk_context` hasn't been initialized.
This PR documents the Android requirement and adds an init helper. Using
iroh on Android requires `ndk_context` to be initialized before the
resolver is constructed, otherwise the build panics at the JNI boundary.
The PR adds docs around that on `DnsResolver`,
`Builder::with_system_defaults`, and `Endpoint`, and re-exports the
`ndk_context` init function as `iroh_dns::install_android_jni_context`
so that consumers can init manually. The system-DNS fallback log was
also bumped from `debug` to `warn` so the silent-fallback path actually
surfaces.
Finally, this PR adds CI to run the full iroh test suite in the Android
emulator. When running unit tests in the emulator, we don't have a Java
context. To bypass the panic in debug builds (which is what the test
suite runs as) we wrap the JNI call in `std::panic::catch_unwind` and
let the resolver fall back to public DNS if the ndk_context call panics
(which it does). Release builds let the panic propagate, since
uninitialized `ndk_context` in production is a programming error and
should surface loudly. This is a little ugly I admit, but I have not
found another way around this. Very open to suggestions. But - the test
suite passes! Had to do a couple of tricks to properly wait for
networking on the GitHub-hosted emulator. One regression test in
`iroh/src/socket.rs` is ignored on Android because the emulator's
network stack flakes on rapid rebinds. Will open an issue for that.
## Breaking Changes
## Notes & open questions
Follow-up PRs:
* #4209 adds an APK-based smoke test that exercises the JNI path through
a real `NativeActivity` against `ConnectivityService`.
## 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.
- [x] Tests if relevant.
- [x] All breaking changes documented.
## Description
- Updates to latest noq main & applies fixes
- Renames `QuicTransportConfig::set_max_remote_nat_traversal_addresses`
to `QuicTransportConfig::max_remote_nat_traversal_addresses` for
consistency with noq & other configuration function names
- Changes the defaults for maximum number of QNT addresses and multipath
paths according to discussions in
https://github.com/n0-computer/noq/issues/613 and
[here](https://github.com/n0-computer/noq/pull/620#pullrequestreview-4196031518)
## Breaking Changes
- Renamed `QuicTransportConfig::set_max_remote_nat_traversal_addresses`
to `QuicTransportConfig::max_remote_nat_traversal_addresses`
## 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.
- [x] List all breaking changes in the above "Breaking Changes" section.
---------
Co-authored-by: dignifiedquire <me@dignifiedquire.com>
Co-authored-by: Floris Bruynooghe <flub@n0.computer>
Bumps [redb](https://github.com/cberner/redb) from 3.1.3 to 4.1.0.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/cberner/redb/releases">redb's
releases</a>.</em></p>
<blockquote>
<h2>4.1.0</h2>
<p><strong>This release contains a large number of bug fixes discovered
by AI coding agents</strong></p>
<ul>
<li>Fix a bug where <code>MultimapValue::len()</code> and
<code>is_empty()</code> returned stale counts after
consuming entries via <code>next_back()</code>.</li>
<li>Fix a bug where <code>restore_savepoint()</code> used in a
non-<code>Immediate</code> durability transaction and when
there are persistent savepoints newer than the one being restored, could
fail
with <code>SavepointError::InvalidSavepoint</code>, but the savepoint
would actually be partially applied.
The call now fails up front with
<code>SavepointError::ImmediateDurabilityRequired</code>.</li>
<li>Fix a bug in <code>restore_savepoint()</code> where modifications
made earlier in the transaction might
not be reverted.</li>
<li>Fix a bug where renaming a table that was already modified in the
same transaction could cause
the database to become corrupted.</li>
<li>Fix a bug where calling <code>restore_savepoint()</code> after
modifying a table in the same
transaction could cause the table to become corrupted in a future
transaction.</li>
<li>Fix a panic when <code>delete_table()</code> was called on a table
that had been modified in the same
transaction.</li>
<li>Fix a panic in <code>restore_savepoint()</code> when passed a
<code>Savepoint</code> from a different <code>Database</code>.
<code>SavepointError::InvalidSavepoint</code> is now returned
instead.</li>
<li>Fix a bug where a transaction that created a persistent savepoint
and was then
aborted could cause the database file to grow excessively, until the
<code>Database</code> was dropped.</li>
<li>Fix a panic in <code>check_integrity()</code> when called while
another transaction is still alive.
<code>DatabaseError::TransactionInProgress</code> is now returned
instead.</li>
<li>Fix a bug where aborting a transaction that called
<code>restore_savepoint()</code> with a savepoint
when a newer savepoint existed could cause database space to be
leaked.</li>
<li>Fix a bug where aborting a transaction that called
<code>restore_savepoint()</code> would leave more
recent savepoints invalid.</li>
<li>Improve performance when reading concurrently from multiple threads.
Around 15% speedup on some benchmarks.</li>
<li>Optimize cache usage, and general write performance. Around 1.5x
speedup on some benchmarks.</li>
<li>Optimize memory usage.</li>
<li>Other performance optimizations.</li>
</ul>
<h2>4.0.0</h2>
<ul>
<li>Implement <code>Drop</code> on <code>AccessGuardMut</code> and
<code>AccessGuardMutInPlace</code>, which requires that these be dropped
before the <code>Table</code> they borrow from.
This fixes a critical bug where the accessor could outlive the
<code>Table</code>, and be dropped after the
transaction had already committed. This could cause data loss due to the
data in the accessor
being written out after the transaction had already completed.</li>
<li>Remove <code>Legacy</code> type. To migrate off the
<code>Legacy</code> type, use the <code>Legacy</code> type in the 3.x
release
and copy the data to a table with plain tuples, before upgrading to the
4.x release.</li>
</ul>
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/cberner/redb/blob/master/CHANGELOG.md">redb's
changelog</a>.</em></p>
<blockquote>
<h2>4.1.0 - 2026-04-19</h2>
<p><strong>This release contains a large number of bug fixes discovered
by AI coding agents</strong></p>
<ul>
<li>Fix a bug where <code>MultimapValue::len()</code> and
<code>is_empty()</code> returned stale counts after
consuming entries via <code>next_back()</code>.</li>
<li>Fix a bug where <code>restore_savepoint()</code> used in a
non-<code>Immediate</code> durability transaction and when
there are persistent savepoints newer than the one being restored, could
fail
with <code>SavepointError::InvalidSavepoint</code>, but the savepoint
would actually be partially applied.
The call now fails up front with
<code>SavepointError::ImmediateDurabilityRequired</code>.</li>
<li>Fix a bug in <code>restore_savepoint()</code> where modifications
made earlier in the transaction might
not be reverted.</li>
<li>Fix a bug where renaming a table that was already modified in the
same transaction could cause
the database to become corrupted.</li>
<li>Fix a bug where calling <code>restore_savepoint()</code> after
modifying a table in the same
transaction could cause the table to become corrupted in a future
transaction.</li>
<li>Fix a panic when <code>delete_table()</code> was called on a table
that had been modified in the same
transaction.</li>
<li>Fix a panic in <code>restore_savepoint()</code> when passed a
<code>Savepoint</code> from a different <code>Database</code>.
<code>SavepointError::InvalidSavepoint</code> is now returned
instead.</li>
<li>Fix a bug where a transaction that created a persistent savepoint
and was then
aborted could cause the database file to grow excessively, until the
<code>Database</code> was dropped.</li>
<li>Fix a panic in <code>check_integrity()</code> when called while
another transaction is still alive.
<code>DatabaseError::TransactionInProgress</code> is now returned
instead.</li>
<li>Fix a bug where aborting a transaction that called
<code>restore_savepoint()</code> with a savepoint
when a newer savepoint existed could cause database space to be
leaked.</li>
<li>Fix a bug where aborting a transaction that called
<code>restore_savepoint()</code> would leave more
recent savepoints invalid.</li>
<li>Improve performance when reading concurrently from multiple threads.
Around 15% speedup on some benchmarks.</li>
<li>Optimize cache usage, and general write performance. Around 1.5x
speedup on some benchmarks.</li>
<li>Optimize memory usage.</li>
<li>Other performance optimizations.</li>
</ul>
<h2>4.0.0 - 2026-04-02</h2>
<ul>
<li>Implement <code>Drop</code> on <code>AccessGuardMut</code> and
<code>AccessGuardMutInPlace</code>, which requires that these be dropped
before the <code>Table</code> they borrow from.
This fixes a critical bug where the accessor could outlive the
<code>Table</code>, and be dropped after the
transaction had already committed. This could cause data loss due to the
data in the accessor
being written out after the transaction had already completed.</li>
<li>Remove <code>Legacy</code> type. To migrate off the
<code>Legacy</code> type, use the <code>Legacy</code> type in the 3.x
release
and copy the data to a table with plain tuples, before upgrading to the
4.x release.</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/cberner/redb/commit/6ed1f981ba4deab0b2adbdd7bccb46ec409b2191"><code>6ed1f98</code></a>
Bump version to 4.1.0</li>
<li><a
href="https://github.com/cberner/redb/commit/0a87cb7c6bbef9d42a3d13317b5beaf4063e16e6"><code>0a87cb7</code></a>
Update changelog</li>
<li><a
href="https://github.com/cberner/redb/commit/03966a5050a3a6bef1045032d698f65b84a1eec9"><code>03966a5</code></a>
Require callers of get_page to provide a PageHint</li>
<li><a
href="https://github.com/cberner/redb/commit/a75927ff26d64f389e0050140654a39f239213a3"><code>a75927f</code></a>
Remove some TODO comments</li>
<li><a
href="https://github.com/cberner/redb/commit/a39779be8857b644476e64ddbe557082dd03644d"><code>a39779b</code></a>
Avoid allocating a page for a branch that will be immediately
merged</li>
<li><a
href="https://github.com/cberner/redb/commit/6374134252e7e128e5f98a4f04cf8bfdab9b3191"><code>6374134</code></a>
Document that Table{,Multimap}Definition::new panic on empty names</li>
<li><a
href="https://github.com/cberner/redb/commit/ba043e3816a81d93734e4533bc87465885496f61"><code>ba043e3</code></a>
Avoid copying keys in leaf overwrite paths</li>
<li><a
href="https://github.com/cberner/redb/commit/f42c468e008cfb7331d685ab2b675934bcec12ca"><code>f42c468</code></a>
Fix MultimapValue::next_back() not decrementing remaining counter</li>
<li><a
href="https://github.com/cberner/redb/commit/3756148e34e912206a382ef4224b3942d2d8aaa4"><code>3756148</code></a>
Clarify API contract for Key and Value traits</li>
<li><a
href="https://github.com/cberner/redb/commit/45523720a87ca0803264335e28538baabe6e04ae"><code>4552372</code></a>
Consolidate WriteTransaction savepoint lifecycle state</li>
<li>Additional commits viewable in <a
href="https://github.com/cberner/redb/compare/v3.1.3...v4.1.0">compare
view</a></li>
</ul>
</details>
<br />
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
## Description
We need to pin the exact RC versions that `ed25519-dalek` needs,
otherwise a newer `pkcs8` version is being used that has breaking
changes.
## Change checklist
- [x] Self-review.
## Description
`DnsResolver::reset` was `async` and awaited a write lock on the inner
`RwLock<dyn Resolver>`. The socket actor's network-change handler
awaited it, blocking the actor for the duration of the reset. This means
we would potentially block the main actor loop for network IO because
the write lock can only be acquired once all reads are done, and the
reads are blocked for the duration of a DNS lookup (limited to `2s`
usually).
This change stores the resolver in `ArcSwap<Box<dyn Resolver>>` instead
of `RwLock`. The `reset` call can now become synchronous - we build a
fresh resolver and atomically swap it in via `compare_and_swap`. A
`tokio::sync::Notify` wakes any in-flight lookup so it retries against
the new resolver.
Lookups go through an internal `op` helper that races the lookup future,
the reset notification, and a per-attempt timeout in a biased `select!`.
The `notified` future is enabled before the resolver is loaded, which
together with the swap-then-notify ordering in `reset` ensures that in
case of a reset all running futures are aborted and restarted against
the new resolver.
Under concurrent `reset` calls only the first CAS lands and only the
winner notifies. Losers drop their freshly-built resolver. This is fine,
and won't happen in practice because `reset` calls are serialized
through the socket actor loop.
## Breaking Changes
- changed: `iroh_relay::dns::Resolver::reset` signature changed from `fn
reset(&mut self)` to `fn reset(&self) -> Box<dyn Resolver>`.
Implementations now return a fresh resolver rather than mutating in
place.
- changed: `iroh_relay::dns::DnsResolver::reset` and
`DnsResolver::clear_cache` are no longer `async`.
- changed: `DnsError::Timeout` no longer carries a
`tokio::time::error::Elapsed` source. The
`From<tokio::time::error::Elapsed>` impl is removed.
## Notes & open questions
The `op` timeout is per-attempt: a reset-triggered retry starts a fresh
`sleep(timeout)`. This is intentional, since a fresh attempt against a
just-changed network should not inherit the previous attempt's remaining
time, but it does mean the wall-clock total can exceed `timeout`. I
think this is fine and preferable.
## Change checklist
- [x] Self-review.
- [x] Documentation updates.
- [ ] Tests if relevant.
- [x] All breaking changes documented.
---------
Co-authored-by: Friedel Ziegelmayer <me@dignifiedquire.com>
## Description
As suggested by @Frando: move more dns related stuff from iroh-relay to
iroh-dns.
Builds on top of https://github.com/n0-computer/iroh/pull/4026
## Breaking Changes
- `iroh_relay::dns`: moved to `iroh_dns::dns`
- `iroh_relay::dns::Resolver`: moved to `iroh_dns::dns::Resolver`
- `iroh_relay::dns::DnsResolver`: moved to `iroh_dns::dns::DnsResolver`
- `iroh_relay::dns::Builder`: moved to `iroh_dns::dns::Builder`
- `iroh_relay::dns::DnsError`: moved to `iroh_dns::dns::DnsError`
- `iroh_relay::dns::DnsProtocol`: moved to `iroh_dns::dns::DnsProtocol`
- `iroh_relay::dns::LookupError`: moved to `iroh_dns::dns::LookupError`
- `iroh_relay::dns::StaggeredError`: moved to
`iroh_dns::dns::StaggeredError`
- `iroh_relay::dns::TxtRecordData`: moved to
`iroh_dns::dns::TxtRecordData`
- `iroh_relay::dns::N0_DNS_ENDPOINT_ORIGIN_PROD`: moved to
`iroh_dns::dns::N0_DNS_ENDPOINT_ORIGIN_PROD`
- `iroh_relay::dns::N0_DNS_ENDPOINT_ORIGIN_STAGING`: moved to
`iroh_dns::dns::N0_DNS_ENDPOINT_ORIGIN_STAGING`
- `iroh_relay::dns::DNS_TIMEOUT`: moved to `iroh_dns::dns::DNS_TIMEOUT`
- `iroh_relay::endpoint_info`: moved to `iroh_dns::endpoint_info`
- `iroh_relay::endpoint_info::EndpointInfo`: moved to
`iroh_dns::endpoint_info::EndpointInfo`
- `iroh_relay::endpoint_info::EndpointData`: moved to
`iroh_dns::endpoint_info::EndpointData`
- `iroh_relay::endpoint_info::AddrFilter`: moved to
`iroh_dns::endpoint_info::AddrFilter`
- `iroh_relay::endpoint_info::UserData`: moved to
`iroh_dns::endpoint_info::UserData`
- `iroh_relay::endpoint_info::MaxLengthExceededError`: moved to
`iroh_dns::endpoint_info::MaxLengthExceededError`
- `iroh_relay::endpoint_info::EncodingError`: moved to
`iroh_dns::EncodingError`
- `iroh_relay::endpoint_info::ParseError`: moved to
`iroh_dns::ParseError`
- `iroh_relay::endpoint_info::IROH_TXT_NAME`: moved to
`iroh_dns::IROH_TXT_NAME`
- `iroh_dns::attrs`: made private
- `iroh_dns::attrs::IrohAttr`: made private
- `iroh_dns::attrs::TxtAttrs`: made private
- `iroh_dns::attrs::endpoint_id_from_txt_name`: made private
## Notes & open questions
<!-- Any notes, remarks or open questions you have to make about the PR.
-->
## 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)
## Description
Currently, the only API to check whether an endpoint successfully
connected to a home relay is `Endpoint::online`. However, this API
neither provides a notification in case the connection is lost, nor does
it provide any insight in case the connection fails.
This PR adds `Endpoint::home_relay_status`, exposing the connection
status of the home relay. It returns a watcher over `Vec<RelayStatus>`.
Currently the vec will never have more than one entry, but we're keeping
the API aligned to other relay APIs in preparation of a potential
multi-home-relays feature during 1.0.
The `RelayStatus` is a struct that internally contains a non-public enum
with the actual status. For now, it only provides methods
`is_connected() -> bool` and `last_error() -> Option<Arc<AnyError>>`,
which should provide reasonable introspectability while allowing us to
add more information in the future.
Fixes#3940
## 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.
- [ ] Tests if relevant.
- [ ] All breaking changes documented.
## Description
We currently abort address lookup on the first error from *any* service.
This is a bug, we should run each service to completion and only abort
once all completed or failed.
Fixes#4125
Turns out our current errors were not equipped to handle this well.
Refactored into
a) The error returned from an individual address lookup service. This is
just a struct now, because `NoServicesConfigured` didn't ever make sense
here, and `NoResults` is expressed by returning `None` without yielding
items.
b) The error returned from a lookup across all services now has
`NoServicesConfigured` and `NoResults` variants only, where the latter
can contain the errors emitted from individual services
## Breaking Changes
* changed: `iroh::address_lookup::Error` is now a struct. Existing
constructor methods are unchanged.
* changed: `iroh::endpoint::ConnectWithOptsError::NoAddress { source }`:
The `source` field now has type `AddressLookupFailed`, which is a new
error type that can hold errors for *all* failed lookup services
## Notes & open questions
It might be more appropriate to move the new format of the stream right
into `ConcurrentAddressLookup`. However, with the different error type,
it could no longer implement `AddressLookup` - which it arguably doesn't
have to. Maybe that would be the cleaner refactor?
See #4130
## 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.
---------
Co-authored-by: Friedel Ziegelmayer <me@dignifiedquire.com>
## Description
Move to_z32/from_z32 into iroh-base and remove EndpointIdExt trait
Ext traits are just not very nice for our users.
## Breaking Changes
removed: iroh_relay::endpoint_info::EndpointIdExt trait and its
re-export from iroh_dns. The to_z32 / from_z32 methods are now inherent
on iroh_base::PublicKey (and therefore EndpointId, which is a type
alias). Callers should drop the use
iroh_relay::endpoint_info::EndpointIdExt; import — the methods resolve
without it.
## Notes & open questions
<!-- Any notes, remarks or open questions you have to make about the PR.
-->
## 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)
## Description
On main we use the pkarr dependency, which comes with an entire tree of
dependencies and is not under our control. But we do not use the reqwest
based client at all in the dns discovery, instead we have our own. So
what we use is just the encoding and decoding of DNS records.
It seems less than optimal to have a big dependency for just that. So
this PR removes the pkarr dependency, inlines the DNS record encoding
with the help of simple-dns, and implements the dht part manually,
directly using the mainline crate.
Note for reviewers: just do cargo doc -p iroh_dns --open to see the API
of the new crate. Almost everything is just copied, with the exception
of using mainline directly to publish to the DHT.
(In a subsequent PR I might also try to get rid of the mainline dep)
## Breaking Changes
- new crate: iroh-dns — published as a separate crate containing
SignedPacket, Timestamp, EndpointIdExt, TxtAttrs, IrohAttr,
IROH_TXT_NAME, ParseError, EncodingError. iroh and iroh-relay no longer
depend on the third-party pkarr crate directly.
- removed: iroh_relay::endpoint_info::DecodingError — no longer exists.
Callers that matched on it should now handle iroh_base::KeyParsingError
instead.
- changed: iroh_relay::endpoint_info::EndpointIdExt::from_z32 — return
type changed from Result<EndpointId, DecodingError> to
Result<EndpointId, iroh_base::KeyParsingError>.
- changed: iroh_relay::endpoint_info::EncodingError — the
InvalidTxtEntry { source: pkarr::dns::SimpleDnsError } variant is
removed. Only FailedBuildingPacket remains, and its source type is now
iroh_dns::pkarr::SignedPacketBuildError (no longer the third-party
pkarr::errors::SignedPacketBuildError).
- changed: iroh_relay::endpoint_info::ParseError::DecodingError — the
source field type changed from DecodingError to
iroh_base::KeyParsingError.
- changed: iroh_relay::endpoint_info::EndpointInfo::from_txt_lookup —
signature relaxed from impl Iterator<Item = crate::dns::TxtRecordData>
to impl Iterator<Item = impl Display>. Also no longer
#[cfg(not(wasm_browser))]-gated.
- changed:
iroh_relay::endpoint_info::EndpointInfo::{from_pkarr_signed_packet,
to_pkarr_signed_packet} — the SignedPacket parameter/return type is now
iroh_dns::pkarr::SignedPacket instead of the third-party
pkarr::SignedPacket.
- changed: iroh::address_lookup::pkarr::PkarrError::PublicKey — source
field type changed from pkarr::errors::PublicKeyError to
iroh_base::KeyParsingError.
- changed: iroh::address_lookup::pkarr::PkarrError::Verify — source
field type is now iroh_dns::pkarr::SignedPacketVerifyError (not
pkarr::errors::SignedPacketVerifyError).
- removed:
iroh::address_lookup::pkarr::dht::Builder::client(pkarr::Client) —
replaced by dht_builder(mainline::DhtBuilder). The DHT is now driven by
mainline directly rather than via pkarr::Client.
- removed: iroh::address_lookup::pkarr::dht::Builder::pkarr_relay(Url) —
the DHT address lookup no longer publishes to pkarr relays; it only uses
the Mainline DHT. Use PkarrPublisher for relay publishing.
- removed:
iroh::address_lookup::pkarr::dht::Builder::n0_dns_pkarr_relay() — same
reason as above.
- removed: iroh::address_lookup::pkarr::dht::Builder::dht(bool) — DHT is
always enabled for DhtAddressLookup; the toggle is gone.
- changed: cargo feature address-lookup-pkarr-dht — now pulls in
mainline instead of pkarr/dht + pkarr/relays.
- removed (internal crate deps): z32 and pkarr are no longer direct
dependencies of iroh, iroh-relay, or iroh-dns-server. Downstream users
who pulled those through iroh's dependency tree must depend on them
explicitly (or use the re-exports from iroh-dns).
## Notes & open questions
Note: I am using simple-dns for en/decoding. We could even inline this,
but it is very lightweight compared to hickory or even hickory-proto. I
was originally planning to use hickory-proto, but it has a lot of deps
even with default features disabled. Simple-dns is not a new dependency
- we used to have it via pkarr.
~~Note: this adds a dep to iroh-relay to iroh-dns-server, just for the
pkarr SignedPacket impl. We could alternatively let iroh-relay-server
depend on pkarr (it's not so critical regarding deps), or have a tiny
iroh-pkarr crate.~~
Note: we are no longer using pkarr client (which has relay and dht built
in) for the dht lookup. So there is a functionality change: the dht
lookup can now **only** look up via the DHT. Before you could configure
it with relays.
But I think that is fine, we already have a way to look up via relays.
Note: I also added a few comments and tests regarding storage on
iroh-dns-server. These are unrelated but should do no harm.
## Change checklist
<!-- Remove any that are not relevant. -->
- [x] 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)
## Description
Updates hickory to 0.26.0-beta.4.
Also fixes a bunch of version bounds that were outdated, and some that
were not exact version bounds, even though we were depending on a
prerelease version.
# Notes
Waiting for https://github.com/rkuhn/swarm-discovery/pull/22 to be
merged & released.
---------
Co-authored-by: dignifiedquire <me@dignifiedquire.com>
## Description
This skips advertising `deprecated` IPv6 addresses in nat traversal, as
they are not supposed to be used for new connections.
Fixes https://github.com/n0-computer/iroh/discussions/4071
## Breaking Changes
None
## Notes & open questions
- There are more flags on IPv6 addresses, should we take them into
account in some form as well?
## Description
This commit adds a `iroh-relay-v2` protocol. The only changes to the
`iroh-relay-v1` protocol are:
* removed `Health` frame (id 11) with string payload
* added `Status` frame (id 13) with binary-encoded enum payload that can
be extended with further variants or payloads
* From now on, unknown frames will be ignored in iroh (instead of
erroring out)
The actual change is thus quite minor, but serves as a real-world test
for our protocol negotiation.
The PR also fixes a bug in how the relay server parsed the supported
protocols; it is harmless because all existing deployments support a
single version anyway, but good to fix now.
Everything is fully backwards-compatible on the wire (old clients can
talk to new relays, and new clients can talk to old relays).
## Breaking Changes
* `iroh_relay::http::RELAY_PROTOCOL_VERSION` has been removed. The relay
protocol now supports version negotiation between client and server. Use
`iroh_relay::http::ProtocolVersion` instead. For the previous constant
value, use `ProtocolVersion::V1.to_str()`.
* `iroh_relay::server::client::Config` has a new field
`protocol_version: ProtocolVersion`.
* `iroh_relay::protos::relay::RelayToClientMsg` has a new
`Status(Status)` variant and the existing `Health` variant is
deprecated. Clients should handle `RelayToClientMsg::Status` for
connection health information. The `Health` variant is still sent by V1
relay servers but should not be relied upon going forward.
## 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.