proxy/proxy.go: IsRAWTransport() -> IsRAWTransportWithoutSecurity()

dependabot/github_actions/actions/github-script-8
RPRX 2025-09-02 18:15:08 +00:00 committed by GitHub
parent 4064f8dd80
commit e943de5300
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 9 additions and 9 deletions

View File

@ -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 {

View File

@ -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

View File

@ -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

View File

@ -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
} }

View File

@ -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))

View File

@ -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))