Make upstream query interval configurable match the PR #15

This commit is contained in:
kenshinx 2015-05-07 17:58:31 +08:00
parent 44b4cfa24e
commit cf02889c62
3 changed files with 5 additions and 1 deletions

View File

@ -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"

View File

@ -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() {

View File

@ -27,6 +27,7 @@ type Settings struct {
type ResolvSettings struct {
ResolvFile string `toml:"resolv-file"`
Timeout int
Interval int
}
type DNSServerSettings struct {