diff --git a/proxy/freedom/freedom.go b/proxy/freedom/freedom.go index 9429e27a..d107e357 100644 --- a/proxy/freedom/freedom.go +++ b/proxy/freedom/freedom.go @@ -211,7 +211,7 @@ func (h *Handler) Process(ctx context.Context, link *transport.Link, dialer inte responseDone := func() error { 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 inTimer *signal.ActivityTimer if inbound := session.InboundFromContext(ctx); inbound != nil && inbound.Conn != nil { diff --git a/proxy/http/server.go b/proxy/http/server.go index 12a5292c..44f5a102 100644 --- a/proxy/http/server.go +++ b/proxy/http/server.go @@ -96,7 +96,7 @@ func (s *Server) ProcessWithFirstbyte(ctx context.Context, network net.Network, inbound.User = &protocol.MemoryUser{ Level: s.config.UserLevel, } - if !proxy.IsRAWTransport(conn) { + if !proxy.IsRAWTransportWithoutSecurity(conn) { inbound.CanSpliceCopy = 3 } var reader *bufio.Reader diff --git a/proxy/proxy.go b/proxy/proxy.go index 157493bf..3a1af8f7 100644 --- a/proxy/proxy.go +++ b/proxy/proxy.go @@ -337,7 +337,7 @@ func (w *VisionWriter) WriteMultiBuffer(mb buf.MultiBuffer) error { w.directWriteCounter = writerCounter *switchToDirectCopy = false } - if !mb.IsEmpty() && w.directWriteCounter != nil { + if !mb.IsEmpty() && w.directWriteCounter != nil { 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 } -func IsRAWTransport(conn stat.Connection) bool { +func IsRAWTransportWithoutSecurity(conn stat.Connection) bool { iConn := conn if statConn, ok := iConn.(*stat.CounterConnection); ok { iConn = statConn.Connection diff --git a/proxy/socks/server.go b/proxy/socks/server.go index 166deaa3..455e081f 100644 --- a/proxy/socks/server.go +++ b/proxy/socks/server.go @@ -75,7 +75,7 @@ func (s *Server) Process(ctx context.Context, network net.Network, conn stat.Con inbound.User = &protocol.MemoryUser{ Level: s.config.UserLevel, } - if !proxy.IsRAWTransport(conn) { + if !proxy.IsRAWTransportWithoutSecurity(conn) { inbound.CanSpliceCopy = 3 } diff --git a/proxy/vless/inbound/inbound.go b/proxy/vless/inbound/inbound.go index 54c7e76b..cfe2059d 100644 --- a/proxy/vless/inbound/inbound.go +++ b/proxy/vless/inbound/inbound.go @@ -506,8 +506,8 @@ func (h *Handler) Process(ctx context.Context, network net.Network, connection s var t reflect.Type var p uintptr if commonConn, ok := connection.(*encryption.CommonConn); ok { - if _, ok := commonConn.Conn.(*encryption.XorConn); ok || !proxy.IsRAWTransport(iConn) { - inbound.CanSpliceCopy = 3 // full-random xorConn / non-RAW transport can not use Linux Splice + if _, ok := commonConn.Conn.(*encryption.XorConn); ok || !proxy.IsRAWTransportWithoutSecurity(iConn) { + inbound.CanSpliceCopy = 3 // full-random xorConn / non-RAW transport / another securityConn should not be penetrated } t = reflect.TypeOf(commonConn).Elem() p = uintptr(unsafe.Pointer(commonConn)) diff --git a/proxy/vless/outbound/outbound.go b/proxy/vless/outbound/outbound.go index e04a0e23..58c1646d 100644 --- a/proxy/vless/outbound/outbound.go +++ b/proxy/vless/outbound/outbound.go @@ -166,8 +166,8 @@ func (h *Handler) Process(ctx context.Context, link *transport.Link, dialer inte var t reflect.Type var p uintptr if commonConn, ok := conn.(*encryption.CommonConn); ok { - if _, ok := commonConn.Conn.(*encryption.XorConn); ok || !proxy.IsRAWTransport(iConn) { - ob.CanSpliceCopy = 3 // full-random xorConn / non-RAW transport can not use Linux Splice + if _, ok := commonConn.Conn.(*encryption.XorConn); ok || !proxy.IsRAWTransportWithoutSecurity(iConn) { + ob.CanSpliceCopy = 3 // full-random xorConn / non-RAW transport / another securityConn should not be penetrated } t = reflect.TypeOf(commonConn).Elem() p = uintptr(unsafe.Pointer(commonConn))