-
Notifications
You must be signed in to change notification settings - Fork 181
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(iroh)!: Wrap the Connection struct so we own the type #3110
base: main
Are you sure you want to change the base?
Conversation
This makes iroh own the Connection type. This is desireable because: - Some: upstream APIs don't work well for us, e.g. Connection::remote_address is not that meaningful. This allows us to remove those and replace them with more appropriate APIs. This has not yet been done in this PR however. - The connection type and changes are currently on the Endpoint, they also belong on the Connection. - Connection information, like which pats are used, the latencies of those paths etc, also belong on the Connection. - It is generally not great to expose types which you have no control over in your public API. For the 1.0 we do not want to have any such structs. This takes an important step in that direction. As part of this change Connection::remote_node_id replaces the get_remote_node_id function. Also Connection::alpn now exists.
Documentation for this PR has been generated and is available at: https://n0-computer.github.io/iroh/pr/3110/docs/iroh/ Last updated: 2025-01-09T11:05:55Z |
/// connection. | ||
/// | ||
/// [`PublicKey`]: iroh_base::PublicKey | ||
// TODO: Would be nice if this could be infallible. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are there cases where we expect this to be fallible?
Why not make this infallible by using self.peer_identity().unwrap()
?
Is returning an error here a boneheaded exception?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I really like this.
I'd personally love to go even further and remove Connection::remote_address
already, etc. but I get that you're going to do that as follow-ups instead.
Description
This makes iroh own the Connection type. This is desireable because:
Some: upstream APIs don't work well for us,
e.g. Connection::remote_address is not that meaningful. This allows
us to remove those and replace them with more appropriate APIs. This
has not yet been done in this PR however.
The connection type and changes are currently on the Endpoint, they
also belong on the Connection.
Connection information, like which pats are used, the latencies of
those paths etc, also belong on the Connection.
It is generally not great to expose types which you have no control
over in your public API. For the 1.0 we do not want to have any
such structs. This takes an important step in that direction.
As part of this change Connection::remote_node_id replaces the
get_remote_node_id function. Also Connection::alpn now exists.
Breaking Changes
iroh
iroh::endpoint::get_remote_node_id
has been removed. Useiroh::endpoint::Connection::remote_node_id
instead.Notes & open questions
This does not yet clean up the existing methods in the Connection,
preserving most of them as-is. It is easier to handle those
separately as each one involves careful decisions about the API.
Replaces #2768
Change checklist