Skip to content

Commit

Permalink
proxy: imp code
Browse files Browse the repository at this point in the history
  • Loading branch information
Mizzick committed May 17, 2023
1 parent f3f8215 commit 6b19f15
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions proxy/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"github.com/AdguardTeam/dnsproxy/upstream"
glcache "github.com/AdguardTeam/golibs/cache"
"github.com/AdguardTeam/golibs/log"
"github.com/AdguardTeam/golibs/mathutil"
"github.com/miekg/dns"
"golang.org/x/exp/slices"
)
Expand Down Expand Up @@ -533,13 +534,12 @@ func msgToKeyWithSubnet(m *dns.Msg, ecsIP net.IP, mask int) (key []byte) {
key = make([]byte, keyLen)

// Put DO.
if opt := m.IsEdns0(); opt != nil && opt.Do() {
key[0] = 1
} else {
key[0] = 0
}
opt := m.IsEdns0()
key[0] = mathutil.BoolToNumber[byte](opt != nil && opt.Do())

// Put Qtype.
//
// TODO(d.kolyshev): We should put Qtype in key[1:].
binary.BigEndian.PutUint16(key[:], q.Qtype)

// Put Qclass.
Expand Down

0 comments on commit 6b19f15

Please sign in to comment.