diff --git a/main.go b/main.go index e3d55cb..1f9b63a 100644 --- a/main.go +++ b/main.go @@ -38,8 +38,8 @@ func main() { // rules for _, r := range config.rules { - for _, domain := range r.Domain { - if len(r.DNSServers) > 0 { + if len(r.DNSServers) > 0 { + for _, domain := range r.Domain { d.SetServers(domain, r.DNSServers) } } diff --git a/rule/config.go b/rule/config.go index 8eda6c3..b6885a7 100644 --- a/rule/config.go +++ b/rule/config.go @@ -56,9 +56,9 @@ func NewConfFromFile(ruleFile string) (*Config, error) { f.StringSliceUniqVar(&p.DNSServers, "dnsserver", nil, "remote dns server") f.StringVar(&p.IPSet, "ipset", "", "ipset NAME, will create 2 sets: NAME for ipv4 and NAME6 for ipv6") - f.StringSliceUniqVar(&p.Domain, "domain", nil, "domain") - f.StringSliceUniqVar(&p.IP, "ip", nil, "ip") - f.StringSliceUniqVar(&p.CIDR, "cidr", nil, "cidr") + f.StringSliceVar(&p.Domain, "domain", nil, "domain") + f.StringSliceVar(&p.IP, "ip", nil, "ip") + f.StringSliceVar(&p.CIDR, "cidr", nil, "cidr") err := f.Parse() if err != nil {