Fixed: close connection when read target error

This commit is contained in:
Dreamacro 2018-06-12 09:18:15 +08:00
parent 4f769debe7
commit 795557a2df

View File

@ -36,7 +36,8 @@ func NewSocksProxy(port string) {
func handleSocks(conn net.Conn) { func handleSocks(conn net.Conn) {
target, err := socks.Handshake(conn) target, err := socks.Handshake(conn)
if err != nil { if err != nil {
conn.Close()
return
} }
conn.(*net.TCPConn).SetKeepAlive(true) conn.(*net.TCPConn).SetKeepAlive(true)
tun.Add(NewSocks(target, conn)) tun.Add(NewSocks(target, conn))