Use dns.DefaultMsgSize instead of magic number 4096

This commit is contained in:
Star Brilliant
2018-04-25 03:04:31 +08:00
parent dc14a70e9d
commit 874a3613e4
5 changed files with 5 additions and 5 deletions
+1 -1
View File
@@ -150,7 +150,7 @@ func (s *Server) parseRequestGoogle(w http.ResponseWriter, r *http.Request) *DNS
opt := new(dns.OPT)
opt.Hdr.Name = "."
opt.Hdr.Rrtype = dns.TypeOPT
opt.SetUDPSize(4096)
opt.SetUDPSize(dns.DefaultMsgSize)
opt.SetDo(true)
if ednsClientAddress != nil {
edns0Subnet := new(dns.EDNS0_SUBNET)
+1 -1
View File
@@ -93,7 +93,7 @@ func (s *Server) parseRequestIETF(w http.ResponseWriter, r *http.Request) *DNSRe
opt = new(dns.OPT)
opt.Hdr.Name = "."
opt.Hdr.Rrtype = dns.TypeOPT
opt.SetUDPSize(4096)
opt.SetUDPSize(dns.DefaultMsgSize)
opt.SetDo(false)
msg.Extra = append(msg.Extra, opt)
}
+1 -1
View File
@@ -58,7 +58,7 @@ func NewServer(conf *config) (s *Server) {
conf: conf,
udpClient: &dns.Client{
Net: "udp",
UDPSize: 4096,
UDPSize: dns.DefaultMsgSize,
Timeout: time.Duration(conf.Timeout) * time.Second,
},
tcpClient: &dns.Client{