mirror of
https://github.com/XTLS/Xray-core.git
synced 2024-11-22 23:13:01 +00:00
Fix VLESS client doesn't handle traffic if not send data first
Certain ssh, mySQL and reverse proxy need server data first in a connection
This commit is contained in:
parent
3e4e050313
commit
bc4de6a026
@ -442,7 +442,7 @@ func XtlsFilterTls(buffer buf.MultiBuffer, numberOfPacketToFilter *int, enableXt
|
||||
*numberOfPacketToFilter = 0
|
||||
return
|
||||
}
|
||||
newError("XtlsFilterTls inclusive server hello ", b.Len(), " ", *remainingServerHello).WriteToLog(session.ExportIDToError(ctx))
|
||||
newError("XtlsFilterTls inconclusive server hello ", b.Len(), " ", *remainingServerHello).WriteToLog(session.ExportIDToError(ctx))
|
||||
}
|
||||
if *numberOfPacketToFilter <= 0 {
|
||||
newError("XtlsFilterTls stop filtering", buffer.Len()).WriteToLog(session.ExportIDToError(ctx))
|
||||
|
@ -5,6 +5,7 @@ package outbound
|
||||
import (
|
||||
"context"
|
||||
"syscall"
|
||||
"time"
|
||||
|
||||
"github.com/xtls/xray-core/common"
|
||||
"github.com/xtls/xray-core/common/buf"
|
||||
@ -217,10 +218,10 @@ func (h *Handler) Process(ctx context.Context, link *transport.Link, dialer inte
|
||||
serverWriter = xudp.NewPacketWriter(serverWriter, target)
|
||||
}
|
||||
userUUID := account.ID.Bytes()
|
||||
multiBuffer, err1 := clientReader.ReadMultiBuffer()
|
||||
if err1 != nil {
|
||||
return err1 // ...
|
||||
}
|
||||
timeoutReader, ok := clientReader.(buf.TimeoutReader)
|
||||
if ok {
|
||||
multiBuffer, err1 := timeoutReader.ReadMultiBufferTimeout(time.Millisecond*500)
|
||||
if err1 == nil {
|
||||
if requestAddons.Flow == vless.XRV {
|
||||
encoding.XtlsFilterTls(multiBuffer, &numberOfPacketToFilter, &enableXtls, &isTLS12orAbove, &isTLS, &cipher, &remainingServerHello, ctx)
|
||||
if isTLS {
|
||||
@ -232,6 +233,12 @@ func (h *Handler) Process(ctx context.Context, link *transport.Link, dialer inte
|
||||
if err := serverWriter.WriteMultiBuffer(multiBuffer); err != nil {
|
||||
return err // ...
|
||||
}
|
||||
} else if err1 != buf.ErrReadTimeout {
|
||||
return err1
|
||||
}
|
||||
} else {
|
||||
newError("Reader is not timeout reader, will send out vless header separately from first payload").AtDebug().WriteToLog(session.ExportIDToError(ctx))
|
||||
}
|
||||
// Flush; bufferWriter.WriteMultiBufer now is bufferWriter.writer.WriteMultiBuffer
|
||||
if err := bufferWriter.SetBuffered(false); err != nil {
|
||||
return newError("failed to write A request payload").Base(err).AtWarning()
|
||||
|
Loading…
Reference in New Issue
Block a user