MCPcopy
hub / github.com/AdguardTeam/dnsproxy / add

Method add

proxy/recursiondetector.go:54–67  ·  view source on GitHub ↗

add caches the msg if it has anything in the questions section.

(msg *dns.Msg)

Source from the content-addressed store, hash-verified

52
53// add caches the msg if it has anything in the questions section.
54func (rd *recursionDetector) add(msg *dns.Msg) {
55 now := time.Now()
56
57 if len(msg.Question) == 0 {
58 return
59 }
60
61 key := msgToSignature(msg)
62 expire64 := uint64(now.Add(rd.ttl).UnixNano())
63 expire := make([]byte, uint64sz)
64 binary.BigEndian.PutUint64(expire, expire64)
65
66 rd.recentRequests.Set(key, expire)
67}
68
69// clear clears the recent requests cache.
70func (rd *recursionDetector) clear() {

Callers 3

replyFromUpstreamMethod · 0.80

Calls 2

msgToSignatureFunction · 0.85
SetMethod · 0.45

Tested by 2