-
Notifications
You must be signed in to change notification settings - Fork 165
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-net)!: Allow using a NodeId directly in connect. #2774
Conversation
Also deprecate connect_by_node_id since it is no longer needed.
Documentation for this PR has been generated and is available at: https://n0-computer.github.io/iroh/pr/2774/docs/iroh/ Last updated: 2024-10-02T12:18:06Z |
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.
nice, I like it
d6405dd
to
16e56da
Compare
/// A value that can be converted into a [`NodeAddr`] is required. This can be either a | ||
/// [`NodeAddr`], a [`NodeId`] or a [`iroh_base::ticket::NodeTicket`]. | ||
/// | ||
/// The [`NodeAddr`] must contain the [`NodeId`] to dial and may also contain a [`RelayUrl`] |
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.
We don't use dial
in any of the API names of iroh-net::Endpoint
so I prefer not to use that in documentation either as that is probably confusing to users. I usually stick to "connect", "establish a connection" or something like that.
(yeah, there's the somewhat weird dialer module which is a bit of an odd duck...)
alpn: &[u8], | ||
) -> Result<quinn::Connection> { | ||
let node_addr = node_addr.into(); | ||
tracing::Span::current().record("remote", node_addr.node_id.fmt_short()); |
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.
that's cool! TIL
Description
Allow using anything can be converted to a NodeAddr when connecting. This means that we can directly connect with NodeIds, and connect_by_node_id is no longer needed.
Also deprecate connect_by_node_id since it is no longer needed.
Breaking Changes
impl Into<NodeAddr>
instead of aNodeAddr
Notes & open questions
Note: Doing this means that the instrumentation of connect no longer contains the remote, which is bad I guess. Not sure how to work around this. One way would be to have connect and connect_impl - connect_impl is like the current connect and can be instrumented as before. Any other way to do this?
Note: since there is a From for NodeAddr, you can also directly dial using a ticket, which is kinda neat.
Change checklist