mirror of
https://github.com/v2fly/v2ray-core.git
synced 2025-01-02 15:36:41 -05:00
more informational error
This commit is contained in:
parent
1dadd54502
commit
e44394ade5
@ -135,16 +135,21 @@ func (s *ServerSession) Handshake(reader io.Reader, writer io.Writer) (*protocol
|
|||||||
}
|
}
|
||||||
|
|
||||||
cmd := buffer.Byte(1)
|
cmd := buffer.Byte(1)
|
||||||
if cmd == cmdTCPBind || (cmd == cmdUDPPort && !s.config.UdpEnabled) {
|
|
||||||
writeSocks5Response(writer, statusCmdNotSupport, net.AnyIP, net.Port(0))
|
|
||||||
return nil, newError("unsupported command: ", cmd)
|
|
||||||
}
|
|
||||||
|
|
||||||
switch cmd {
|
switch cmd {
|
||||||
case cmdTCPConnect:
|
case cmdTCPConnect:
|
||||||
request.Command = protocol.RequestCommandTCP
|
request.Command = protocol.RequestCommandTCP
|
||||||
case cmdUDPPort:
|
case cmdUDPPort:
|
||||||
|
if !s.config.UdpEnabled {
|
||||||
|
writeSocks5Response(writer, statusCmdNotSupport, net.AnyIP, net.Port(0))
|
||||||
|
return nil, newError("UDP is not enabled.")
|
||||||
|
}
|
||||||
request.Command = protocol.RequestCommandUDP
|
request.Command = protocol.RequestCommandUDP
|
||||||
|
case cmdTCPBind:
|
||||||
|
writeSocks5Response(writer, statusCmdNotSupport, net.AnyIP, net.Port(0))
|
||||||
|
return nil, newError("TCP bind is not supported.")
|
||||||
|
default:
|
||||||
|
writeSocks5Response(writer, statusCmdNotSupport, net.AnyIP, net.Port(0))
|
||||||
|
return nil, newError("unknown command ", cmd)
|
||||||
}
|
}
|
||||||
|
|
||||||
buffer.Clear()
|
buffer.Clear()
|
||||||
|
Loading…
Reference in New Issue
Block a user