mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-12-15 12:46:34 +08:00
增加DNS域名管理
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
package domainutils
|
||||
|
||||
import (
|
||||
"regexp"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// 校验域名格式
|
||||
func ValidateDomainFormat(domain string) bool {
|
||||
pieces := strings.Split(domain, ".")
|
||||
for _, piece := range pieces {
|
||||
if !regexp.MustCompile(`^[a-z0-9-]+$`).MatchString(piece) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
Reference in New Issue
Block a user