diff --git a/dns/doh.go b/dns/doh.go index df3df6b4..0a9efe1c 100644 --- a/dns/doh.go +++ b/dns/doh.go @@ -109,6 +109,7 @@ func (doh *dnsOverHTTPS) ExchangeContext(ctx context.Context, m *D.Msg) (msg *D. // formats that include the ID field from the DNS message header, such // as "application/dns-message", SHOULD use a DNS ID of 0 in every DNS // request. + m=m.Copy() id := m.Id m.Id = 0 defer func() { diff --git a/dns/doq.go b/dns/doq.go index 1097b500..1354f177 100644 --- a/dns/doq.go +++ b/dns/doq.go @@ -89,6 +89,7 @@ func (doq *dnsOverQUIC) Address() string { return doq.addr } func (doq *dnsOverQUIC) ExchangeContext(ctx context.Context, m *D.Msg) (msg *D.Msg, err error) { // When sending queries over a QUIC connection, the DNS Message ID MUST be // set to zero. + m = m.Copy() id := m.Id m.Id = 0 defer func() {