From be61ca64d4d00248cdf08a519b88e93881f6d0e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=96=E7=95=8C?= Date: Tue, 12 Sep 2023 13:25:50 +0800 Subject: [PATCH] Fix SOCKS outbound --- outbound/socks.go | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/outbound/socks.go b/outbound/socks.go index 58f4d7f9..ab26fd3f 100644 --- a/outbound/socks.go +++ b/outbound/socks.go @@ -113,9 +113,17 @@ func (h *Socks) ListenPacket(ctx context.Context, destination M.Socksaddr) (net. } func (h *Socks) NewConnection(ctx context.Context, conn net.Conn, metadata adapter.InboundContext) error { - return NewDirectConnection(ctx, h.router, h, conn, metadata) + if h.resolve { + return NewDirectConnection(ctx, h.router, h, conn, metadata) + } else { + return NewConnection(ctx, h, conn, metadata) + } } func (h *Socks) NewPacketConnection(ctx context.Context, conn N.PacketConn, metadata adapter.InboundContext) error { - return NewDirectPacketConnection(ctx, h.router, h, conn, metadata) + if h.resolve { + return NewDirectPacketConnection(ctx, h.router, h, conn, metadata) + } else { + return NewPacketConnection(ctx, h, conn, metadata) + } }