Skip to content

Commit ad2485f

Browse files
authored
Merge pull request #152 from datum-cloud/fix/dns-dev-one-addr-per-txt
fix(dns_dev): emit one addr= TXT entry per address
2 parents a93533f + 69aa3a5 commit ad2485f

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

cli/src/dns_dev.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,12 +161,18 @@ fn build_catalog(config_path: &PathBuf, fallback_origin: &str) -> n0_error::Resu
161161
let z32_id = z32::encode(endpoint_id.as_bytes());
162162
let name = Name::from_str(&format!("_iroh.{z32_id}.{origin}.")).anyerr()?;
163163

164+
// iroh's parser (iroh-relay/src/endpoint_info.rs) runs
165+
// SocketAddr::from_str on each IrohAttr::Addr value as-is and
166+
// silently drops failures, and its serializer emits one
167+
// (Addr, addr.to_string()) attribute per IP. So the canonical
168+
// wire form is one "addr=<single-sockaddr>" TXT entry per
169+
// address, not one "addr=A B C" line.
164170
let mut txt_entries = Vec::new();
165171
if let Some(relay) = record.relay {
166172
txt_entries.push(format!("relay={relay}"));
167173
}
168-
if !record.addrs.is_empty() {
169-
txt_entries.push(format!("addr={}", record.addrs.join(" ")));
174+
for addr in &record.addrs {
175+
txt_entries.push(format!("addr={addr}"));
170176
}
171177
if txt_entries.is_empty() {
172178
continue;

0 commit comments

Comments
 (0)