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

Fix socks5 udp associate address #62

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions protocol/socks/handshake.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ func ClientHandshake5(conn io.ReadWriter, command byte, destination M.Socksaddr,
} else if authResponse.Method != socks5.AuthTypeNotRequired {
return socks5.Response{}, E.New("socks5: unsupported auth method: ", authResponse.Method)
}
if command == socks5.CommandUDPAssociate {
destination = M.SocksaddrFrom(netip.IPv4Unspecified(), 0)
}
err = socks5.WriteRequest(conn, socks5.Request{
Command: command,
Destination: destination,
Expand Down Expand Up @@ -215,6 +218,7 @@ func HandleConnection0(ctx context.Context, conn net.Conn, version byte, authent
if err != nil {
return err
}
request.Destination = M.SocksaddrFrom(netip.IPv4Unspecified(), 0)
metadata.Protocol = "socks5"
metadata.Destination = request.Destination
var innerError error
Expand Down
Loading