diff --git a/src/internal/server/server.go b/src/internal/server/server.go index ed6a037..754ae0a 100644 --- a/src/internal/server/server.go +++ b/src/internal/server/server.go @@ -13,6 +13,7 @@ import ( type Server interface { Start() error HandleClient(net.Conn) + ForwardTCP(client, target net.Conn, destAddr string) } func NewServer(cfg *config.Config, rw *rewrite.Rewriter) (Server, error) { diff --git a/src/internal/server/socks5/socks5.go b/src/internal/server/socks5/socks5.go index 509edce..bbb9133 100644 --- a/src/internal/server/socks5/socks5.go +++ b/src/internal/server/socks5/socks5.go @@ -97,7 +97,7 @@ func (s *Server) HandleClient(client net.Conn) { _ = client.Close() return } - s.forwardTCP(client, target, destAddrPort) + s.ForwardTCP(client, target, destAddrPort) } // socks5Auth performs a minimal "no-auth" negotiation. @@ -206,15 +206,15 @@ func (s *Server) socks5Connect(client net.Conn, destAddrPort string) (net.Conn, return target, nil } -// forwardTCP proxies traffic in both directions. +// ForwardTCP proxies traffic in both directions. // target->client uses raw copy. // client->target is processed by the rewriter (or raw if cached). -func (s *Server) forwardTCP(client, target net.Conn, destAddrPort string) { +func (s *Server) ForwardTCP(client, target net.Conn, destAddr string) { // Server -> Client (raw) go utils.CopyHalf(client, target) // Client -> Server (rewriter) - go utils.ProxyHalf(target, client, s.rw, destAddrPort) + go utils.ProxyHalf(target, client, s.rw, destAddr) } // handleUDPAssociate handles a UDP ASSOCIATE request by creating a UDP relay socket.