diff --git a/v2rayN/ServiceLib/Global.cs b/v2rayN/ServiceLib/Global.cs index dbf8ed86..48df5d22 100644 --- a/v2rayN/ServiceLib/Global.cs +++ b/v2rayN/ServiceLib/Global.cs @@ -429,12 +429,12 @@ namespace ServiceLib "fakedns+others" ]; - public static readonly List TunMtus = + public static readonly List TunMtus = [ - "1280", - "1408", - "1500", - "9000" + 1280, + 1408, + 1500, + 9000 ]; public static readonly List TunStacks = diff --git a/v2rayN/ServiceLib/Handler/ConfigHandler.cs b/v2rayN/ServiceLib/Handler/ConfigHandler.cs index 03f16d48..4232496e 100644 --- a/v2rayN/ServiceLib/Handler/ConfigHandler.cs +++ b/v2rayN/ServiceLib/Handler/ConfigHandler.cs @@ -725,7 +725,7 @@ namespace ServiceLib.Handler profileItem.Network = string.Empty; if (profileItem.ShortId.IsNullOrEmpty()) { - profileItem.ShortId = Global.TunMtus.FirstOrDefault(); + profileItem.ShortId = Global.TunMtus.First().ToString(); } if (profileItem.Id.IsNullOrEmpty()) diff --git a/v2rayN/ServiceLib/Services/CoreConfig/CoreConfigSingboxService.cs b/v2rayN/ServiceLib/Services/CoreConfig/CoreConfigSingboxService.cs index 1ad3de13..5afae7d9 100644 --- a/v2rayN/ServiceLib/Services/CoreConfig/CoreConfigSingboxService.cs +++ b/v2rayN/ServiceLib/Services/CoreConfig/CoreConfigSingboxService.cs @@ -599,7 +599,7 @@ namespace ServiceLib.Services.CoreConfig { if (_config.TunModeItem.Mtu <= 0) { - _config.TunModeItem.Mtu = Utils.ToInt(Global.TunMtus.First()); + _config.TunModeItem.Mtu = Global.TunMtus.First(); } if (Utils.IsNullOrEmpty(_config.TunModeItem.Stack)) { @@ -745,7 +745,7 @@ namespace ServiceLib.Services.CoreConfig outbound.peer_public_key = node.PublicKey; outbound.reserved = Utils.String2List(node.Path)?.Select(int.Parse).ToList(); outbound.local_address = Utils.String2List(node.RequestHost); - outbound.mtu = Utils.ToInt(node.ShortId.IsNullOrEmpty() ? Global.TunMtus.FirstOrDefault() : node.ShortId); + outbound.mtu = Utils.ToInt(node.ShortId.IsNullOrEmpty() ? Global.TunMtus.First() : node.ShortId); break; } }