diff --git a/socks4.go b/socks4.go index c735ff4..6f37f1e 100755 --- a/socks4.go +++ b/socks4.go @@ -4,7 +4,7 @@ import ( "encoding/binary" "fmt" "io" - "log" + //"log" "net" ) @@ -37,13 +37,14 @@ type socks4Conn struct { dial DialFunc } -func (s4 *socks4Conn) Serve(b []byte, n int) { +func (s4 *socks4Conn) Serve(b []byte, n int) (err error) { defer s4.Close() - if err := s4.processRequest(b, n); err != nil { - log.Println(err) + if err = s4.processRequest(b, n); err != nil { + //log.Println(err) return } + return } func (s4 *socks4Conn) Close() { diff --git a/socks5.go b/socks5.go index bd05ace..0919d24 100755 --- a/socks5.go +++ b/socks5.go @@ -4,7 +4,7 @@ import ( "errors" "fmt" "io" - "log" + //"log" "net" //"strconv" "encoding/binary" @@ -56,18 +56,19 @@ type socks5Conn struct { auth AuthService } -func (s5 *socks5Conn) Serve(b []byte, n int) { +func (s5 *socks5Conn) Serve(b []byte, n int) (err error) { defer s5.Close() - if err := s5.handshake(b, n); err != nil { - log.Println(err) + if err = s5.handshake(b, n); err != nil { + //log.Println(err) return } - if err := s5.processRequest(); err != nil { - log.Println(err) + if err = s5.processRequest(); err != nil { + //log.Println(err) return } + return } func (s5 *socks5Conn) handshake(buf []byte, n int) (err error) {