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/4a client does not work #1968

Closed
dyhkwong opened this issue Sep 10, 2022 · 0 comments · Fixed by #1971
Closed

socks4/4a client does not work #1968

dyhkwong opened this issue Sep 10, 2022 · 0 comments · Fixed by #1971
Labels
bug Something isn't working

Comments

@dyhkwong
Copy link
Contributor

PR #1269 claims to have added socks4/4a client support. However, no matter what socks version specified, it is actually always a socks5 client because it handshakes with ClientHandshake, which 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
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants