mirror of
https://github.com/shtorm-7/sing-box-extended.git
synced 2026-10-20 08:14:24 +00:00
Fix tun GSO check
This commit is contained in:
@@ -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()
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user