|
@@ -132,12 +132,13 @@ func NewInbound(ctx context.Context, router adapter.Router, logger log.ContextLo
|
|
|
|
|
|
platformInterface := service.FromContext[platform.Interface](ctx)
|
|
|
tunMTU := options.MTU
|
|
|
+ enableGSO := C.IsLinux && options.Stack == "gvisor" && platformInterface == nil && tunMTU > 0 && tunMTU < 49152
|
|
|
if tunMTU == 0 {
|
|
|
if platformInterface != nil && platformInterface.UnderNetworkExtension() {
|
|
|
// In Network Extension, when MTU exceeds 4064 (4096-UTUN_IF_HEADROOM_SIZE), the performance of tun will drop significantly, which may be a system bug.
|
|
|
tunMTU = 4064
|
|
|
} else {
|
|
|
- tunMTU = 9000
|
|
|
+ tunMTU = 65535
|
|
|
}
|
|
|
}
|
|
|
var udpTimeout time.Duration
|
|
@@ -189,6 +190,7 @@ func NewInbound(ctx context.Context, router adapter.Router, logger log.ContextLo
|
|
|
tunOptions: tun.Options{
|
|
|
Name: options.InterfaceName,
|
|
|
MTU: tunMTU,
|
|
|
+ GSO: enableGSO,
|
|
|
Inet4Address: inet4Address,
|
|
|
Inet6Address: inet6Address,
|
|
|
AutoRoute: options.AutoRoute,
|