diff --git a/transport/socks4/socks4.go b/transport/socks4/socks4.go index c6b2f2db..c06bea20 100644 --- a/transport/socks4/socks4.go +++ b/transport/socks4/socks4.go @@ -91,6 +91,7 @@ func ServerHandshake(rw io.ReadWriter, authenticator auth.Authenticator) (addr s code = RequestGranted } else { code = RequestIdentdMismatched + err = ErrRequestIdentdMismatched } var reply [8]byte @@ -99,7 +100,10 @@ func ServerHandshake(rw io.ReadWriter, authenticator auth.Authenticator) (addr s copy(reply[4:8], dstIP) copy(reply[2:4], dstPort) - _, err = rw.Write(reply[:]) + _, wErr := rw.Write(reply[:]) + if err == nil { + err = wErr + } return }