Commit Graph
2590 Commits
Author SHA1 Message Date
Ruediger Klaehn b8a45dbd5f Merge branch 'main' into refactor-hickory 2026-06-22 12:38:08 +03:00
Ruediger Klaehn 83e81d6ca4 fmt 2026-06-22 12:12:17 +03:00
Ruediger Klaehn fe40d1090c Don't run some tests if no crypto provider is set. 2026-06-22 12:11:39 +03:00
Philipp KrügerandFranz Heinzmann ff2f101bfc test(iroh): Test holepunching with 16 interfaces (#4336)
## 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>
2026-06-22 10:13:20 +02:00
Frando e715c6575d Merge remote-tracking branch 'origin/main' into refactor-hickory 2026-06-18 13:08:27 +02:00
Floris Bruynooghe 255a939b1a fix(docs): Fix keep-alive docs (#4352)
## 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.
2026-06-17 17:39:51 +02:00
Lorenz Leutgeb 777169a15e docs(iroh-dns-server): Fix link to production config file (#4353)
Trivial fix to refer to the correct example configuration file.
2026-06-17 14:36:37 +02:00
Frando 14ea4774d0 refactor(iroh-dns): let the conn-pool reaper self-terminate via Weak
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.
2026-06-17 00:07:01 +02:00
Frando ff770341e9 feat(iroh-dns): pool and reuse TCP/DoT connections across queries
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.
2026-06-16 23:51:52 +02:00
Frando fff38890a5 fix(iroh-dns): preserve DNS cache across resolver reset
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
2026-06-16 22:30:00 +02:00
Frando 7403ab1e41 fixup 2026-06-16 16:46:16 +02:00
Frando 7c15f619af cleanup 2026-06-16 16:04:52 +02:00
Frando a38121b6da cleanup 2026-06-16 16:01:21 +02:00
Frando aea35fb72a fixup 2026-06-16 15:51:28 +02:00
Frando 6ade0a7ffa improve errors 2026-06-16 15:47:05 +02:00
Frando 1e2015c775 Merge remote-tracking branch 'origin/main' into refactor-hickory 2026-06-16 15:32:27 +02:00
Frando 96cd8ebf4c restructure modules 2026-06-16 15:30:26 +02:00
dignifiedquire 6520cd6c9b chore: Release v1.0.0 2026-06-15 14:50:05 +02:00
Friedel ZiegelmayerandFrando b193191c92 feat!: update to 1.0 dependencies (#4343)
also cleans up some dependencies and updates staging relay urls

Co-authored-by: Frando <frando@unbiskant.org>
2026-06-15 14:38:11 +02:00
Franz Heinzmann 0e7e976e03 chore: use install-action instead of binstall directly (#4342)
## 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.
2026-06-15 12:40:55 +02:00
Floris Bruynooghe a134dd8e47 chore: Update the issue templates a little (#4340)
## 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.
2026-06-15 11:39:03 +02:00
Franz Heinzmann 5791244385 fix(iroh): add missing export for unstable-custom-transport and improve docs (#4335)
## 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.
2026-06-15 10:35:04 +02:00
Franz Heinzmann 7e95ae751f refactor(iroh): gate net_report API behind unstable-net-report feature (#4338)
## 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.
2026-06-15 10:18:16 +02:00
Franz Heinzmann 9afd2bc198 feat(iroh-relay): Allow multiple hostnames with Let's encrypt TLS (#4337)
## 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.
2026-06-15 09:15:43 +02:00
Friedel Ziegelmayer 8e25ecb30f feat: update relay urls to 1.0 stable (#4341) 2026-06-14 19:02:11 +02:00
Frando f6668921a2 fix(iroh-dns): race DoH fallback within the first wave
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.
2026-06-13 14:04:14 +02:00
Frando 0124d49bf6 refactor(iroh-dns): tighten visibility of internal DNS items
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.
2026-06-13 14:04:06 +02:00
Frando 547a3e7662 feat(iroh-dns): support DoT/DoH nameservers addressed by hostname
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.
2026-06-13 13:44:00 +02:00
Frando 6287753cf0 docs(iroh-dns): note DoH fallback IPs are verified cert SANs
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.
2026-06-13 13:12:54 +02:00
Frando 1a85f90b02 fix(iroh-dns): address DNS resolver review findings
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.
2026-06-13 13:10:38 +02:00
Frando 90b0aa3330 refactor(iroh-dns): return DnsConfig from build_config
Return a DnsConfig instead of a 3-tuple and fold the public-resolver fallback into a single trailing check applied in one place.
2026-06-12 23:55:08 +02:00
Frando f373fecfbd feat(iroh-dns): race nameservers with health-tracked happy-eyeballs
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.
2026-06-12 23:52:29 +02:00
dependabot[bot] b0fcd4012c chore(deps): bump mainline from 6.2.0 to 7.0.0 (#4331)
Bumps [mainline](https://github.com/pubky/mainline) from 6.2.0 to 7.0.0.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/pubky/mainline/releases">mainline's
releases</a>.</em></p>
<blockquote>
<h2>v7.0.0</h2>
<h2>What's Changed</h2>
<ul>
<li>refactor(rpc): simplify put query completion by <a
href="https://github.com/andrei-21"><code>@​andrei-21</code></a> in <a
href="https://redirect.github.com/pubky/mainline/pull/103">pubky/mainline#103</a></li>
<li>feat(async)!: return PUT outcome from raw put by <a
href="https://github.com/andrei-21"><code>@​andrei-21</code></a> in <a
href="https://redirect.github.com/pubky/mainline/pull/105">pubky/mainline#105</a></li>
<li>fix(rpc)!: stop GET queries from echoing pending PUTs by <a
href="https://github.com/andrei-21"><code>@​andrei-21</code></a> in <a
href="https://redirect.github.com/pubky/mainline/pull/106">pubky/mainline#106</a></li>
<li>feat(dht): add detailed mutable GET outcome by <a
href="https://github.com/andrei-21"><code>@​andrei-21</code></a> in <a
href="https://redirect.github.com/pubky/mainline/pull/107">pubky/mainline#107</a></li>
<li>feat(async)!: return <code>PutOutcome</code> from mutable puts by <a
href="https://github.com/andrei-21"><code>@​andrei-21</code></a> in <a
href="https://redirect.github.com/pubky/mainline/pull/109">pubky/mainline#109</a></li>
<li>feat(dht): deprecate blocking operations by <a
href="https://github.com/andrei-21"><code>@​andrei-21</code></a> in <a
href="https://redirect.github.com/pubky/mainline/pull/110">pubky/mainline#110</a></li>
<li>chore: v7.0.0 by <a
href="https://github.com/andrei-21"><code>@​andrei-21</code></a> in <a
href="https://redirect.github.com/pubky/mainline/pull/111">pubky/mainline#111</a></li>
</ul>
<p><strong>Full Changelog</strong>: <a
href="https://github.com/pubky/mainline/compare/v6.2.0...v7.0.0">https://github.com/pubky/mainline/compare/v6.2.0...v7.0.0</a></p>
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/pubky/mainline/blob/main/CHANGELOG.md">mainline's
changelog</a>.</em></p>
<blockquote>
<h2><a
href="https://github.com/pubky/mainline/compare/v6.2.0...v7.0.0">7.0.0</a>
- 2026-06-08</h2>
<h3>Added</h3>
<ul>
<li>Add <code>PutOutcome</code> to report the target and number of DHT
nodes that acknowledged a successful PUT.</li>
<li>Add <code>AsyncDht::get_mutable_detailed()</code> with
<code>GetMutableOutcome</code> diagnostics for queried nodes, valid
values, empty responses, invalid responses, KRPC errors, and
timeouts.</li>
</ul>
<h3>Changed</h3>
<ul>
<li><strong>BREAKING</strong>: <code>AsyncDht::put()</code> now returns
<code>PutOutcome</code> instead of a raw <code>Id</code>.</li>
<li><strong>BREAKING</strong>: <code>AsyncDht::put_mutable()</code> now
returns <code>PutOutcome</code> instead of a raw <code>Id</code>.</li>
<li>Mutable GET queries no longer echo locally pending mutable PUT
values; GET results now only come from DHT node responses.</li>
</ul>
<h3>Deprecated</h3>
<ul>
<li>Deprecate blocking <code>Dht</code> operation methods and
<code>GetIterator</code>; use the async API via
<code>Dht::as_async()</code> instead.</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/pubky/mainline/commit/e77f8060a947736a9f97d4f3001ad1b871f7bb29"><code>e77f806</code></a>
chore: v7.0.0 (<a
href="https://redirect.github.com/pubky/mainline/issues/111">#111</a>)</li>
<li><a
href="https://github.com/pubky/mainline/commit/8e777bc18b3d0958f646fe29895f33ff65490cb4"><code>8e777bc</code></a>
feat(dht): deprecate blocking operations (<a
href="https://redirect.github.com/pubky/mainline/issues/110">#110</a>)</li>
<li><a
href="https://github.com/pubky/mainline/commit/83252185cd1997c9ddee2bc6342d7243d40ded21"><code>8325218</code></a>
feat(async)!: return <code>PutOutcome</code> from mutable puts (<a
href="https://redirect.github.com/pubky/mainline/issues/109">#109</a>)</li>
<li><a
href="https://github.com/pubky/mainline/commit/1e38626a7d020e68f5df5ecead8245001d5a60ec"><code>1e38626</code></a>
feat(dht): add detailed mutable GET outcome (<a
href="https://redirect.github.com/pubky/mainline/issues/107">#107</a>)</li>
<li><a
href="https://github.com/pubky/mainline/commit/285c1fcf2f7bd5bba0b8836fb32890321426277e"><code>285c1fc</code></a>
fix(rpc)!: stop GET queries from echoing pending PUTs (<a
href="https://redirect.github.com/pubky/mainline/issues/106">#106</a>)</li>
<li><a
href="https://github.com/pubky/mainline/commit/96606a9a17d516a096c3494c3b1ef5a4e4cd8b88"><code>96606a9</code></a>
feat(async)!: return PUT outcome from raw put (<a
href="https://redirect.github.com/pubky/mainline/issues/105">#105</a>)</li>
<li><a
href="https://github.com/pubky/mainline/commit/e81c8a1048f1bed4951f9f765a522fc6021bc949"><code>e81c8a1</code></a>
refactor(rpc): simplify put query completion (<a
href="https://redirect.github.com/pubky/mainline/issues/103">#103</a>)</li>
<li>See full diff in <a
href="https://github.com/pubky/mainline/compare/v6.2.0...v7.0.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>
2026-06-12 12:18:10 +02:00
Frando 79f0e34d0d refactor(iroh-dns): read system DNS config in platform modules
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.
2026-06-12 00:04:44 +02:00
Frando 6f36a363d2 simplify 2026-06-11 23:29:48 +02:00
Franz Heinzmann 710d03a634 docs(iroh): improve readme (#4329)
## 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.
2026-06-11 16:13:45 +02:00
Philipp Krüger 2f41f406e8 chore(iroh): Update to latest noq main (#4333)
## 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.
2026-06-11 15:59:31 +02:00
Frando 552578ef97 fixup again 2026-06-11 14:34:06 +02:00
Franz Heinzmann 01e74bc1ec docs: general cleanup and fixes (#4328)
## 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.
2026-06-11 14:31:59 +02:00
Frando c5c8bc9d10 clippy 2026-06-11 14:31:00 +02:00
Frando 43a9d68257 fixup 2026-06-11 14:30:07 +02:00
Frando 261180b74a fixup feature flags 2026-06-11 14:28:24 +02:00
Frando b6f8f10cad Merge remote-tracking branch 'origin/main' into refactor-hickory 2026-06-11 14:25:24 +02:00
Frando cdcf190429 fixup erorr handling 2026-06-11 14:24:59 +02:00
400264e319 feat(iroh-relay): Add Bearer token access control without an external service (#4326)
## Description

This PR adds a new `AccessConfig::SharedToken(Vec<String>)` variant to
the `iroh-relay` configuration,
allowing self-hosted relays to require a shared bearer token from
connecting
clients, without using an external auth service.

- Clients authenticate via `Authorization: Bearer <token>` header or
`?token=` query param,
using the existing `RelayConfig::with_auth_token()` /
`RelayMap::with_auth_token()` API;
- Token can be set via config file (`access.shared_token = ["token-a",
"token-b"]`) or the
`IROH_RELAY_ACCESS_TOKEN` environment variable (**the env var takes
precedence**);
- Empty token is rejected at startup;
- A token set to the empty string, will make the server fail to start.

[See related
discussion](https://github.com/n0-computer/iroh/discussions/4316)

## Breaking Changes

None.

## Notes & open questions

- As we stated in the discussion, using an external service should
always be considered the best choice for production. The static token
variant is still useful for simpler deployments.
- Supported the token list in config, as suggested by fokx

## Change checklist
- [x] Self-review
- [x] Documentation updates
- [x] Tests

Co-authored-by: fokx <36614441+fokx@users.noreply.github.com>

---------

Co-authored-by: Franz Heinzmann <frando@unbiskant.org>
2026-06-11 14:13:56 +02:00
Frando 15a4d82162 do not break backwards compat 2026-06-11 14:13:32 +02:00
Frando e0e5612683 add back missing files 2026-06-11 14:10:11 +02:00
Frando fbc86a8992 Merge remote-tracking branch 'origin/main' into refactor-hickory 2026-06-11 14:09:14 +02:00
Frando f79aa0529e Merge remote-tracking branch 'origin/main' into refactor-hickory-new 2026-06-11 14:08:02 +02:00
Floris BruynoogheandPhilipp Krüger a24e6a7fbc test: Mark a patchbay test as flaky (#4322)
## Description

This test is flaky because QAD fails to establish a connection within
3s due to the packet loss. At that point there's not relay server
until at least the next net-report which only runs after about 30s.

The right fix for this is for net-report to be more streaming instead
of running on a schedule. So iroh can respond to events from changed
network conditions properly.

## Breaking Changes

n/a

## Notes & open questions

See #4321 to track this.

## Change checklist

- [x] Self-review.

---------

Co-authored-by: Philipp Krüger <philipp.krueger1@gmail.com>
2026-06-11 13:42:11 +02:00