tweak dns options

pull/1524/head^2
Darien Raymond 2018-07-02 22:22:04 +02:00
parent bc78e63877
commit 463a9cbef8
No known key found for this signature in database
GPG Key ID: 7251FFA14BB18169
1 changed files with 4 additions and 3 deletions

View File

@ -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)