MCPcopy Index your code
hub / github.com/AdguardTeam/dnsproxy / check

Method check

proxy/recursiondetector.go:37–51  ·  view source on GitHub ↗

check checks if the passed req was already sent by the server.

(msg *dns.Msg)

Source from the content-addressed store, hash-verified

35
36// check checks if the passed req was already sent by the server.
37func (rd *recursionDetector) check(msg *dns.Msg) (ok bool) {
38 if len(msg.Question) == 0 {
39 return false
40 }
41
42 key := msgToSignature(msg)
43 expireData := rd.recentRequests.Get(key)
44 if expireData == nil {
45 return false
46 }
47
48 expire := time.Unix(0, int64(binary.BigEndian.Uint64(expireData)))
49
50 return time.Now().Before(expire)
51}
52
53// add caches the msg if it has anything in the questions section.
54func (rd *recursionDetector) add(msg *dns.Msg) {

Callers 2

validateRequestMethod · 0.80

Calls 1

msgToSignatureFunction · 0.85

Tested by 1