Improve: Better handling of TCP connections

This commit is contained in:
Dreamacro
2018-08-29 15:00:12 +08:00
parent a5f2bd3152
commit f4c51cdb0e
4 changed files with 10 additions and 4 deletions

View File

@ -44,8 +44,7 @@ func (ss *Socks5) Generator(addr *C.Addr) (adapter C.ProxyAdapter, err error) {
if err != nil {
return nil, fmt.Errorf("%s connect error", ss.addr)
}
c.(*net.TCPConn).SetKeepAlive(true)
tcpKeepAlive(c)
if err := ss.sharkHand(addr, c); err != nil {
return nil, err
}