From 5b05b5c147d9650e8accb4441e216c72a61f4859 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=96=E7=95=8C?= Date: Mon, 25 Sep 2023 17:28:53 +0800 Subject: [PATCH] Fix socks5 handshake --- protocol/socks/handshake.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/protocol/socks/handshake.go b/protocol/socks/handshake.go index c3556973..cec1bf82 100644 --- a/protocol/socks/handshake.go +++ b/protocol/socks/handshake.go @@ -171,6 +171,9 @@ func HandleConnection0(ctx context.Context, conn net.Conn, version byte, authent if err != nil { return err } + if response.Status != socks5.UsernamePasswordStatusSuccess { + return E.New("socks5: authentication failed, username=", usernamePasswordAuthRequest.Username, ", password=", usernamePasswordAuthRequest.Password) + } } request, err := socks5.ReadRequest(conn) if err != nil {