mirror of https://github.com/XTLS/Xray-core
proxy/proxy.go: IsRAWTransport() -> IsRAWTransportWithoutSecurity()
parent
4064f8dd80
commit
e943de5300
|
@ -211,7 +211,7 @@ func (h *Handler) Process(ctx context.Context, link *transport.Link, dialer inte
|
||||||
|
|
||||||
responseDone := func() error {
|
responseDone := func() error {
|
||||||
defer timer.SetTimeout(plcy.Timeouts.UplinkOnly)
|
defer timer.SetTimeout(plcy.Timeouts.UplinkOnly)
|
||||||
if destination.Network == net.Network_TCP && useSplice && proxy.IsRAWTransport(conn) { // it would be tls conn in special use case of MITM, we need to let link handle traffic
|
if destination.Network == net.Network_TCP && useSplice && proxy.IsRAWTransportWithoutSecurity(conn) { // it would be tls conn in special use case of MITM, we need to let link handle traffic
|
||||||
var writeConn net.Conn
|
var writeConn net.Conn
|
||||||
var inTimer *signal.ActivityTimer
|
var inTimer *signal.ActivityTimer
|
||||||
if inbound := session.InboundFromContext(ctx); inbound != nil && inbound.Conn != nil {
|
if inbound := session.InboundFromContext(ctx); inbound != nil && inbound.Conn != nil {
|
||||||
|
|
|
@ -96,7 +96,7 @@ func (s *Server) ProcessWithFirstbyte(ctx context.Context, network net.Network,
|
||||||
inbound.User = &protocol.MemoryUser{
|
inbound.User = &protocol.MemoryUser{
|
||||||
Level: s.config.UserLevel,
|
Level: s.config.UserLevel,
|
||||||
}
|
}
|
||||||
if !proxy.IsRAWTransport(conn) {
|
if !proxy.IsRAWTransportWithoutSecurity(conn) {
|
||||||
inbound.CanSpliceCopy = 3
|
inbound.CanSpliceCopy = 3
|
||||||
}
|
}
|
||||||
var reader *bufio.Reader
|
var reader *bufio.Reader
|
||||||
|
|
|
@ -337,7 +337,7 @@ func (w *VisionWriter) WriteMultiBuffer(mb buf.MultiBuffer) error {
|
||||||
w.directWriteCounter = writerCounter
|
w.directWriteCounter = writerCounter
|
||||||
*switchToDirectCopy = false
|
*switchToDirectCopy = false
|
||||||
}
|
}
|
||||||
if !mb.IsEmpty() && w.directWriteCounter != nil {
|
if !mb.IsEmpty() && w.directWriteCounter != nil {
|
||||||
w.directWriteCounter.Add(int64(mb.Len()))
|
w.directWriteCounter.Add(int64(mb.Len()))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -725,7 +725,7 @@ func readV(ctx context.Context, reader buf.Reader, writer buf.Writer, timer sign
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func IsRAWTransport(conn stat.Connection) bool {
|
func IsRAWTransportWithoutSecurity(conn stat.Connection) bool {
|
||||||
iConn := conn
|
iConn := conn
|
||||||
if statConn, ok := iConn.(*stat.CounterConnection); ok {
|
if statConn, ok := iConn.(*stat.CounterConnection); ok {
|
||||||
iConn = statConn.Connection
|
iConn = statConn.Connection
|
||||||
|
|
|
@ -75,7 +75,7 @@ func (s *Server) Process(ctx context.Context, network net.Network, conn stat.Con
|
||||||
inbound.User = &protocol.MemoryUser{
|
inbound.User = &protocol.MemoryUser{
|
||||||
Level: s.config.UserLevel,
|
Level: s.config.UserLevel,
|
||||||
}
|
}
|
||||||
if !proxy.IsRAWTransport(conn) {
|
if !proxy.IsRAWTransportWithoutSecurity(conn) {
|
||||||
inbound.CanSpliceCopy = 3
|
inbound.CanSpliceCopy = 3
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -506,8 +506,8 @@ func (h *Handler) Process(ctx context.Context, network net.Network, connection s
|
||||||
var t reflect.Type
|
var t reflect.Type
|
||||||
var p uintptr
|
var p uintptr
|
||||||
if commonConn, ok := connection.(*encryption.CommonConn); ok {
|
if commonConn, ok := connection.(*encryption.CommonConn); ok {
|
||||||
if _, ok := commonConn.Conn.(*encryption.XorConn); ok || !proxy.IsRAWTransport(iConn) {
|
if _, ok := commonConn.Conn.(*encryption.XorConn); ok || !proxy.IsRAWTransportWithoutSecurity(iConn) {
|
||||||
inbound.CanSpliceCopy = 3 // full-random xorConn / non-RAW transport can not use Linux Splice
|
inbound.CanSpliceCopy = 3 // full-random xorConn / non-RAW transport / another securityConn should not be penetrated
|
||||||
}
|
}
|
||||||
t = reflect.TypeOf(commonConn).Elem()
|
t = reflect.TypeOf(commonConn).Elem()
|
||||||
p = uintptr(unsafe.Pointer(commonConn))
|
p = uintptr(unsafe.Pointer(commonConn))
|
||||||
|
|
|
@ -166,8 +166,8 @@ func (h *Handler) Process(ctx context.Context, link *transport.Link, dialer inte
|
||||||
var t reflect.Type
|
var t reflect.Type
|
||||||
var p uintptr
|
var p uintptr
|
||||||
if commonConn, ok := conn.(*encryption.CommonConn); ok {
|
if commonConn, ok := conn.(*encryption.CommonConn); ok {
|
||||||
if _, ok := commonConn.Conn.(*encryption.XorConn); ok || !proxy.IsRAWTransport(iConn) {
|
if _, ok := commonConn.Conn.(*encryption.XorConn); ok || !proxy.IsRAWTransportWithoutSecurity(iConn) {
|
||||||
ob.CanSpliceCopy = 3 // full-random xorConn / non-RAW transport can not use Linux Splice
|
ob.CanSpliceCopy = 3 // full-random xorConn / non-RAW transport / another securityConn should not be penetrated
|
||||||
}
|
}
|
||||||
t = reflect.TypeOf(commonConn).Elem()
|
t = reflect.TypeOf(commonConn).Elem()
|
||||||
p = uintptr(unsafe.Pointer(commonConn))
|
p = uintptr(unsafe.Pointer(commonConn))
|
||||||
|
|
Loading…
Reference in New Issue