实现DNS域名验证

This commit is contained in:
GoEdgeLab
2022-09-10 16:13:31 +08:00
parent 3eeb655820
commit e28931c177
4 changed files with 24 additions and 9 deletions

View File

@@ -17,7 +17,6 @@ func ValidateDomainFormat(domain string) bool {
if piece == "-" ||
strings.HasPrefix(piece, "-") ||
strings.HasSuffix(piece, "-") ||
//strings.Contains(piece, "--") ||
len(piece) > 63 ||
!regexp.MustCompile(`^[a-z0-9-]+$`).MatchString(piece) {
return false