cmd/tailscale: modify empty hostname case

Signed-Off-By: Dmytro Shynkevych <dmytro@tailscale.com>
This commit is contained in:
Dmytro Shynkevych 2020-07-15 17:22:13 -04:00 committed by Brad Fitzpatrick
parent 8163521c33
commit 65d2537c05

View File

@ -80,12 +80,13 @@
hostname string
}
// validateHostname checks that name is a valid non-empty domain name label
// validateHostname checks that name is a valid domain name label
// pursuant to https://tools.ietf.org/html/rfc1034#section-3.1.
func validateHostname(name string) error {
switch {
// Empty string is treated as missing hostname and replaced downstream.
case len(name) == 0:
return fmt.Errorf("empty")
return nil
case len(name) > 63:
return fmt.Errorf("longer than 63 characters")
}