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) + } }