cmd/tailscale: modify empty hostname case

Signed-Off-By: Dmytro Shynkevych <dmytro@tailscale.com>
pull/569/head
Dmytro Shynkevych 4 years ago committed by Brad Fitzpatrick
parent 8163521c33
commit 65d2537c05

@ -80,12 +80,13 @@ var upArgs struct {
hostname string 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. // pursuant to https://tools.ietf.org/html/rfc1034#section-3.1.
func validateHostname(name string) error { func validateHostname(name string) error {
switch { switch {
// Empty string is treated as missing hostname and replaced downstream.
case len(name) == 0: case len(name) == 0:
return fmt.Errorf("empty") return nil
case len(name) > 63: case len(name) > 63:
return fmt.Errorf("longer than 63 characters") return fmt.Errorf("longer than 63 characters")
} }

Loading…
Cancel
Save