mirror of
https://github.com/XTLS/Xray-core.git
synced 2024-11-04 14:13:03 +00:00
Improve the request for UDP Associate in Socks5
This commit is contained in:
parent
59c7c4897c
commit
ceff4185dc
@ -465,9 +465,13 @@ func ClientHandshake(request *protocol.RequestHeader, reader io.Reader, writer i
|
|||||||
command = byte(cmdUDPAssociate)
|
command = byte(cmdUDPAssociate)
|
||||||
}
|
}
|
||||||
common.Must2(b.Write([]byte{socks5Version, command, 0x00 /* reserved */}))
|
common.Must2(b.Write([]byte{socks5Version, command, 0x00 /* reserved */}))
|
||||||
|
if request.Command == protocol.RequestCommandUDP {
|
||||||
|
common.Must2(b.Write([]byte{1, 0, 0, 0, 0, 0, 0 /* RFC 1928 */}))
|
||||||
|
} else {
|
||||||
if err := addrParser.WriteAddressPort(b, request.Address, request.Port); err != nil {
|
if err := addrParser.WriteAddressPort(b, request.Address, request.Port); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if err := buf.WriteAllBytes(writer, b.Bytes()); err != nil {
|
if err := buf.WriteAllBytes(writer, b.Bytes()); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
Loading…
Reference in New Issue
Block a user