Update tcpproxy.go

sending the client's IP address to the listening socket
This commit is contained in:
ただにゃん 2024-01-22 00:48:04 +04:00 committed by GitHub
parent f465d71770
commit 572cd61a2d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -24,6 +24,7 @@ func tcpProxyFunc(mtu uint64, dst, src net.Conn) error {
func ProxyTCP(mtu uint64, c1, c2 net.Conn) error {
// Start proxying
errCh := make(chan error, 2)
c2.Write([]byte(c1.RemoteAddr().String()))
go func() { errCh <- tcpProxyFunc(mtu, c1, c2) }()
go func() { errCh <- tcpProxyFunc(mtu, c2, c1) }()