Fix tun mtu setting
Some checks are pending
release Linux / build (Release) (push) Waiting to run
release macOS / build (Release) (push) Waiting to run
release Windows desktop (Avalonia UI) / build (Release) (push) Waiting to run
release Windows / build (Release) (push) Waiting to run

This commit is contained in:
2dust 2025-02-26 20:46:31 +08:00
parent 555960e210
commit 98613c43ca
3 changed files with 8 additions and 8 deletions

View file

@ -429,12 +429,12 @@ namespace ServiceLib
"fakedns+others"
];
public static readonly List<string> TunMtus =
public static readonly List<int> TunMtus =
[
"1280",
"1408",
"1500",
"9000"
1280,
1408,
1500,
9000
];
public static readonly List<string> TunStacks =

View file

@ -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())

View file

@ -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;
}
}