From 54c2c6d5377cd18c4e714738de52e17141d4067e Mon Sep 17 00:00:00 2001 From: dyhkwong <50692134+dyhkwong@users.noreply.github.com> Date: Mon, 20 May 2024 00:09:43 +0800 Subject: [PATCH] Always use a DNS Message ID of 0 for DoH and DoQ --- app/dns/nameserver_doh.go | 4 +--- app/dns/nameserver_quic.go | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/app/dns/nameserver_doh.go b/app/dns/nameserver_doh.go index 6e1430e62..b1889c167 100644 --- a/app/dns/nameserver_doh.go +++ b/app/dns/nameserver_doh.go @@ -11,7 +11,6 @@ import ( "net/http" "net/url" "sync" - "sync/atomic" "time" "golang.org/x/net/dns/dnsmessage" @@ -35,7 +34,6 @@ type DoHNameServer struct { ips map[string]record pub *pubsub.Service cleanup *task.Periodic - reqID uint32 httpClient *http.Client dohURL string name string @@ -204,7 +202,7 @@ func (s *DoHNameServer) updateIP(req *dnsRequest, ipRec *IPRecord) { } func (s *DoHNameServer) newReqID() uint16 { - return uint16(atomic.AddUint32(&s.reqID, 1)) + return 0 } func (s *DoHNameServer) sendQuery(ctx context.Context, domain string, clientIP net.IP, option dns_feature.IPOption) { diff --git a/app/dns/nameserver_quic.go b/app/dns/nameserver_quic.go index 28e692257..7275cb8a2 100644 --- a/app/dns/nameserver_quic.go +++ b/app/dns/nameserver_quic.go @@ -6,7 +6,6 @@ import ( "encoding/binary" "net/url" "sync" - "sync/atomic" "time" "github.com/quic-go/quic-go" @@ -35,7 +34,6 @@ type QUICNameServer struct { ips map[string]record pub *pubsub.Service cleanup *task.Periodic - reqID uint32 name string destination net.Destination connection quic.Connection @@ -149,7 +147,7 @@ func (s *QUICNameServer) updateIP(req *dnsRequest, ipRec *IPRecord) { } func (s *QUICNameServer) newReqID() uint16 { - return uint16(atomic.AddUint32(&s.reqID, 1)) + return 0 } func (s *QUICNameServer) sendQuery(ctx context.Context, domain string, clientIP net.IP, option dns_feature.IPOption) {