@whitequark good question
i dunno the go libraries well enough, but i’d probably look around to see if there’s existing an existing hostname checker i could clone and hack
but a regex would do if i didn’t find code i like (i have used them in the past for this, but without _, heh)
one tricky thing is hostnames have per-label length limits which a regex can handle ok, but also an overall length limit which is probably best done as a separate check
oh wait, the tr46 algorithm includes length checks already!
so it might be reasonable to just check [a-z0-9._-]+
(sorry that turned into a ramble)