Fix tun GSO check

This commit is contained in:
世界
2026-10-02 18:00:09 +08:00
parent 021e0877a3
commit 0efa644942
3 changed files with 2 additions and 11 deletions
-5
View File
@@ -4,7 +4,6 @@ import (
"context"
"net"
"net/netip"
"slices"
"strings"
"github.com/sagernet/sing-box/adapter"
@@ -33,10 +32,6 @@ type endpointBase struct {
logger log.ContextLogger
}
func (e *endpointBase) SupportsFlow(network string) bool {
return slices.Contains(e.Network(), network)
}
func (e *endpointBase) newConnection(ctx context.Context, endpoint adapter.Endpoint, localAddresses []netip.Prefix, conn net.Conn, source M.Socksaddr, destination M.Socksaddr, onClose N.CloseHandlerFunc) {
var metadata adapter.InboundContext
metadata.Inbound = endpoint.Tag()
-4
View File
@@ -38,10 +38,6 @@ type endpointBase struct {
logger log.ContextLogger
}
func (e *endpointBase) SupportsFlow(network string) bool {
return slices.Contains(e.Network(), network)
}
func (e *endpointBase) newConnection(ctx context.Context, endpoint adapter.Endpoint, localAddresses []netip.Prefix, conn net.Conn, source M.Socksaddr, destination M.Socksaddr, onClose N.CloseHandlerFunc) {
var metadata adapter.InboundContext
metadata.Inbound = endpoint.Tag()
+2 -2
View File
@@ -342,7 +342,7 @@ func (t *Inbound) Start(stage adapter.StartStage) error {
outboundManager := service.FromContext[adapter.OutboundManager](t.ctx)
endpointManager := service.FromContext[adapter.EndpointManager](t.ctx)
for _, outbound := range outboundManager.Outbounds() {
if _, isFlowOutbound := outbound.(adapter.FlowOutbound); isFlowOutbound && common.Contains(outbound.Network(), N.NetworkTCP) {
if flowOutbound, isFlowOutbound := outbound.(adapter.FlowOutbound); isFlowOutbound && flowOutbound.PreMatchFlow(N.NetworkTCP, netip.Addr{}) == adapter.PreMatchFlow {
if C.IsLinux {
t.tunOptions.GSO = true
} else {
@@ -352,7 +352,7 @@ func (t *Inbound) Start(stage adapter.StartStage) error {
}
}
for _, endpoint := range endpointManager.Endpoints() {
if _, isFlowOutbound := endpoint.(adapter.FlowOutbound); isFlowOutbound && common.Contains(endpoint.Network(), N.NetworkTCP) {
if flowOutbound, isFlowOutbound := endpoint.(adapter.FlowOutbound); isFlowOutbound && flowOutbound.PreMatchFlow(N.NetworkTCP, netip.Addr{}) == adapter.PreMatchFlow {
if C.IsLinux {
t.tunOptions.GSO = true
} else {