diff --git a/godns.conf b/godns.conf index 5a23165..9a5e1d4 100644 --- a/godns.conf +++ b/godns.conf @@ -18,6 +18,8 @@ timeout = 5 # 5 seconds # Match the PR15, https://github.com/kenshinx/godns/pull/15 interval = 200 # 200 milliseconds +setedns0 = false #Support for larger UDP DNS responses + [redis] host = "127.0.0.1" port = 6379 diff --git a/resolver.go b/resolver.go index 2cac6bd..e20b9d8 100644 --- a/resolver.go +++ b/resolver.go @@ -34,6 +34,10 @@ func (r *Resolver) Lookup(net string, req *dns.Msg) (message *dns.Msg, err error WriteTimeout: r.Timeout(), } + if net == "udp" && settings.ResolvConfig.SetEDNS0 { + req = req.SetEdns0(65535, true) + } + qname := req.Question[0].Name res := make(chan *dns.Msg, 1) diff --git a/settings.go b/settings.go index d1a5dfa..2f8d22c 100644 --- a/settings.go +++ b/settings.go @@ -37,6 +37,7 @@ type ResolvSettings struct { ResolvFile string `toml:"resolv-file"` Timeout int Interval int + SetEDNS0 bool } type DNSServerSettings struct {