Skip to content

Commit

Permalink
removed unwanted connection object. added comment.
Browse files Browse the repository at this point in the history
  • Loading branch information
asmogo committed Jul 26, 2024
1 parent 9cfbd23 commit 36cc5ec
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions socks5/request.go
Original file line number Diff line number Diff line change
Expand Up @@ -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++ {
Expand Down

0 comments on commit 36cc5ec

Please sign in to comment.