exception handle

This commit is contained in:
kenshin 2013-07-24 10:52:59 +08:00
parent 22a31dcd98
commit 2d49200a53
4 changed files with 20 additions and 3 deletions

View File

@ -17,10 +17,20 @@ Similar as [dnsmasq](http://www.thekelleys.org.uk/dnsmasq/doc.html) ,but support
### Configuration
All the configuration on godns.conf a TOML formating config file.
All the configuration on `godns.conf` a TOML formating config file.
More about Toml :[https://github.com/mojombo/toml](https://github.com/mojombo/toml)
#### resolv.conf
Upstream server can be configuration by change file from somewhere other that "/etc/resolv.conf"
```
[resolv]
resolv-file = "/etc/resolv.conf"
```
If multi `namerserver` set at resolv.conf, the upsteam server will try in order of up to botton

View File

@ -13,7 +13,7 @@ port = 53
[resolv]
resolv-file = "/etc/resolv.conf"
timeout = 30 # 30 seconds
timeout = 5 # 5 seconds
[redis]
host = "kenshinx.me"

View File

@ -43,6 +43,14 @@ func (h *GODNSHandler) do(net string, w dns.ResponseWriter, req *dns.Msg) {
mesg, err := h.resolver.Lookup(net, req)
if err != nil {
Debug("%s", err)
dns.HandleFailed(w, req)
return
}
w.WriteMsg(mesg)
}
func (h *GODNSHandler) DoTCP(w dns.ResponseWriter, req *dns.Msg) {

View File

@ -44,7 +44,6 @@ func (r *Resolver) Lookup(net string, req *dns.Msg) (message *dns.Msg, err error
Debug("%s resolv on %s ttl: %d", qname, nameserver, rtt)
return r, nil
}
Debug("%s dns query failed", qname)
return nil, ResolvError{qname, r.Nameservers()}
}