mirror of
https://github.com/XTLS/Xray-core.git
synced 2024-11-26 06:39:20 +02:00
Enable Xtls Vision (Direct not Splice) for any inbound connection
Before this change, Vision client need a pure inbound like socks or http. After this change, it will support any inbound. This is useful in traffic forwarder use case inside China.
This commit is contained in:
parent
143229b148
commit
1d7c40d728
|
@ -260,8 +260,8 @@ func XtlsRead(reader buf.Reader, writer buf.Writer, timer signal.ActivityUpdater
|
||||||
for {
|
for {
|
||||||
if shouldSwitchToDirectCopy {
|
if shouldSwitchToDirectCopy {
|
||||||
shouldSwitchToDirectCopy = false
|
shouldSwitchToDirectCopy = false
|
||||||
if runtime.GOOS == "linux" || runtime.GOOS == "android" {
|
if inbound := session.InboundFromContext(ctx); inbound != nil && inbound.Conn != nil && (runtime.GOOS == "linux" || runtime.GOOS == "android") {
|
||||||
if inbound := session.InboundFromContext(ctx); inbound != nil && inbound.Conn != nil {
|
if _, ok := inbound.User.Account.(*vless.MemoryAccount); inbound.User.Account == nil || ok {
|
||||||
iConn := inbound.Conn
|
iConn := inbound.Conn
|
||||||
statConn, ok := iConn.(*stat.CounterConnection)
|
statConn, ok := iConn.(*stat.CounterConnection)
|
||||||
if ok {
|
if ok {
|
||||||
|
@ -281,11 +281,7 @@ func XtlsRead(reader buf.Reader, writer buf.Writer, timer signal.ActivityUpdater
|
||||||
statConn.WriteCounter.Add(w)
|
statConn.WriteCounter.Add(w)
|
||||||
}
|
}
|
||||||
return err
|
return err
|
||||||
} else {
|
|
||||||
panic("XTLS Splice: not TCP inbound")
|
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
// panic("XTLS Splice: nil inbound or nil inbound.Conn")
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
reader = buf.NewReadVReader(conn, rawConn, nil)
|
reader = buf.NewReadVReader(conn, rawConn, nil)
|
||||||
|
|
Loading…
Reference in New Issue