Avoid copying dns.Msg structs containing atomic.Bool
Fixes go vet warning Fixes #3073
This commit is contained in:
parent
b4570051c1
commit
900933db8d
2 changed files with 5 additions and 5 deletions
|
|
@ -15,7 +15,7 @@
|
|||
|
||||
type CachedResponse struct {
|
||||
expiration time.Time
|
||||
msg dns.Msg
|
||||
msg *dns.Msg
|
||||
}
|
||||
|
||||
type CachedResponses struct {
|
||||
|
|
@ -141,7 +141,7 @@ func (plugin *PluginCacheResponse) Eval(pluginsState *PluginsState, msg *dns.Msg
|
|||
)
|
||||
cachedResponse := CachedResponse{
|
||||
expiration: time.Now().Add(ttl),
|
||||
msg: *msg,
|
||||
msg: msg.Copy(),
|
||||
}
|
||||
var cacheInitError error
|
||||
cachedResponses.cacheOnce.Do(func() {
|
||||
|
|
|
|||
|
|
@ -761,7 +761,7 @@ func fetchDNSCryptServerInfo(proxy *Proxy, name string, stamp stamps.ServerStamp
|
|||
msg, _, _, err := DNSExchange(
|
||||
proxy,
|
||||
proxy.xTransport.mainProto,
|
||||
&query,
|
||||
query,
|
||||
stamp.ServerAddrStr,
|
||||
dnscryptRelay,
|
||||
&name,
|
||||
|
|
@ -849,7 +849,7 @@ func dohNXTestPacket(msgID uint16) []byte {
|
|||
return msg.Data
|
||||
}
|
||||
|
||||
func plainNXTestPacket(msgID uint16) dns.Msg {
|
||||
func plainNXTestPacket(msgID uint16) *dns.Msg {
|
||||
qName := make([]byte, 16)
|
||||
charset := "abcdefghijklmnopqrstuvwxyz"
|
||||
for i := range qName {
|
||||
|
|
@ -858,7 +858,7 @@ func plainNXTestPacket(msgID uint16) dns.Msg {
|
|||
msg := dns.NewMsg(string(qName)+".test.dnscrypt.", dns.TypeNS)
|
||||
msg.ID = msgID
|
||||
msg.RecursionDesired = true
|
||||
return *msg
|
||||
return msg
|
||||
}
|
||||
|
||||
func fetchDoHServerInfo(proxy *Proxy, name string, stamp stamps.ServerStamp, isNew bool) (ServerInfo, error) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue