From cf02889c62adc2a989f834fce089b50762b109d4 Mon Sep 17 00:00:00 2001 From: kenshinx Date: Thu, 7 May 2015 17:58:31 +0800 Subject: [PATCH] Make upstream query interval configurable match the PR #15 --- godns.conf | 3 +++ resolver.go | 2 +- settings.go | 1 + 3 files changed, 5 insertions(+), 1 deletion(-) 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 {