mirror of
https://github.com/v2fly/v2ray-core.git
synced 2025-01-20 16:26:23 -05:00
fix error propagation in vmess server
This commit is contained in:
parent
cdfbd0317f
commit
80a1e73361
@ -195,7 +195,7 @@ func (s *ServerSession) DecodeRequestHeader(reader io.Reader) (*protocol.Request
|
||||
// 1 bytes reserved
|
||||
request.Command = protocol.RequestCommand(buffer.Byte(37))
|
||||
|
||||
invalidRequest := false
|
||||
var invalidRequestErr error
|
||||
switch request.Command {
|
||||
case protocol.RequestCommandMux:
|
||||
request.Address = net.DomainAddress("v1.mux.cool")
|
||||
@ -205,18 +205,17 @@ func (s *ServerSession) DecodeRequestHeader(reader io.Reader) (*protocol.Request
|
||||
request.Address = addr
|
||||
request.Port = port
|
||||
} else {
|
||||
invalidRequest = true
|
||||
newError("failed to read address").Base(err).WriteToLog()
|
||||
invalidRequestErr = newError("invalid address").Base(err)
|
||||
}
|
||||
default:
|
||||
invalidRequest = true
|
||||
invalidRequestErr = newError("invalid request command: ", request.Command)
|
||||
}
|
||||
|
||||
if invalidRequest {
|
||||
if invalidRequestErr != nil {
|
||||
randomLen := dice.Roll(32) + 1
|
||||
// Read random number of bytes for prevent detection.
|
||||
buffer.AppendSupplier(buf.ReadFullFrom(decryptor, randomLen))
|
||||
return nil, newError("invalid request")
|
||||
return nil, invalidRequestErr
|
||||
}
|
||||
|
||||
if padingLen > 0 {
|
||||
|
Loading…
Reference in New Issue
Block a user