mirror of
https://github.com/google/nomulus
synced 2025-12-23 06:15:42 +00:00
This is a follow-up to PR #2908, which relaxed this restriction on bare TLDs only, but now we also allow it systemwide on domains and hostnames as well. The rules against hyphens in these positions are still enforced on all parts of the domain name except the last one. Correct handling of multi-part TLDs in this regard is out of scope in this PR; a multi-part TLD that looked something like ".zz--foobar.foobar" would still fail validation. (But of course you cannot a priori know just from looking at a 3-part string whether it might be a hostname on a normal TLD, or a domain name on a 2-part TLD.) This also has some annoying interactions with a trailing dot (indicating the root), which need to be preserved, but otherwise don't affect how TLD validation is handled. BUG= http://b/471013082