From 36cc5eca25968fd582cb30b7af5b1b20889ab3d0 Mon Sep 17 00:00:00 2001 From: dd dd Date: Fri, 26 Jul 2024 12:39:10 +0200 Subject: [PATCH] removed unwanted connection object. added comment. --- socks5/request.go | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/socks5/request.go b/socks5/request.go index 8c95308..b1d74af 100644 --- a/socks5/request.go +++ b/socks5/request.go @@ -208,18 +208,16 @@ func (s *Server) handleConnect(ctx context.Context, conn net.Conn, req *Request) return fmt.Errorf("failed to send reply: %v", err) } // read - var connR net.Conn if options.MessageType == protocol.MessageConnectReverse { // wait for the connection - connR = <-ch - defer connR.Close() - } else { - connR = target + // in this case, our target needs to be the reversed tcp connection + target = <-ch + defer target.Close() } // Start proxying errCh := make(chan error, 2) - go Proxy(connR, conn, errCh) - go Proxy(conn, connR, errCh) + go Proxy(target, conn, errCh) + go Proxy(conn, target, errCh) // Wait for i := 0; i < 2; i++ {