From 868799ef043e876338411e150c94cbf922b0bd50 Mon Sep 17 00:00:00 2001 From: maoxikun <106460972+maoxikun@users.noreply.github.com> Date: Sun, 22 Dec 2024 17:19:09 +0800 Subject: [PATCH] DNS: Always use a DNS Message ID of 0 for DoH and DoQ (#4193) Co-authored-by: dyhkwong <50692134+dyhkwong@users.noreply.github.com> --- 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 bc160135..7c25bb8d 100644 --- a/app/dns/nameserver_doh.go +++ b/app/dns/nameserver_doh.go @@ -8,7 +8,6 @@ import ( "net/http" "net/url" "sync" - "sync/atomic" "time" "github.com/xtls/xray-core/common" @@ -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 @@ -222,7 +220,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 5bb8df1d..0691fac9 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/xtls/quic-go" @@ -37,7 +36,6 @@ type QUICNameServer struct { ips map[string]*record pub *pubsub.Service cleanup *task.Periodic - reqID uint32 name string destination *net.Destination connection quic.Connection @@ -156,7 +154,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) {