diff --git a/README.md b/README.md index ad10885..6ed0575 100644 --- a/README.md +++ b/README.md @@ -251,11 +251,12 @@ for the host running the agent, and binding an overlay address would put them in front of the whole mesh — an agent in two networks would then answer one network's questions about the other's names. -The zone is the network name unless `--dns-zone` says otherwise. It is -yours to choose, so a name that shadows a real public domain is reported and -then used: `--dns-zone ru` warns that every public `.ru` name becomes -unreachable from this host, and then does it. `.internal` is reserved for -exactly this and is never mentioned. +The zone is the network name, and it is yours to choose. A name that +shadows a real public domain is reported and then used: a network called +`ru` warns that every public `.ru` name becomes unreachable from this host, +and then does it. Anything that collides with nothing — which is most names +— is said nothing about, because a warning that fires on every private name +anybody picks is how people learn to ignore warnings. On Linux the agent tells systemd-resolved to send questions for that suffix here, over D-Bus, scoped to the overlay interface and as a *routing* domain diff --git a/crates/tsunagi/src/dns/zone.rs b/crates/tsunagi/src/dns/zone.rs index f49787e..699117f 100644 --- a/crates/tsunagi/src/dns/zone.rs +++ b/crates/tsunagi/src/dns/zone.rs @@ -128,17 +128,14 @@ impl ZoneName { .to_string(), ); } - if tld::exist_case_insensitive(top) { - return Some(format!( + // A real top-level domain is the whole of it. A name that is not + // delegated today might be one day — and saying so fires on every + // private name anybody ever picks, which is a warning about + // nothing that teaches people to ignore warnings. + tld::exist_case_insensitive(top).then(|| { + format!( "`.{top}` is a real top-level domain, so every public name under it \ becomes unreachable from this host while the overlay is up" - )); - } - // Not delegated today is not a promise about tomorrow. - (!self.0.contains('.')).then(|| { - format!( - "`.{top}` is not a delegated top-level domain today, but it could \ - become one; `.internal` is reserved for private use and never will" ) }) } @@ -516,11 +513,13 @@ mod tests { let local = ZoneName::new("local").unwrap().collision().unwrap(); assert!(local.contains("multicast DNS"), "{local}"); - // An undelegated single label is a maybe, not a yes. - let lab = ZoneName::new("lab").unwrap().collision().unwrap(); - assert!(lab.contains("could"), "{lab}"); - // A multi-label name under something undelegated is not worth a word. - assert_eq!(ZoneName::new("a.lab").unwrap().collision(), None); + // A name that collides with nothing is said nothing about. It + // might be delegated one day, and warning about that fires on + // every private name anybody picks — a warning about nothing, + // which is how people learn to ignore warnings. + for quiet in ["lab", "a.lab", "pidar", "twar", "kitchen-table"] { + assert_eq!(ZoneName::new(quiet).unwrap().collision(), None, "{quiet}"); + } } #[test]