Skip to content

Commit

Permalink
fix(edns): modify SourceNetmask for IPv6 (#260)
Browse files Browse the repository at this point in the history
Google public dns required ipv6 edns `SourceNetmask` to be no more than 56.
  • Loading branch information
tuzi3040 authored May 30, 2021
1 parent fdc65ac commit 1b6ba97
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions core/common/edns.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ func SetEDNSClientSubnet(m *dns.Msg, ip string, isNoCookie bool) {
nes.Address = net.ParseIP(ip)
if nes.Address.To4() != nil {
nes.Family = 1 // 1 for IPv4 source address, 2 for IPv6
nes.SourceNetmask = 24 // 24 for IPV4, 64 for IPv6
nes.SourceNetmask = 24 // 24 for IPV4, 56 for IPv6
} else {
nes.Family = 2 // 1 for IPv4 source address, 2 for IPv6
nes.SourceNetmask = 64 // 24 for IPV4, 64 for IPv6
nes.SourceNetmask = 56 // 24 for IPV4, 56 for IPv6
}
nes.SourceScope = 0
if es != nil && es.Address.IsUnspecified() {
Expand Down

0 comments on commit 1b6ba97

Please sign in to comment.