mirror of
https://github.com/nadoo/glider.git
synced 2026-11-23 23:49:41 +08:00
config: optimize the parsing speed of rule config file (#306)
This commit is contained in:
1 parent
f2eb638b91
commit
6cfbfff75f
2 files changed
+5
-5
No files matched your search
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
+3
-3
@@ -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 {
|
||||
|
||||
Reference in new issue
Block a user