mirror of https://github.com/v2ray/v2ray-core
fix transfer for mux
parent
30a0aa6fb0
commit
42d83a703e
|
@ -18,11 +18,14 @@ const (
|
||||||
)
|
)
|
||||||
|
|
||||||
func (c RequestCommand) TransferType() TransferType {
|
func (c RequestCommand) TransferType() TransferType {
|
||||||
if c == RequestCommandTCP {
|
switch c {
|
||||||
|
case RequestCommandTCP, RequestCommandMux:
|
||||||
|
return TransferTypeStream
|
||||||
|
case RequestCommandUDP:
|
||||||
|
return TransferTypePacket
|
||||||
|
default:
|
||||||
return TransferTypeStream
|
return TransferTypeStream
|
||||||
}
|
}
|
||||||
|
|
||||||
return TransferTypePacket
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|
|
@ -131,7 +131,7 @@ func (c *ClientSession) EncodeRequestBody(request *protocol.RequestHeader, write
|
||||||
}
|
}
|
||||||
if request.Security.Is(protocol.SecurityType_NONE) {
|
if request.Security.Is(protocol.SecurityType_NONE) {
|
||||||
if request.Option.Has(protocol.RequestOptionChunkStream) {
|
if request.Option.Has(protocol.RequestOptionChunkStream) {
|
||||||
if request.Command == protocol.RequestCommandTCP {
|
if request.Command.TransferType() == protocol.TransferTypeStream {
|
||||||
return crypto.NewChunkStreamWriter(sizeParser, writer)
|
return crypto.NewChunkStreamWriter(sizeParser, writer)
|
||||||
}
|
}
|
||||||
auth := &crypto.AEADAuthenticator{
|
auth := &crypto.AEADAuthenticator{
|
||||||
|
@ -236,7 +236,7 @@ func (c *ClientSession) DecodeResponseBody(request *protocol.RequestHeader, read
|
||||||
}
|
}
|
||||||
if request.Security.Is(protocol.SecurityType_NONE) {
|
if request.Security.Is(protocol.SecurityType_NONE) {
|
||||||
if request.Option.Has(protocol.RequestOptionChunkStream) {
|
if request.Option.Has(protocol.RequestOptionChunkStream) {
|
||||||
if request.Command == protocol.RequestCommandTCP {
|
if request.Command.TransferType() == protocol.TransferTypeStream {
|
||||||
return crypto.NewChunkStreamReader(sizeParser, reader)
|
return crypto.NewChunkStreamReader(sizeParser, reader)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -252,7 +252,7 @@ func (s *ServerSession) DecodeRequestBody(request *protocol.RequestHeader, reade
|
||||||
}
|
}
|
||||||
if request.Security.Is(protocol.SecurityType_NONE) {
|
if request.Security.Is(protocol.SecurityType_NONE) {
|
||||||
if request.Option.Has(protocol.RequestOptionChunkStream) {
|
if request.Option.Has(protocol.RequestOptionChunkStream) {
|
||||||
if request.Command == protocol.RequestCommandTCP {
|
if request.Command.TransferType() == protocol.TransferTypeStream {
|
||||||
return crypto.NewChunkStreamReader(sizeParser, reader)
|
return crypto.NewChunkStreamReader(sizeParser, reader)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -338,7 +338,7 @@ func (s *ServerSession) EncodeResponseBody(request *protocol.RequestHeader, writ
|
||||||
}
|
}
|
||||||
if request.Security.Is(protocol.SecurityType_NONE) {
|
if request.Security.Is(protocol.SecurityType_NONE) {
|
||||||
if request.Option.Has(protocol.RequestOptionChunkStream) {
|
if request.Option.Has(protocol.RequestOptionChunkStream) {
|
||||||
if request.Command == protocol.RequestCommandTCP {
|
if request.Command.TransferType() == protocol.TransferTypeStream {
|
||||||
return crypto.NewChunkStreamWriter(sizeParser, writer)
|
return crypto.NewChunkStreamWriter(sizeParser, writer)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue