Our Info: display peer-observed external address

Store the external address reported by peers via your_observed_addr in
initial exchange. Display it in Our Info panel with NAT classification.
Replaces reliance on iroh's pkarr/STUN for external address discovery
while keeping clear_address_lookup() (no dns.iroh.link publishing).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Scott Reimers 2026-04-19 17:37:33 -04:00
parent d1036a2d7d
commit ffb13d6791
2 changed files with 34 additions and 2 deletions

View file

@ -1870,7 +1870,7 @@ async fn get_our_info(state: State<'_, AppNode>) -> Result<OurInfoDto, String> {
}
}
// Add iroh-discovered addresses not already listed (STUN-observed externals)
// Add iroh-discovered addresses not already listed
for sock in net.endpoint_addr().ip_addrs() {
if sock.ip().is_loopback() || sock.ip().is_unspecified() { continue; }
let s = sock.to_string();
@ -1885,6 +1885,19 @@ async fn get_our_info(state: State<'_, AppNode>) -> Result<OurInfoDto, String> {
});
}
// Add peer-observed external address (from anchor's your_observed_addr)
if let Some(observed) = net.conn_handle().observed_external_addr().await {
let s = observed.to_string();
if !addresses.iter().any(|a| a.addr == s) {
let family = if observed.ip().is_ipv4() { "IPv4" } else { "IPv6" };
addresses.insert(0, AddressInfoDto {
addr: s,
family: family.to_string(),
status: classify_addr(&observed, &nat_type, has_upnp, bind_addr.is_some(), true),
});
}
}
Ok(OurInfoDto {
node_id: hex::encode(net.node_id_bytes()),
addresses,