mirror of
https://github.com/m13253/dns-over-https.git
synced 2026-03-30 12:05:38 +00:00
Use dns.DefaultMsgSize instead of magic number 4096
This commit is contained in:
@@ -72,7 +72,7 @@ func NewClient(conf *config) (c *Client, err error) {
|
||||
Addr: addr,
|
||||
Net: "udp",
|
||||
Handler: udpHandler,
|
||||
UDPSize: 4096,
|
||||
UDPSize: dns.DefaultMsgSize,
|
||||
})
|
||||
c.tcpServers = append(c.tcpServers, &dns.Server{
|
||||
Addr: addr,
|
||||
|
||||
@@ -73,7 +73,7 @@ func (c *Client) generateRequestIETF(w dns.ResponseWriter, r *dns.Msg, isTCP boo
|
||||
opt = new(dns.OPT)
|
||||
opt.Hdr.Name = "."
|
||||
opt.Hdr.Rrtype = dns.TypeOPT
|
||||
opt.SetUDPSize(4096)
|
||||
opt.SetUDPSize(dns.DefaultMsgSize)
|
||||
opt.SetDo(false)
|
||||
r.Extra = append(r.Extra, opt)
|
||||
} else {
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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{
|
||||
|
||||
Reference in New Issue
Block a user