1
0
mirror of https://github.com/taigrr/godns synced 2025-01-18 04:03:25 -08:00

remove unused code

This commit is contained in:
Timothy 2017-10-27 11:39:44 +08:00
parent 2fd1736ac6
commit 4280f86362

View File

@ -4,7 +4,6 @@ import (
"encoding/json"
"fmt"
"io/ioutil"
"strings"
)
//Domain struct
@ -44,35 +43,3 @@ func LoadSettings(configPath string, settings *Settings) error {
return nil
}
//LoadDomains -- Load domains from domains string
func LoadDomains(domainsOrginStr string, domains *[]Domain) error {
domainsMap := make(map[string]*Domain)
domainsArray := strings.Split(domainsOrginStr, ",")
for _, host := range domainsArray {
dotCount := strings.Count(host, ".")
if dotCount < 2 {
continue
}
len := len(host)
pos := strings.Index(host, ".")
subDomain := host[0:pos]
domainName := host[pos+1 : len]
if d, exist := domainsMap[domainName]; exist {
d.SubDomains = append(d.SubDomains, subDomain)
} else {
d := new(Domain)
d.DomainName = domainName
d.SubDomains = append(d.SubDomains, subDomain)
domainsMap[domainName] = d
}
}
for _, d := range domainsMap {
*domains = append(*domains, *d)
}
return nil
}