Support for larger UDP DNS responses #30
As [RFC6891](https://tools.ietf.org/html/rfc6891) define, Extension Mechanisms for DNS(EDNS(0)) can make UDP DNS response packets reach max 65535 bytes and breakthrough the early [RFC1035](‘https://tools.ietf.org/html/rfc1035’) 512 limitation.
This commit is contained in:
parent
7d1f6af220
commit
4d3d475c27
|
@ -18,6 +18,8 @@ timeout = 5 # 5 seconds
|
||||||
# Match the PR15, https://github.com/kenshinx/godns/pull/15
|
# Match the PR15, https://github.com/kenshinx/godns/pull/15
|
||||||
interval = 200 # 200 milliseconds
|
interval = 200 # 200 milliseconds
|
||||||
|
|
||||||
|
setedns0 = false #Support for larger UDP DNS responses
|
||||||
|
|
||||||
[redis]
|
[redis]
|
||||||
host = "127.0.0.1"
|
host = "127.0.0.1"
|
||||||
port = 6379
|
port = 6379
|
||||||
|
|
|
@ -34,6 +34,10 @@ func (r *Resolver) Lookup(net string, req *dns.Msg) (message *dns.Msg, err error
|
||||||
WriteTimeout: r.Timeout(),
|
WriteTimeout: r.Timeout(),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if net == "udp" && settings.ResolvConfig.SetEDNS0 {
|
||||||
|
req = req.SetEdns0(65535, true)
|
||||||
|
}
|
||||||
|
|
||||||
qname := req.Question[0].Name
|
qname := req.Question[0].Name
|
||||||
|
|
||||||
res := make(chan *dns.Msg, 1)
|
res := make(chan *dns.Msg, 1)
|
||||||
|
|
|
@ -37,6 +37,7 @@ type ResolvSettings struct {
|
||||||
ResolvFile string `toml:"resolv-file"`
|
ResolvFile string `toml:"resolv-file"`
|
||||||
Timeout int
|
Timeout int
|
||||||
Interval int
|
Interval int
|
||||||
|
SetEDNS0 bool
|
||||||
}
|
}
|
||||||
|
|
||||||
type DNSServerSettings struct {
|
type DNSServerSettings struct {
|
||||||
|
|
Loading…
Reference in New Issue