DNS: Always use a DNS Message ID of 0 for DoH and DoQ (#4193)

Co-authored-by: dyhkwong <50692134+dyhkwong@users.noreply.github.com>
This commit is contained in:
maoxikun 2024-12-22 17:19:09 +08:00 committed by GitHub
parent db934f0832
commit 868799ef04
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 2 additions and 6 deletions

View File

@ -8,7 +8,6 @@ import (
"net/http" "net/http"
"net/url" "net/url"
"sync" "sync"
"sync/atomic"
"time" "time"
"github.com/xtls/xray-core/common" "github.com/xtls/xray-core/common"
@ -35,7 +34,6 @@ type DoHNameServer struct {
ips map[string]*record ips map[string]*record
pub *pubsub.Service pub *pubsub.Service
cleanup *task.Periodic cleanup *task.Periodic
reqID uint32
httpClient *http.Client httpClient *http.Client
dohURL string dohURL string
name string name string
@ -222,7 +220,7 @@ func (s *DoHNameServer) updateIP(req *dnsRequest, ipRec *IPRecord) {
} }
func (s *DoHNameServer) newReqID() uint16 { 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) { func (s *DoHNameServer) sendQuery(ctx context.Context, domain string, clientIP net.IP, option dns_feature.IPOption) {

View File

@ -6,7 +6,6 @@ import (
"encoding/binary" "encoding/binary"
"net/url" "net/url"
"sync" "sync"
"sync/atomic"
"time" "time"
"github.com/xtls/quic-go" "github.com/xtls/quic-go"
@ -37,7 +36,6 @@ type QUICNameServer struct {
ips map[string]*record ips map[string]*record
pub *pubsub.Service pub *pubsub.Service
cleanup *task.Periodic cleanup *task.Periodic
reqID uint32
name string name string
destination *net.Destination destination *net.Destination
connection quic.Connection connection quic.Connection
@ -156,7 +154,7 @@ func (s *QUICNameServer) updateIP(req *dnsRequest, ipRec *IPRecord) {
} }
func (s *QUICNameServer) newReqID() uint16 { 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) { func (s *QUICNameServer) sendQuery(ctx context.Context, domain string, clientIP net.IP, option dns_feature.IPOption) {