Skip to content

Commit

Permalink
Merge branch 'raymaster' into flymaster
Browse files Browse the repository at this point in the history
  • Loading branch information
vcptr committed Nov 19, 2019
2 parents 8854c78 + 7f40be7 commit 3c3a828
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions infra/conf/dns.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,24 @@ func (c *DnsConfig) Build() (*dns.Config, error) {
mapping.Domain = domain[5:]

mappings = append(mappings, mapping)
} else if strings.HasPrefix(domain, "ext:") {
kv := strings.Split(domain[4:], ":")
if len(kv) != 2 {
return nil, newError("invalid external resource: ", domain)
}
filename := kv[0]
country := kv[1]
domains, err := loadGeositeWithAttr(filename, country)
if err != nil {
return nil, newError("failed to load domains: ", country, " from ", filename).Base(err)
}
for _, d := range domains {
mapping := getHostMapping(addr)
mapping.Type = typeMap[d.Type]
mapping.Domain = d.Value

mappings = append(mappings, mapping)
}
} else {
mapping := getHostMapping(addr)
mapping.Type = dns.DomainMatchingType_Full
Expand Down

0 comments on commit 3c3a828

Please sign in to comment.