mirror of https://github.com/v2ray/v2ray-core
compatibility
parent
0be00a1c52
commit
f7e165c114
|
@ -147,16 +147,14 @@ func (server *SocksServer) handleSocks5(reader *v2net.TimeOutReader, writer io.W
|
||||||
|
|
||||||
response.Error = protocol.ErrorSuccess
|
response.Error = protocol.ErrorSuccess
|
||||||
|
|
||||||
response.Port = request.Port
|
// Some SOCKS software requires a value other than dest. Let's fake one:
|
||||||
response.AddrType = request.AddrType
|
response.Port = uint16(38294)
|
||||||
switch response.AddrType {
|
response.AddrType = protocol.AddrTypeIPv4
|
||||||
case protocol.AddrTypeIPv4:
|
response.IPv4[0] = 127
|
||||||
copy(response.IPv4[:], request.IPv4[:])
|
response.IPv4[1] = 0
|
||||||
case protocol.AddrTypeIPv6:
|
response.IPv4[2] = 0
|
||||||
copy(response.IPv6[:], request.IPv6[:])
|
response.IPv4[3] = 1
|
||||||
case protocol.AddrTypeDomain:
|
|
||||||
response.Domain = request.Domain
|
|
||||||
}
|
|
||||||
err = protocol.WriteResponse(writer, response)
|
err = protocol.WriteResponse(writer, response)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error("Socks failed to write response: %v", err)
|
log.Error("Socks failed to write response: %v", err)
|
||||||
|
|
Loading…
Reference in New Issue