mirror of
https://github.com/m13253/dns-over-https.git
synced 2026-08-06 23:49:43 +00:00
Reduce source address reveal
This commit is contained in:
+3
-1
@@ -19,6 +19,7 @@
|
||||
package jsonDNS
|
||||
|
||||
import (
|
||||
"net"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
@@ -77,7 +78,8 @@ func Marshal(msg *dns.Msg) *Response {
|
||||
for _, option := range opt.Option {
|
||||
if option.Option() == dns.EDNS0SUBNET {
|
||||
edns0 := option.(*dns.EDNS0_SUBNET)
|
||||
resp.EdnsClientSubnet = edns0.Address.String() + "/" + strconv.Itoa(int(edns0.SourceScope))
|
||||
scopeMask := net.CIDRMask(int(edns0.SourceScope), len(edns0.Address))
|
||||
resp.EdnsClientSubnet = edns0.Address.Mask(scopeMask).String() + "/" + strconv.Itoa(int(edns0.SourceScope))
|
||||
}
|
||||
}
|
||||
continue
|
||||
|
||||
Reference in New Issue
Block a user