Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

socks4(a) client broken #1967

Closed
dyhkwong opened this issue Sep 10, 2022 · 0 comments
Closed

socks4(a) client broken #1967

dyhkwong opened this issue Sep 10, 2022 · 0 comments

Comments

@dyhkwong
Copy link
Contributor

PR #1269 claims to have added socks4/4a client support. However, no matter what socks version is specified, it is actually always socks5 because it handshakes with ClientHandshake but ClientHandshake is for socks5 only. We need a different handshake function for socks4(a).

udpRequest, err := ClientHandshake(request, conn, conn)

func ClientHandshake(request *protocol.RequestHeader, reader io.Reader, writer io.Writer) (*protocol.RequestHeader, error) {
authByte := byte(authNotRequired)
if request.User != nil {
authByte = byte(authPassword)
}
b := buf.New()
defer b.Release()
common.Must2(b.Write([]byte{socks5Version, 0x01, authByte}))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant