diff --git a/godns.conf b/godns.conf index a6e7bbc..0b7fda7 100644 --- a/godns.conf +++ b/godns.conf @@ -14,6 +14,9 @@ port = 53 [resolv] resolv-file = "/etc/resolv.conf" timeout = 5 # 5 seconds +# The concurrency interval request upstream recursive server +# Match the PR15, https://github.com/kenshinx/godns/pull/15 +interval = 200 # 200 milliseconds [redis] host = "127.0.0.1" diff --git a/resolver.go b/resolver.go index 6649b50..cc59dcd 100644 --- a/resolver.go +++ b/resolver.go @@ -56,7 +56,7 @@ func (r *Resolver) Lookup(net string, req *dns.Msg) (message *dns.Msg, err error } } - ticker := time.NewTicker(time.Second) + ticker := time.NewTicker(time.Duration(settings.ResolvConfig.Interval) * time.Millisecond) defer ticker.Stop() // Start lookup on each nameserver top-down, in every second for _, nameserver := range r.Nameservers() { diff --git a/settings.go b/settings.go index 9a3de78..46108bc 100644 --- a/settings.go +++ b/settings.go @@ -27,6 +27,7 @@ type Settings struct { type ResolvSettings struct { ResolvFile string `toml:"resolv-file"` Timeout int + Interval int } type DNSServerSettings struct {