From 07a658ae0e319ea45fd07cb2b1bdd5fe588604fb Mon Sep 17 00:00:00 2001 From: Jason Date: Sun, 11 Aug 2019 21:30:32 +0800 Subject: [PATCH] set conn deadline --- proxy/socks/tcp.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/proxy/socks/tcp.go b/proxy/socks/tcp.go index c73f48f..91a5a13 100644 --- a/proxy/socks/tcp.go +++ b/proxy/socks/tcp.go @@ -54,6 +54,8 @@ func (h *tcpHandler) relay(localConn, remoteConn net.Conn) { if _, err := io.Copy(remoteConn, localConn); err != nil { closeOnce() } else { + localConn.SetDeadline(time.Now()) + remoteConn.SetDeadline(time.Now()) tcpCloseRead(localConn) tcpCloseWrite(remoteConn) } @@ -64,6 +66,8 @@ func (h *tcpHandler) relay(localConn, remoteConn net.Conn) { if _, err := io.Copy(localConn, remoteConn); err != nil { closeOnce() } else { + localConn.SetDeadline(time.Now()) + remoteConn.SetDeadline(time.Now()) tcpCloseRead(remoteConn) tcpCloseWrite(localConn) }