feat: 尝试支持设置阿里云 dns

This commit is contained in:
Mmx233
2022-12-08 18:25:18 +08:00
parent a4e9f35303
commit 8ef9b2fc9e
7 changed files with 278 additions and 8 deletions

18
dns/util/domain.go Normal file
View File

@@ -0,0 +1,18 @@
package dnsUtil
import (
"errors"
"strings"
)
func DecodeDomain(domain string) (subStr string, rootDomain string, e error) {
t := strings.Split(domain, ".")
if len(t) == 1 {
return "", "", errors.New("域名不合法")
} else if len(t) == 2 {
return "@", domain, nil
}
l := len(t)
return strings.Join(t[:l-2], "."), strings.Join(t[l-2:l], "."), nil
}