域名和记录名中可以使用大写

This commit is contained in:
GoEdgeLab
2022-09-14 19:48:23 +08:00
parent 2cbed93cb4
commit 12bb0799ff

View File

@@ -18,7 +18,8 @@ func ValidateDomainFormat(domain string) bool {
strings.HasPrefix(piece, "-") || strings.HasPrefix(piece, "-") ||
strings.HasSuffix(piece, "-") || strings.HasSuffix(piece, "-") ||
len(piece) > 63 || len(piece) > 63 ||
!regexp.MustCompile(`^[a-z0-9-]+$`).MatchString(piece) { // 我们允许大写字母、下划线,防止有些特殊场景下需要
!regexp.MustCompile(`^[_a-zA-Z0-9-]+$`).MatchString(piece) {
return false return false
} }
} }
@@ -76,7 +77,8 @@ func ValidateRecordName(name string) bool {
strings.HasSuffix(piece, "-") || strings.HasSuffix(piece, "-") ||
//strings.Contains(piece, "--") || //strings.Contains(piece, "--") ||
len(piece) > 63 || len(piece) > 63 ||
!regexp.MustCompile(`^[_a-z0-9-]+$`).MatchString(piece) { // 我们允许大写字母、下划线,防止有些特殊场景下需要
!regexp.MustCompile(`^[_a-zA-Z0-9-]+$`).MatchString(piece) {
return false return false
} }
} }