feat: Instead of duplicating the entire connection API, have a type parameter#3619
Conversation
on Connection that describes the connection state, and implement the fns alpn and remote_id differently depending on what the state is. The upside is that it should be easier to write code that works with both a 0rtt connection and a fully initialized connection without having to define a trait to abstract over both variants. The downside is that it is a bit fancy with the types. But then for the non 0rtt case you would never see the fanciness, so maybe it is OK?
|
Documentation for this PR has been generated and is available at: https://n0-computer.github.io/iroh/pr/3619/docs/iroh/ Last updated: 2025-11-17T19:11:49Z |
…... structs Note: this requires using .connection() when you want to do something with the connection. You could avoid this with Deref, but it seems this way of using Deref is frowned upon in rust.
|
There are 3 ways to do the two Incoming/Outgoing... structs:
Maybe the last one is the way to go? |
they are now just type aliases for Connection<Incoming...> and Connection<Outgoing...> With this the usage is idential to before. No more .connection() needed for e.g. .open_bi().
|
Playing with this PR a bit, I think |
|
Also, it would be nice if we'd be able to downcast a E.g. that'd be useful to implement getting the remote id on a function that's generic over |
We could have a fourth state Maybe instead add methods to the trait that work in any case and return Option/Result? |
- export them and the trait - make the data types doc(hidden)
9cb5e4e to
a6e950c
Compare
@matheus23 so WDYT, should I just add endpoint_opt and alpn_opt that works for any state and be done with it, or do something more fancy to keep the API surface smaller? |
|
I was thinking of something like this: diff --git a/iroh/src/endpoint/connection.rs b/iroh/src/endpoint/connection.rs
index 6a4593adc..7f527708a 100644
--- a/iroh/src/endpoint/connection.rs
+++ b/iroh/src/endpoint/connection.rs
@@ -646,9 +646,20 @@ mod sealed {
}
/// Trait to track the state of a [`Connection`] at compile time.
-pub trait ConnectionState: sealed::Sealed {
+pub trait ConnectionState: sealed::Sealed + Sized {
/// State-specific data stored in the [`Connection`].
type Data: std::fmt::Debug + Clone;
+
+ /// Turns an arbitrary connection into an enum of possible typed connection states
+ fn into_state_enum(conn: Connection<Self>) -> StateEnum;
+}
+
+/// TODO docs
+#[derive(Debug)]
+pub enum StateEnum {
+ HandshakeCompleted(Connection<HandshakeCompleted>),
+ IncomingZeroRtt(Connection<IncomingZeroRtt>),
+ OutgoingZeroRtt(Connection<OutgoingZeroRtt>),
}
/// Marker type for a connection that has completed the handshake.
@@ -666,14 +677,26 @@ pub struct OutgoingZeroRtt;
impl sealed::Sealed for HandshakeCompleted {}
impl ConnectionState for HandshakeCompleted {
type Data = HandshakeCompletedData;
+
+ fn into_state_enum(conn: Connection<Self>) -> StateEnum {
+ StateEnum::HandshakeCompleted(conn)
+ }
}
impl sealed::Sealed for IncomingZeroRtt {}
impl ConnectionState for IncomingZeroRtt {
type Data = IncomingZeroRttData;
+
+ fn into_state_enum(conn: Connection<Self>) -> StateEnum {
+ StateEnum::IncomingZeroRtt(conn)
+ }
}
impl sealed::Sealed for OutgoingZeroRtt {}
impl ConnectionState for OutgoingZeroRtt {
type Data = OutgoingZeroRttData;
+
+ fn into_state_enum(conn: Connection<Self>) -> StateEnum {
+ StateEnum::OutgoingZeroRtt(conn)
+ }
}
#[allow(missing_docs)]
@@ -686,6 +709,11 @@ impl<T: ConnectionState> Connection<T> {
&self.inner
}
+ /// TODO docs
+ pub fn into_state_enum(self) -> StateEnum {
+ T::into_state_enum(self)
+ }
+
/// Initiates a new outgoing unidirectional stream.
///
/// Streams are cheap and instantaneous to open unless blocked by flow control. As aWhere But that'll cost us another exposed enum that we need to name and another exposed function on the Perhaps adding a |
I think the state enum will only be used very rarely, so my current thinking is that we don't do anything for now. The state enum is something people can define for themselves without much friction, much less annoying than having to define a trait. And even the try_remote_id and try_alpn are not strictly necessary. People can always do the match themselves before they go from concrete Connection to an abstract handler. How about we merge this now, frando and me hack it into the places where it is needed, which are already quite esoteric, and then we decide if we need more simplification. If we decide to do something about this, one option would also be to have a 4th state "generic". That would be the same number of additional public types, but would make usage nicer than an enum. E.g. for open_bi with the enum you would have to do a match, open_bi with the 4th state you could just use as normal. But again, I think there is not that much need to solve this right now. 1.0 means we can't modify, but we can still add syntax candy like this. |
|
Tried out these changes here: n0-computer/irpc#84 There's one place where I'd like to have the remote endpoint ID from a generic |
|
Tried this out: not sure it would be worth it: https://github.com/n0-computer/iroh/tree/connection-state-try-remote |
|
Let's merge it as-is, and add more sugar later if we feel the need? |
## Description Merges main and adapts for the changes from #3619 ## 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. --> - [ ] 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) --------- Co-authored-by: Rüdiger Klaehn <rklaehn@protonmail.com> Co-authored-by: Friedel Ziegelmayer <me@dignifiedquire.com>
This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [iroh](https://github.com/n0-computer/iroh) | workspace.dependencies | minor | `0.95` → `0.97` | --- ### Release Notes <details> <summary>n0-computer/iroh (iroh)</summary> ### [`v0.97.0`](https://github.com/n0-computer/iroh/blob/HEAD/CHANGELOG.md#0970---2026-03-16) [Compare Source](n0-computer/iroh@v0.96.1...v0.97.0) ##### ⛰️ Features - *(iroh)* \[**breaking**] Dropping the endpoint ungracefully should log and error, but still clean up resources immediately ([#​3879](n0-computer/iroh#3879)) - ([9cf417a](n0-computer/iroh@9cf417a)) - *(iroh)* \[**breaking**] Retain stats for closed and abandoned paths in the path watcher ([#​3899](n0-computer/iroh#3899)) - ([b11e707](n0-computer/iroh@b11e707)) - *(iroh)* More precise information about incoming connections ([#​3949](n0-computer/iroh#3949)) - ([abc349c](n0-computer/iroh@abc349c)) - *(iroh)* \[**breaking**] Add address filtering and reordering for Address Lookup Services ([#​3960](n0-computer/iroh#3960)) - ([d33a32f](n0-computer/iroh@d33a32f)) - *(iroh)* Proper span for endpoints ([#​3988](n0-computer/iroh#3988)) - ([e23f2f3](n0-computer/iroh@e23f2f3)) - *(iroh)* Allow propagation of addr filters through the endpoint ([#​4010](n0-computer/iroh#4010)) - ([5df183d](n0-computer/iroh@5df183d)) - *(iroh)* Add tracing events for connections ([#​4021](n0-computer/iroh#4021)) - ([f226881](n0-computer/iroh@f226881)) - *(iroh)* \[**breaking**] Cleanup preset API ([#​4014](n0-computer/iroh#4014)) - ([759f14e](n0-computer/iroh@759f14e)) - *(iroh-relay)* Embeddable relay server ([#​3832](n0-computer/iroh#3832)) - ([fe7f04f](n0-computer/iroh@fe7f04f)) - *(netsim)* Filter tests ([#​3946](n0-computer/iroh#3946)) - ([1729243](n0-computer/iroh@1729243)) - Allow to customize TLS trust roots ([#​3973](n0-computer/iroh#3973)) - ([ba4ee62](n0-computer/iroh@ba4ee62)) - Implement custom transports ([#​3845](n0-computer/iroh#3845)) - ([d434c85](n0-computer/iroh@d434c85)) - \[**breaking**] Switch noq ([#​4005](n0-computer/iroh#4005)) - ([b32c927](n0-computer/iroh@b32c927)) ##### 🐛 Bug Fixes - *(docs)* Just a typo in the documentation for mdns discovery ([#​3929](n0-computer/iroh#3929)) - ([cf6acb5](n0-computer/iroh@cf6acb5)) - *(example)* Always close the endpoint ([#​4007](n0-computer/iroh#4007)) - ([afc1faa](n0-computer/iroh@afc1faa)) - *(iroh)* Disable QAD if no IP transports are configured ([#​3926](n0-computer/iroh#3926)) - ([aa14381](n0-computer/iroh@aa14381)) - *(iroh)* \[**breaking**] Reexport full dns module from iroh-relay ([#​3916](n0-computer/iroh#3916)) - ([523c93c](n0-computer/iroh@523c93c)) - *(iroh)* Don't depend on the unused `relays` ff of pkarr ([#​4004](n0-computer/iroh#4004)) - ([2494255](n0-computer/iroh@2494255)) - *(iroh)* \[**breaking**] Don't publish IP addresses from `PkarrPublisher` by default ([#​4012](n0-computer/iroh#4012)) - ([b3da940](n0-computer/iroh@b3da940)) - *(iroh-relay)* Turn off nagle for relayed streams in iroh-relay servers ([#​3995](n0-computer/iroh#3995)) - ([82e0695](n0-computer/iroh@82e0695)) - *(tests)* Give test longer to not be flaky ([#​3939](n0-computer/iroh#3939)) - ([1324c66](n0-computer/iroh@1324c66)) - Configure git identity in cleanup workflow - ([dbe5112](n0-computer/iroh@dbe5112)) - Increase DNS timeout and address lookup stagger intervals ([#​4008](n0-computer/iroh#4008)) - ([993b018](n0-computer/iroh@993b018)) ##### 🚜 Refactor - *(iroh)* Avoid rustls feature flag use in `resolver.rs` ([#​3985](n0-computer/iroh#3985)) - ([dd381a1](n0-computer/iroh@dd381a1)) - *(iroh)* Use combinator approach for address filtering ([#​3987](n0-computer/iroh#3987)) - ([a289f63](n0-computer/iroh@a289f63)) - *(iroh, iroh-relay)* \[**breaking**] Relay should not kill old connections when same endpoint id connects ([#​3921](n0-computer/iroh#3921)) - ([1b4ee2a](n0-computer/iroh@1b4ee2a)) - *(transfer example)* Remove `SelectedPath::Mixed` as an impossible state ([#​3895](n0-computer/iroh#3895)) - ([9cc8602](n0-computer/iroh@9cc8602)) - Simplify path selection - ([df6c396](n0-computer/iroh@df6c396)) - Update quinn and simplify path handling in `RemoteStateActor` ([#​3967](n0-computer/iroh#3967)) - ([1ffb560](n0-computer/iroh@1ffb560)) - Add doc comments, move code around, rename ([#​3977](n0-computer/iroh#3977)) - ([1c5bd5b](n0-computer/iroh@1c5bd5b)) - Remove special fast path for hickory resolver ([#​4022](n0-computer/iroh#4022)) - ([7fc9fb9](n0-computer/iroh@7fc9fb9)) ##### 📚 Documentation - Fix typo in documentation comment for generate function ([#​4001](n0-computer/iroh#4001)) - ([766097b](n0-computer/iroh@766097b)) ##### ⚙️ Miscellaneous Tasks - *(ci)* Add custom RUST\_LOG support for netsim ([#​3942](n0-computer/iroh#3942)) - ([d240360](n0-computer/iroh@d240360)) - *(ci)* Colocate sims into iroh repo ([#​3957](n0-computer/iroh#3957)) - ([403238a](n0-computer/iroh@403238a)) - *(ci)* Add text summary for discord notification ([#​3962](n0-computer/iroh#3962)) - ([6650c78](n0-computer/iroh@6650c78)) - *(iroh)* Add `--logs` and `--mode ping` features to transfer example ([#​3893](n0-computer/iroh#3893)) - ([08b0b8a](n0-computer/iroh@08b0b8a)) - *(iroh)* Update noq commit, stop exposing `AeadKey` ([#​4003](n0-computer/iroh#4003)) - ([bf07082](n0-computer/iroh@bf07082)) - *(readme)* Link to noq instead of Quinn ([#​3989](n0-computer/iroh#3989)) - ([4033b3c](n0-computer/iroh@4033b3c)) - Update to quinn main ([#​3938](n0-computer/iroh#3938)) - ([3a45cd0](n0-computer/iroh@3a45cd0)) - Remove process and signal tokio features ([#​3993](n0-computer/iroh#3993)) - ([086c6e8](n0-computer/iroh@086c6e8)) - Update deps ([#​4006](n0-computer/iroh#4006)) - ([df0777a](n0-computer/iroh@df0777a)) - Remove netdev from the direct dependencies ([#​4019](n0-computer/iroh#4019)) - ([76609fd](n0-computer/iroh@76609fd)) - Update changelog generation command - ([29c8c85](n0-computer/iroh@29c8c85)) ##### Deps - Bump wasm-bindgen-test ([#​3966](n0-computer/iroh#3966)) - ([f628359](n0-computer/iroh@f628359)) - Upgrade away from yanked crate ([#​3982](n0-computer/iroh#3982)) - ([1e4a738](n0-computer/iroh@1e4a738)) - Prefer portable\_atomic over native AtomicU64 ([#​3994](n0-computer/iroh#3994)) - ([ae4877e](n0-computer/iroh@ae4877e)) - Feature gate portmapper, and allow disabling portmapper by default. ([#​4011](n0-computer/iroh#4011)) - ([647f28e](n0-computer/iroh@647f28e)) ##### Examples - *(iroh)* Improve transfer example with qlog flag and timestamp for JSON output ([#​3964](n0-computer/iroh#3964)) - ([5d9ac04](n0-computer/iroh@5d9ac04)) ### [`v0.96.1`](https://github.com/n0-computer/iroh/blob/HEAD/CHANGELOG.md#0961---2026-02-06) [Compare Source](n0-computer/iroh@v0.96.0...v0.96.1) ##### 🐛 Bug Fixes - *(iroh)* Use latest portmapper to avoid duplicate dependencies ([#​3903](n0-computer/iroh#3903)) - ([5126857](n0-computer/iroh@5126857)) ##### ⚙️ Miscellaneous Tasks - Pin digest to version compatible with curve25519-dalek 5.0.0-pre.1 ([#​3908](n0-computer/iroh#3908)) - ([68243ed](n0-computer/iroh@68243ed)) - Update bytes and time address advisories - ([f2eb1e3](n0-computer/iroh@f2eb1e3)) - Specify minimum iroh-quinn and iroh-quinn-proto patch versions ([#​3918](n0-computer/iroh#3918)) - ([db429c7](n0-computer/iroh@db429c7)) - Release - ([82650d1](n0-computer/iroh@82650d1)) ### [`v0.96.0`](https://github.com/n0-computer/iroh/blob/HEAD/CHANGELOG.md#0960---2026-01-28) [Compare Source](n0-computer/iroh@v0.95.1...v0.96.0) ##### ⛰️ Features - *(example)* Improve path stat printing in transfer example ([#​3860](n0-computer/iroh#3860)) - ([c168e73](n0-computer/iroh@c168e73)) - *(iroh)* Introduce EndpointHooks ([#​3688](n0-computer/iroh#3688)) - ([1efd2b5](n0-computer/iroh@1efd2b5)) - *(iroh)* Add fast-apple-datapath feature and enable it by default ([#​3724](n0-computer/iroh#3724)) - ([a5f4a08](n0-computer/iroh@a5f4a08)) - *(iroh)* \[**breaking**] Encapsulate the `quinn::TransportConfig` to enforce certain minimums when used with multipath ([#​3721](n0-computer/iroh#3721)) - ([cc932ef](n0-computer/iroh@cc932ef)) - *(iroh)* Improve shutdown handling - ([bb3e94a](n0-computer/iroh@bb3e94a)) - *(iroh)* \[**breaking**] Newtype `ServerConfig` and `RetryError`, organize the quinn re-exports ([#​3757](n0-computer/iroh#3757)) - ([aa6b918](n0-computer/iroh@aa6b918)) - *(iroh)* Implement latency based connection updates ([#​3797](n0-computer/iroh#3797)) - ([5cb5716](n0-computer/iroh@5cb5716)) - *(iroh)* Ping paths and trigger holepunching on networkchange ([#​3796](n0-computer/iroh#3796)) - ([ff24cfc](n0-computer/iroh@ff24cfc)) - *(iroh)* \[**breaking**] Allow multiple IP transports, including filtering by interface ([#​3692](n0-computer/iroh#3692)) - ([2359acf](n0-computer/iroh@2359acf)) - *(metrics)* Add connection latency tracking ([#​3606](n0-computer/iroh#3606)) - ([b7e5bb0](n0-computer/iroh@b7e5bb0)) - *(multipath)* Add back basic metrics ([#​3672](n0-computer/iroh#3672)) - ([faa2119](n0-computer/iroh@faa2119)) - *(relay,dns)* Add healthz routes ([#​3783](n0-computer/iroh#3783)) - ([31a6b10](n0-computer/iroh@31a6b10)) - Do not force relay URLs to be absolute ([#​3623](n0-computer/iroh#3623)) - ([9bae228](n0-computer/iroh@9bae228)) - Add AcceptError::from\_boxed ([#​3620](n0-computer/iroh#3620)) - ([280cfc6](n0-computer/iroh@280cfc6)) - Relay only configuration - ([7f17d98](n0-computer/iroh@7f17d98)) - Instead of duplicating the entire connection API, have a type parameter ([#​3619](n0-computer/iroh#3619)) - ([5809a56](n0-computer/iroh@5809a56)) - Prune old, inactive paths ([#​3666](n0-computer/iroh#3666)) - ([7fb80b9](n0-computer/iroh@7fb80b9)) - Qlog support in iroh - ([2d9681c](n0-computer/iroh@2d9681c)) - Expose known remote addrs ([#​3752](n0-computer/iroh#3752)) - ([4c4f242](n0-computer/iroh@4c4f242)) - Add must\_use attributes to Router::spawn ([#​3772](n0-computer/iroh#3772)) - ([0a9b7a0](n0-computer/iroh@0a9b7a0)) - Improve RelayMap and RelayMode configuration ([#​3734](n0-computer/iroh#3734)) - ([c0dacd0](n0-computer/iroh@c0dacd0)) - Basic holepunch metrics ([#​3748](n0-computer/iroh#3748)) - ([37bda14](n0-computer/iroh@37bda14)) - Update to released iroh-quinn ([#​3834](n0-computer/iroh#3834)) - ([e25c5da](n0-computer/iroh@e25c5da)) ##### 🐛 Bug Fixes - *(ci)* Better cli caching ([#​3779](n0-computer/iroh#3779)) - ([94caac0](n0-computer/iroh@94caac0)) - *(deps)* Update to newest quinn main and fix api usage ([#​3802](n0-computer/iroh#3802)) - ([8e9b5c0](n0-computer/iroh@8e9b5c0)) - *(docs)* Fix link to EndpointTicket ([#​3814](n0-computer/iroh#3814)) - ([ccf876e](n0-computer/iroh@ccf876e)) - *(iroh)* Typo(s) ([#​3630](n0-computer/iroh#3630)) - ([1cc5897](n0-computer/iroh@1cc5897)) - *(iroh)* Clear `EndpointStateActor::selected_path` once the last connection closes ([#​3650](n0-computer/iroh#3650)) - ([4b6824c](n0-computer/iroh@4b6824c)) - *(iroh)* \[**breaking**] Correct the error structure ([#​3663](n0-computer/iroh#3663)) - ([dab9d5f](n0-computer/iroh@dab9d5f)) - *(iroh)* Only switch paths if the new path is actually better - ([fbdf2c7](n0-computer/iroh@fbdf2c7)) - *(iroh)* Accurately set `RecvMeta::dst_ip`, remove `normalized_local_addr` ([#​3770](n0-computer/iroh#3770)) - ([692bb53](n0-computer/iroh@692bb53)) - *(iroh)* Ensure the selected holepunched path is set to `PathStatus::Available` ([#​3771](n0-computer/iroh#3771)) - ([561d2fd](n0-computer/iroh@561d2fd)) - *(iroh)* Retry holepunching - ([a58aff4](n0-computer/iroh@a58aff4)) - *(iroh)* Improve handling of no available transports - ([5e79a56](n0-computer/iroh@5e79a56)) - *(iroh)* Actually use user-provided bind addrs ([#​3835](n0-computer/iroh#3835)) - ([fecc909](n0-computer/iroh@fecc909)) - *(iroh)* Properly set quinn paths to available when holepunched ([#​3864](n0-computer/iroh#3864)) - ([a774841](n0-computer/iroh@a774841)) - *(iroh-bench)* Gracefully close the quinn benchmark ([#​3621](n0-computer/iroh#3621)) - ([0799d4f](n0-computer/iroh@0799d4f)) - *(iroh-dns-server)* Inverted validation logic in DoH JSON response handler ([#​3737](n0-computer/iroh#3737)) - ([2efbff6](n0-computer/iroh@2efbff6)) - *(multipath)* Fix remote state actor termination ([#​3676](n0-computer/iroh#3676)) - ([d328bf2](n0-computer/iroh@d328bf2)) - *(tests)* Also run the tests in isolation in the default profile ([#​3664](n0-computer/iroh#3664)) - ([13fe787](n0-computer/iroh@13fe787)) - Stop polling transports when the magicsock is closing ([#​3615](n0-computer/iroh#3615)) - ([e101d26](n0-computer/iroh@e101d26)) - Update to main net-tools ([#​3726](n0-computer/iroh#3726)) - ([1d6e453](n0-computer/iroh@1d6e453)) - Update deny warnings ([#​3819](n0-computer/iroh#3819)) - ([99242af](n0-computer/iroh@99242af)) ##### 🚜 Refactor - *(deps)* Remove rustls-pemfile ([#​3747](n0-computer/iroh#3747)) - ([06772c3](n0-computer/iroh@06772c3)) - *(example)* Reduce timeouts and add close - ([e750ccf](n0-computer/iroh@e750ccf)) - *(iroh)* Simplify internal transports sending ([#​3708](n0-computer/iroh#3708)) - ([8d56889](n0-computer/iroh@8d56889)) - *(iroh)* Avoid storing the TransportsSender ([#​3712](n0-computer/iroh#3712)) - ([3f4d365](n0-computer/iroh@3f4d365)) - *(iroh)* \[**breaking**] Remove Endpoint::latency ([#​3717](n0-computer/iroh#3717)) - ([783e2ef](n0-computer/iroh@783e2ef)) - *(iroh)* \[**breaking**] Make net-report private ([#​3758](n0-computer/iroh#3758)) - ([5b616f0](n0-computer/iroh@5b616f0)) - *(iroh)* Do not export quinn-proto encoding traits ([#​3803](n0-computer/iroh#3803)) - ([f12467b](n0-computer/iroh@f12467b)) - *(iroh)* Spawn `RemoteStateActor` in `JoinSet` and remove `guarded_channel.rs` ([#​3681](n0-computer/iroh#3681)) - ([37f69e0](n0-computer/iroh@37f69e0)) - *(iroh)* \[**breaking**] Improve BindError ([#​3837](n0-computer/iroh#3837)) - ([acbca8c](n0-computer/iroh@acbca8c)) - *(iroh)* \[**breaking**] No longer fall back to a random free port when using `endpoint::Builder::bind_addr` with an unusable port ([#​3836](n0-computer/iroh#3836)) - ([f2b6026](n0-computer/iroh@f2b6026)) - *(iroh)* \[**breaking**] Bind addrs with prefix len 0 are default routes ([#​3838](n0-computer/iroh#3838)) - ([e0fcf7d](n0-computer/iroh@e0fcf7d)) - *(iroh)* Remove mutexes from `RemoteMap` ([#​3841](n0-computer/iroh#3841)) - ([99268b8](n0-computer/iroh@99268b8)) - *(iroh)* Move socket actor\_sender out of shared socket state ([#​3890](n0-computer/iroh#3890)) - ([a738ac7](n0-computer/iroh@a738ac7)) - *(iroh-dns-server)* \[**breaking**] Add storage path config and add tests for DNS-over-HTTPS ([#​3745](n0-computer/iroh#3745)) - ([3bf1e24](n0-computer/iroh@3bf1e24)) - *(multipath)* Make registering connections with the magicsock async ([#​3629](n0-computer/iroh#3629)) - ([e0f10ce](n0-computer/iroh@e0f10ce)) - *(multipath)* Stop inactive endpoint actors ([#​3643](n0-computer/iroh#3643)) - ([25fe805](n0-computer/iroh@25fe805)) - *(multipath)* Rename EndpointMap/EndpointState to RemoteMap/RemoteState ([#​3673](n0-computer/iroh#3673)) - ([34f52c6](n0-computer/iroh@34f52c6)) - *(multipath)* Move discovery into `EndpointStateActor` ([#​3645](n0-computer/iroh#3645)) - ([01545ee](n0-computer/iroh@01545ee)) - Improve path watching, add path stats ([#​3622](n0-computer/iroh#3622)) - ([d1c1dab](n0-computer/iroh@d1c1dab)) - Minor cleanups in endpoint state ([#​3626](n0-computer/iroh#3626)) - ([7887fb5](n0-computer/iroh@7887fb5)) - Use Connection::on\_closed in endpoint state actor ([#​3627](n0-computer/iroh#3627)) - ([1d5937c](n0-computer/iroh@1d5937c)) - Remove the TransportsSenderActor - ([6380246](n0-computer/iroh@6380246)) - Disallow certain Source variants to be constructed externally - ([50fdda3](n0-computer/iroh@50fdda3)) - Remove Endpoint::conn\_type ([#​3647](n0-computer/iroh#3647)) - ([2f924d9](n0-computer/iroh@2f924d9)) - Use boxed watcher, not watchable, on connection ([#​3632](n0-computer/iroh#3632)) - ([492b74e](n0-computer/iroh@492b74e)) - Remove Endpoint::path\_selection ([#​3668](n0-computer/iroh#3668)) - ([1a7a88b](n0-computer/iroh@1a7a88b)) - Prefer EndpointAddr::from\_parts over EndpointAddr { ... } ([#​3662](n0-computer/iroh#3662)) - ([25c2d4d](n0-computer/iroh@25c2d4d)) - Add Side re-export ([#​3739](n0-computer/iroh#3739)) - ([136ff04](n0-computer/iroh@136ff04)) - Use qlog\_from\_env in iroh bench ([#​3743](n0-computer/iroh#3743)) - ([3eff16d](n0-computer/iroh@3eff16d)) - Adapt to new UnorderedRecvStream in iroh-quinn - ([952b50e](n0-computer/iroh@952b50e)) - \[**breaking**] Goodbye magic ([#​3887](n0-computer/iroh#3887)) - ([2d8b2d4](n0-computer/iroh@2d8b2d4)) ##### 📚 Documentation - *(endpoint::Builder)* Clarify that clearing relay transport doesn't alter holepunching ([#​3833](n0-computer/iroh#3833)) - ([52c4284](n0-computer/iroh@52c4284)) - *(iroh)* Improve builder docs about discovery ([#​3801](n0-computer/iroh#3801)) - ([56fc0f7](n0-computer/iroh@56fc0f7)) - *(iroh)* Add detail & example to online method ([#​3722](n0-computer/iroh#3722)) - ([94f8a83](n0-computer/iroh@94f8a83)) - *(iroh-relay)* Add section on how to use as a library ([#​3715](n0-computer/iroh#3715)) - ([40a5ce6](n0-computer/iroh@40a5ce6)) ##### ⚡ Performance - Various improvements - ([8d819f0](n0-computer/iroh@8d819f0)) ##### 🧪 Testing - *(iroh)* Fix `test_two_devices_setup_teardown` hanging ([#​3675](n0-computer/iroh#3675)) - ([59a7e85](n0-computer/iroh@59a7e85)) - *(iroh)* Fix `test_active_relay_inactive` test being flaky ([#​3680](n0-computer/iroh#3680)) - ([160d535](n0-computer/iroh@160d535)) - *(iroh)* Fix doctests for bind\_addr to use port 0 ([#​3839](n0-computer/iroh#3839)) - ([0dba0ff](n0-computer/iroh@0dba0ff)) - *(iroh)* Reduce flakyness of holepunching test ([#​3877](n0-computer/iroh#3877)) - ([8ed8cfa](n0-computer/iroh@8ed8cfa)) - Mark test\_active\_relay\_inactive as non flaky - ([e620b5e](n0-computer/iroh@e620b5e)) - Reduce testing rounds in potentially slow tests ([#​3782](n0-computer/iroh#3782)) - ([45a8b7d](n0-computer/iroh@45a8b7d)) - Improve timeouts for shutdown and reduce some more test rounds - ([95dee08](n0-computer/iroh@95dee08)) ##### ⚙️ Miscellaneous Tasks - *(ci)* Cache more deps ([#​3773](n0-computer/iroh#3773)) - ([f0ab853](n0-computer/iroh@f0ab853)) - *(ci)* Improve netsim perf and logging + update to lld ([#​3793](n0-computer/iroh#3793)) - ([f0e5094](n0-computer/iroh@f0e5094)) - *(dependabot)* Skip patch versions ([#​3885](n0-computer/iroh#3885)) - ([6975379](n0-computer/iroh@6975379)) - Only patch quinn directly - ([1a5c4dd](n0-computer/iroh@1a5c4dd)) - Fixup deny - ([d0707e8](n0-computer/iroh@d0707e8)) - Fixup wasm test - ([a28d1fb](n0-computer/iroh@a28d1fb)) - Update to quinn\@​main-iroh ([#​3716](n0-computer/iroh#3716)) - ([e22c001](n0-computer/iroh@e22c001)) - Update iroh-quinn ([#​3718](n0-computer/iroh#3718)) - ([2cf93a5](n0-computer/iroh@2cf93a5)) - Cargo update ([#​3744](n0-computer/iroh#3744)) - ([dd280b8](n0-computer/iroh@dd280b8)) - Update iroh-quinn ([#​3753](n0-computer/iroh#3753)) - ([9e34569](n0-computer/iroh@9e34569)) - Update quinn to use main branch ([#​3777](n0-computer/iroh#3777)) - ([ff7118e](n0-computer/iroh@ff7118e)) - Update quinn ([#​3781](n0-computer/iroh#3781)) - ([116513d](n0-computer/iroh@116513d)) - Switch from tracing-test to n0-tracing-test ([#​3787](n0-computer/iroh#3787)) - ([e45600b](n0-computer/iroh@e45600b)) - Update to latest iroh-quinn ([#​3795](n0-computer/iroh#3795)) - ([b68c057](n0-computer/iroh@b68c057)) - \[**breaking**] Rename `Discovery` to `AddressLookup` ([#​3853](n0-computer/iroh#3853)) - ([6ad5ac4](n0-computer/iroh@6ad5ac4)) - Release prep ([#​3889](n0-computer/iroh#3889)) - ([9130711](n0-computer/iroh@9130711)) - Release - ([d5299bf](n0-computer/iroh@d5299bf)) ##### Bench - Add ipv6 option and metrics feature - ([147e6bb](n0-computer/iroh@147e6bb)) ##### Deps - *(multipath)* Bump netdev ([#​3667](n0-computer/iroh#3667)) - ([6ef582d](n0-computer/iroh@6ef582d)) - Bump quinn in feat-multipath ([#​3723](n0-computer/iroh#3723)) - ([51ba699](n0-computer/iroh@51ba699)) ##### Example - Add qlog support to transfer example - ([6bca5d0](n0-computer/iroh@6bca5d0)) ##### Examples - *(iroh)* In transfer example print stats independent of endpoint shutdown ([#​3872](n0-computer/iroh#3872)) - ([5c4b9b4](n0-computer/iroh@5c4b9b4)) - Improve transfer example ([#​3873](n0-computer/iroh#3873)) - ([f4bfc9d](n0-computer/iroh@f4bfc9d)) ##### Multipath - Merge main ([#​3674](n0-computer/iroh#3674)) - ([d538b11](n0-computer/iroh@d538b11)) </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My4xMDEuMSIsInVwZGF0ZWRJblZlciI6IjQzLjEwMS4xIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJ0eXBlL21pbm9yIl19--> Reviewed-on: https://git.erwanleboucher.dev/eleboucher/towonel/pulls/6
Description
on Connection that describes the connection state, and implement the fns alpn and remote_id differently depending on what the state is.
The upside is that it should be easier to write code that works with both a 0rtt connection and a fully initialized connection without having to define a trait to abstract over both variants.
The downside is that it is a bit fancy with the types. But then for the non 0rtt case you would never see the fanciness, so maybe it is OK?
Todo:
Note:
if you have a handler that needs to work with both handshake completed connections and non handshake completed connections, you could now just do:
Breaking Changes
iroh::endpoint::Connectiongets a type parameter to track connection state. Default isConnection<HandshakeCompleted>iroh::endpoint::IncomingZeroRttConnectionis removed, replaced with type alias toConnection<IncomingZeroRtt>iroh::endpoint::OutgoingZeroRttConnectionis removed, replaced with type alias toConnection<OutgoingZeroRtt>Notes & open questions
Change checklist
quic-rpciroh-gossipiroh-blobsdumbpipesendme