From e531e89b4b6c7461bf66b16b85b29f8b617c7625 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=96=E7=95=8C?= Date: Fri, 22 Jul 2022 14:25:04 +0800 Subject: [PATCH] Fix dns inbound --- inbound/dns.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/inbound/dns.go b/inbound/dns.go index 39f9fe27..dbb11f52 100644 --- a/inbound/dns.go +++ b/inbound/dns.go @@ -49,7 +49,10 @@ func (d *DNS) NewConnection(ctx context.Context, conn net.Conn, metadata adapter func (d *DNS) NewPacket(ctx context.Context, conn N.PacketConn, buffer *buf.Buffer, metadata adapter.InboundContext) error { d.udpNat.NewContextPacket(ctx, metadata.Source.AddrPort(), buffer, adapter.UpstreamMetadata(metadata), func(natConn N.PacketConn) (context.Context, N.PacketWriter) { - return adapter.WithContext(log.ContextWithNewID(ctx), &metadata), natConn + return adapter.WithContext(log.ContextWithNewID(ctx), &metadata), &udpnat.DirectBackWriter{ + Source: conn, + Nat: natConn, + } }) return nil }