Browse Source

tweak dns options

pull/1524/head^2
Darien Raymond 6 years ago
parent
commit
463a9cbef8
No known key found for this signature in database
GPG Key ID: 7251FFA14BB18169
  1. 7
      app/dns/udpns.go

7
app/dns/udpns.go

@ -173,17 +173,18 @@ func (s *ClassicNameServer) getMsgOptions() *dns.OPT {
o := new(dns.OPT)
o.Hdr.Name = "."
o.Hdr.Rrtype = dns.TypeOPT
o.SetUDPSize(1280)
o.SetUDPSize(1350)
e := new(dns.EDNS0_SUBNET)
e.Code = dns.EDNS0SUBNET
if len(s.clientIP) == 4 {
e.Family = 1 // 1 for IPv4 source address, 2 for IPv6
e.Family = 1 // 1 for IPv4 source address, 2 for IPv6
e.SourceNetmask = 24 // 32 for IPV4, 128 for IPv6
} else {
e.Family = 2
e.SourceNetmask = 96
}
e.SourceNetmask = 24 // 32 for IPV4, 128 for IPv6
e.SourceScope = 0
e.Address = s.clientIP
o.Option = append(o.Option, e)

Loading…
Cancel
Save