Improve darwin tun performance

This commit is contained in:
世界 committed 2025-07-08 13:14:46 +08:00
1 parent eea1e701b7
commit 6cfa2b8b86
5 files changed
+24 -16

No files matched your search

+7 -2
View File
@@ -130,9 +130,14 @@ func NewInbound(ctx context.Context, router adapter.Router, logger log.ContextLo
deprecated.Report(ctx, deprecated.OptionTUNGSO)
}
platformInterface := service.FromContext[platform.Interface](ctx)
tunMTU := options.MTU
if tunMTU == 0 {
tunMTU = 9000
if platformInterface != nil && platformInterface.UnderNetworkExtension() {
tunMTU = 4000
} else {
tunMTU = 9000
}
}
var udpTimeout time.Duration
if options.UDPTimeout != 0 {
@@ -208,7 +213,7 @@ func NewInbound(ctx context.Context, router adapter.Router, logger log.ContextLo
},
udpTimeout: udpTimeout,
stack: options.Stack,
platformInterface: service.FromContext[platform.Interface](ctx),
platformInterface: platformInterface,
platformOptions: common.PtrValueOrDefault(options.Platform),
}
for _, routeAddressSet := range options.RouteAddressSet {