-
Notifications
You must be signed in to change notification settings - Fork 320
feat(iroh): add ability to publish and resolve relay urls in mDNS #3691
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
base: main
Are you sure you want to change the base?
Conversation
|
Documentation for this PR has been generated and is available at: https://n0-computer.github.io/iroh/pr/3691/docs/iroh/ Last updated: 2025-11-22T09:15:04Z |
TODOS
|
|
|
||
| /// Sets whether this endpoint should advertise its [`RelayUrl`]. | ||
| /// | ||
| /// Overridden by the `MdnsDiscoveryBuilder::advertise` method. If this is |
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.
"Overridden" threw me off, I think it's the wrong language. Maybe something longer like "Only if mDNS advertising is enabled using [Self::advertise] will relay URLs be advertised." But even that's not great.
Maybe the whole thing can be described differently:
/// Enables advertising this endpoint's [`RelayUrl`] in addition to IP addresses.
///
/// Enabling [`Self::advertise`] will only advertise IP addresses, enabling this will additionally advertise the endpoint's [`RelayUrl`]. Note that if [`Self::advertise`] is disabled no advertising happens at all, neither of IP addresses or relay URLs.
Or maybe something better even :)
Also, I think it's worth updating the doc comment of advertise itself as well to make clear it only advertises IP addresses but is also a master switch.
| } | ||
|
|
||
| /// Add the subscriber to the list of subscribers | ||
| /// Add the subscriber to the list of subscribers. |
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.
😂
| if publish_relay_url { | ||
| if let Some(relay) = data.relay_urls().next() { | ||
| if let Err(err) = discovery.set_txt_attribute(RELAY_URL_ATTRIBUTE.to_string(), Some(relay.to_string())) { | ||
| warn!("Failed to set the relay url in mDNS: {err:?}"); |
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.
This can happen if the RelayUrl is too long right? I wonder if this could get very noisy. But maybe that's the point.
Description
Adds the ability to resolve and publish relay URLs over mDNS. This is off by default.
RelayUrls are typically only used for hole punching, which likely is not needed when using mDNS. However, we have seen some test cases where mDNS packets get through local firewalls, but our iroh packets are blocked. In these cases, it may be prudent to also publish your relay url.
MdnsDiscoveryBuilder::publish_relay_urlmethod