mirror of
https://github.com/chatmail/core.git
synced 2026-04-27 10:26:29 +03:00
refactor: assert that Iroh node addresses have home relay URL
With newer Iroh it is possible to obtain own node address before home relay is selected and accidentally send own address without relay URL. It took me some time to debug why Iroh 0.92.0 did not work with iroh-relay 0.92.0 so I'm adding these assertions even while we still use Iroh 0.35.0.
This commit is contained in:
@@ -185,9 +185,14 @@ impl Iroh {
|
||||
}
|
||||
|
||||
/// Get the iroh [NodeAddr] without direct IP addresses.
|
||||
///
|
||||
/// The address is guaranteed to have home relay URL set
|
||||
/// as it is the only way to reach the node
|
||||
/// without global discovery mechanisms.
|
||||
pub(crate) async fn get_node_addr(&self) -> Result<NodeAddr> {
|
||||
let mut addr = self.router.endpoint().node_addr().await?;
|
||||
addr.direct_addresses = BTreeSet::new();
|
||||
debug_assert!(addr.relay_url().is_some());
|
||||
Ok(addr)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user