From cb206ddc74766509f57321c48d08ec807b9dfbad Mon Sep 17 00:00:00 2001 From: Kirill Livanov <13822441+kirilllivanov@users.noreply.github.com> Date: Thu, 28 May 2026 21:27:08 +0300 Subject: [PATCH] DNS: Avoid passing domain to WriteTo func (#6163) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://github.com/XTLS/Xray-core/pull/6163#issuecomment-4528771758 --------- Co-authored-by: 风扇滑翔翼 --- app/dns/nameserver_udp.go | 4 ---- proxy/wireguard/client.go | 1 + 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/app/dns/nameserver_udp.go b/app/dns/nameserver_udp.go index 55b825f7..e75f301a 100644 --- a/app/dns/nameserver_udp.go +++ b/app/dns/nameserver_udp.go @@ -131,8 +131,6 @@ func (s *ClassicNameServer) HandleResponse(ctx context.Context, packet *udp_prot newReq.msg = &newMsg s.addPendingRequest(&newReq) b, _ := dns.PackMessage(newReq.msg) - copyDest := net.UDPDestination(s.address.Address, s.address.Port) - b.UDP = ©Dest s.udpServer.Dispatch(toDnsContext(newReq.ctx, s.address.String()), *s.address, b) return } @@ -179,8 +177,6 @@ func (s *ClassicNameServer) sendQuery(ctx context.Context, noResponseErrCh chan< } return } - copyDest := net.UDPDestination(s.address.Address, s.address.Port) - b.UDP = ©Dest s.udpServer.Dispatch(toDnsContext(ctx, s.address.String()), *s.address, b) } } diff --git a/proxy/wireguard/client.go b/proxy/wireguard/client.go index 3ee3a2c5..8a02d89f 100644 --- a/proxy/wireguard/client.go +++ b/proxy/wireguard/client.go @@ -185,6 +185,7 @@ func (h *Handler) Process(ctx context.Context, link *transport.Link, dialer inte } addr = net.IPAddress(ips[dice.Roll(len(ips))]) } + destination.Address = addr var newCtx context.Context var newCancel context.CancelFunc