From 69aa3a5882ed2590af1ff79487a759b9ca5e9e05 Mon Sep 17 00:00:00 2001 From: Zach Smith Date: Fri, 1 May 2026 14:14:38 -0700 Subject: [PATCH] fix(dns_dev): emit one addr= TXT entry per address MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit iroh's DNS parser at iroh-relay/src/endpoint_info.rs runs SocketAddr::from_str on each IrohAttr::Addr value as-is — it does not split on whitespace. SocketAddr::from_str("A B C") fails, and .ok() drops the entry silently. The dev DNS server was emitting one "addr=A B C" line, which iroh would parse to zero direct addresses and only see relay=. iroh's own serializer (iroh-relay/src/endpoint_info.rs:511-520) pushes one (Addr, addr.to_string()) attribute per IP, so the canonical wire form is multiple "addr=" TXT entries. Match that shape here so endpoints registered via this dev server actually resolve their direct addresses when iroh dials them. --- cli/src/dns_dev.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/cli/src/dns_dev.rs b/cli/src/dns_dev.rs index f95aa9f..80e34d2 100644 --- a/cli/src/dns_dev.rs +++ b/cli/src/dns_dev.rs @@ -161,12 +161,18 @@ fn build_catalog(config_path: &PathBuf, fallback_origin: &str) -> n0_error::Resu let z32_id = z32::encode(endpoint_id.as_bytes()); let name = Name::from_str(&format!("_iroh.{z32_id}.{origin}.")).anyerr()?; + // iroh's parser (iroh-relay/src/endpoint_info.rs) runs + // SocketAddr::from_str on each IrohAttr::Addr value as-is and + // silently drops failures, and its serializer emits one + // (Addr, addr.to_string()) attribute per IP. So the canonical + // wire form is one "addr=" TXT entry per + // address, not one "addr=A B C" line. let mut txt_entries = Vec::new(); if let Some(relay) = record.relay { txt_entries.push(format!("relay={relay}")); } - if !record.addrs.is_empty() { - txt_entries.push(format!("addr={}", record.addrs.join(" "))); + for addr in &record.addrs { + txt_entries.push(format!("addr={addr}")); } if txt_entries.is_empty() { continue;