Skip to content

Conversation

@ramfox
Copy link
Member

@ramfox ramfox commented Dec 10, 2025

Description

Incoming::retry returns a RetryError, which you can turn back into a quinn::Incoming. We want that quinn::Incoming to instead be an iroh::endpoint::Incoming. This PR fixes that.

Incoming::accept_with takes a quinn::ServerConfig, however the quinn::ServerConfig allows you to override the quinn::TransportConfig, which we have new typed to QuicTransportConfig. So, this PR new types quinn::ServerConfig to quic::ServerConfig, and ensures that the quinn::TransportConfig is set appropriately for multipath use.

This PR also explicitly comments on each quinn export and labels what type uses that export and where it enters the public iroh API.

Breaking Changes

iroh:
- changed
- Incoming::retry now returns an iroh::endpoint::RetryError, rather than a quinn::RetryError
- Incoming::accept_with now takes a iroh::endpoint::ServerConfig, rather than a quinn::ServerConfig
- iroh::endpoint::QuicTransportConfig has no more "set" methods, those have been moved to iroh::endpoint::QuicTransportConfigBuilder
- iroh:endpoint::QuicTransportConfig::builder() returns a default iroh::endpoint:: QuicTransportConfigBuilder
- removed
- removed quinn::ServerConfig (use iroh::endpoint::ServerConfig)
- removed quinn::RetryError (use iroh::endpoint::RetryError)
- added
- added iroh::endpoint::ServerConfigBuilder
- added iroh::endpoint::ServerConfig
- added iroh::endpoint::RetryError

Notes & open questions

Okay. So. I impl'd all of the methods one-to-one from quinn::ServerConfig, but I think there are a bunch of fields we may want to restrict folks from messing with when they use Incoming::accept_with, as currently, they can use this API to replace our normal TlsConfig entirely.

I'm also unsure if there are any other bits in here (for example the quinn::ServerConfig::migrate field) that may interfere with expected multipath usage.

My proposal would be to either eliminate the Incoming::accept_with method entirely (therefore removing the need to publically export the ServerConfig), or reduce ServerConfig in scope so that only fields that will not interfere with "business as usual" for multipath/iroh remain.

Change checklist

  • Self-review.
  • Documentation updates following the style guide, if relevant.
  • All breaking changes documented.

@ramfox ramfox self-assigned this Dec 10, 2025
@ramfox ramfox changed the base branch from main to feat-multipath December 10, 2025 05:33
@github-actions
Copy link

github-actions bot commented Dec 10, 2025

Documentation for this PR has been generated and is available at: https://n0-computer.github.io/iroh/pr/3757/docs/iroh/

Last updated: 2025-12-18T18:35:03Z

@ramfox ramfox added this to iroh Dec 10, 2025
@github-project-automation github-project-automation bot moved this to 🏗 In progress in iroh Dec 10, 2025
Copy link
Contributor

@flub flub left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really nice to get all the imports cleaned up, thank you for slogging through that!

@ramfox ramfox requested a review from flub December 12, 2025 03:30
Copy link
Contributor

@flub flub left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Upstream's ARC's around the transport config and server config were carefully constructed so that you could do a accept_with in a loop with customised config and all you ever had to do was increment the ref count on the Arc. And we now have a full clone of a struct every time. That's pretty unfortunate.

I've not tried to see if it can be solved or not... but it might be worth seeing if that could be possible?

The Endpoint::create_server_config method is fine I think, both in location and name.

@ramfox
Copy link
Member Author

ramfox commented Dec 12, 2025

@flub My only proposed "solution" to the Arc problem, would be to have a QuicTransportConfigBuilder and QuicTransportConfig/ServerConfigBuilder and ServerConfig.

The builder structs would contain un-arc-ed versions of the inner quinn types, and the built versions would contain arc-d versions that can no longer be edited.

@ramfox
Copy link
Member Author

ramfox commented Dec 12, 2025

@flub latest commit does the split between builder types for QuicTransportConfig and ServerConfig and the types that have inner arcs that cannot be edited.

I think it works out fine. What is interesting here is that in quinn those types are pretty opaque, only allowing visibility into very few fields after they've been edited, so it doesn't bloat the API tooooo much.

If you think this is the way to go, I'll add docs.

Copy link
Contributor

@flub flub left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed the builder works quite well for this! I'm fine with using this approach.

@ramfox
Copy link
Member Author

ramfox commented Dec 15, 2025

Okay so latest changes:

  • QuicTransportConfig has a builder method that returns a QuicTransportConfigBuilder
  • QuicTransportConfigBuilder expects you to use the above method, so it no longer has a public new nor a Default impl
  • ServerConfig has a builder method that returns a ServerConfigBuilder (for completeness: you can only build a ServerConfigBuilder using the Endpoint::create_server_config_builder method)
  • the accessor functions on ServerConfig and ServerConfigBuilder are removed, allowing us to remove the crypto::ServerConfig as CryptoServerConfig quinn exports, as well as ConnectionId and Session, that were in the public api of crypto::ServerConfig

ramfox added a commit that referenced this pull request Dec 15, 2025
…3774)

## Description

Builds on the work done in #3757 to make types more or less public.

- makes `CreateHandleError` public
- makes `IncomingFuture` public
- makes `net_report::GetRelayAddrError` and
`net_report::MeasureHttpsLatencyError` more private
- removes unused `IpPorts` struct

---------

Co-authored-by: “ramfox” <“kasey@n0.computer”>
@dignifiedquire
Copy link
Contributor

thanks for doing this, the builder code reads so much nicer now

“ramfox” added 9 commits December 18, 2025 13:32
`ServerConfig` is used in the public API in `Incoming::accept_with`. `quinn::ServerConfig` takes a `TransportConfig`. However, we want to maintain control over the `TransportConfig` fields, so we new typed it to `QuicTransportConfig`. So, we needed to new type `quinn::ServerConfig`, which ensures setting the `QuicTransportConfig` correctly.

This also organizes the quinn imports and labels where each type comes from.
…tConfig`, to enable arc-ing the inner quinn structs
@ramfox ramfox changed the base branch from feat-multipath to main December 18, 2025 18:34
@github-actions
Copy link

Netsim report & logs for this PR have been generated and is available at: LOGS
This report will remain available for 3 days.

Last updated for commit: c10ed16

@ramfox ramfox added this pull request to the merge queue Dec 18, 2025
Merged via the queue into main with commit aa6b918 Dec 18, 2025
28 of 29 checks passed
@github-project-automation github-project-automation bot moved this from 🏗 In progress to ✅ Done in iroh Dec 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: ✅ Done

Development

Successfully merging this pull request may close these issues.

4 participants