exception handle
This commit is contained in:
parent
22a31dcd98
commit
2d49200a53
12
README.MD
12
README.MD
|
@ -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
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ port = 53
|
|||
|
||||
[resolv]
|
||||
resolv-file = "/etc/resolv.conf"
|
||||
timeout = 30 # 30 seconds
|
||||
timeout = 5 # 5 seconds
|
||||
|
||||
[redis]
|
||||
host = "kenshinx.me"
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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()}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue