Put EDNS0 at the beginning of the OPT section

This commit is contained in:
Star Brilliant
2018-04-25 03:05:06 +08:00
parent 874a3613e4
commit 5afdee6315
2 changed files with 2 additions and 2 deletions

View File

@@ -75,7 +75,7 @@ func (c *Client) generateRequestIETF(w dns.ResponseWriter, r *dns.Msg, isTCP boo
opt.Hdr.Rrtype = dns.TypeOPT
opt.SetUDPSize(dns.DefaultMsgSize)
opt.SetDo(false)
r.Extra = append(r.Extra, opt)
r.Extra = append([]dns.RR{opt}, r.Extra...)
} else {
udpSize = opt.UDPSize()
}

View File

@@ -95,7 +95,7 @@ func (s *Server) parseRequestIETF(w http.ResponseWriter, r *http.Request) *DNSRe
opt.Hdr.Rrtype = dns.TypeOPT
opt.SetUDPSize(dns.DefaultMsgSize)
opt.SetDo(false)
msg.Extra = append(msg.Extra, opt)
msg.Extra = append([]dns.RR{opt}, msg.Extra...)
}
var edns0Subnet *dns.EDNS0_SUBNET
for _, option := range opt.Option {