Update hostname regex to accept "-"

Updated hostname regex to accept "-" according to RFC 1123
This commit is contained in:
Sam SIU 2021-02-17 00:23:28 +08:00
parent fdc1312c44
commit 3b4513eebd
No known key found for this signature in database
GPG Key ID: 7230069502C32B4B
1 changed files with 1 additions and 1 deletions

View File

@ -153,7 +153,7 @@ func buildTemplate() *template.Template {
}
func isValidHostname(host string) (string, bool) {
valid, _ := regexp.Match("^[a-z0-9]{1,32}$", []byte(host))
valid, _ := regexp.Match("^([a-zA-Z0-9]([a-zA-Z0-9\\-]{0,61}[a-zA-Z0-9])?)$", []byte(host))
return host, valid
}