Browse Source

Copy DNS message struct instead of deep copy

世界 1 year ago
parent
commit
bca0b86549
1 changed files with 2 additions and 1 deletions
  1. 2 1
      outbound/dns.go

+ 2 - 1
outbound/dns.go

@@ -270,7 +270,8 @@ func truncateDNSMessage(response *mDNS.Msg, maxLen int) *mDNS.Msg {
 	if responseLen <= maxLen {
 		return response
 	}
-	response = response.Copy()
+	newResponse := *response
+	response = &newResponse
 	for len(response.Answer) > 0 && responseLen > maxLen {
 		response.Answer = response.Answer[:len(response.Answer)-1]
 		response.Truncated = true