This commit is contained in:
snltty
2025-01-16 16:08:04 +08:00
parent 67d6bd65ad
commit fd79498ef8
3 changed files with 27 additions and 16 deletions

View File

@@ -21,7 +21,7 @@ namespace linker.libs
{
File.WriteAllText(localAppDataPath, Guid.NewGuid().ToString());
}
string username = CommandHelper.Execute("whoami", string.Empty, [], out string error).TrimNewLineAndWhiteSapce().Trim();
string username = CommandHelper.Execute("whoami", string.Empty, [], out string error).TrimNewLineAndWhiteSapce();
return $"{File.ReadAllText(localAppDataPath)}↓{username}↓{System.Runtime.InteropServices.RuntimeInformation.OSDescription}";
}
private static string GetSystemIdLinux()

View File

@@ -63,23 +63,34 @@ namespace linker.messenger.tuntap
}
private async Task CheckDevice()
{
//开始操作失败,或者网卡正在操作中,或者不需要运行
if (checking.StartOperation() == false || tuntapTransfer.Status == TuntapStatus.Operating || tuntapConfigTransfer.Running == false)
try
{
if (LoggerHelper.Instance.LoggerLevel <= LoggerTypes.DEBUG)
LoggerHelper.Instance.Warning($"tuntap check device continue :start:{checking.StartOperation()},status:{tuntapTransfer.Status},running:{tuntapConfigTransfer.Running}");
return;
}
bool start = checking.StartOperation();
//配置发生变化,或者网卡不可用
if (tuntapConfigTransfer.Version.Eq(configVersion, out ulong version) == false || await tuntapTransfer.CheckAvailable() == false)
{
if (LoggerHelper.Instance.LoggerLevel <= LoggerTypes.DEBUG)
LoggerHelper.Instance.Warning($"tuntap config version changed, restarting device");
configVersion = version;
await RetstartDevice();
//开始操作失败,或者网卡正在操作中,或者不需要运行
if (start == false || tuntapTransfer.Status == TuntapStatus.Operating || tuntapConfigTransfer.Running == false)
{
if (LoggerHelper.Instance.LoggerLevel <= LoggerTypes.DEBUG)
LoggerHelper.Instance.Warning($"tuntap check device continue :start:{start},status:{tuntapTransfer.Status},running:{tuntapConfigTransfer.Running}");
return;
}
//配置发生变化,或者网卡不可用
if (tuntapConfigTransfer.Version.Eq(configVersion, out ulong version) == false || await tuntapTransfer.CheckAvailable() == false)
{
if (LoggerHelper.Instance.LoggerLevel <= LoggerTypes.DEBUG)
LoggerHelper.Instance.Warning($"tuntap config version changed, restarting device");
configVersion = version;
await RetstartDevice();
}
}
catch (Exception)
{
}
finally
{
checking.StopOperation();
}
checking.StopOperation();
}
public async Task Callback(LinkerTunDevicPacket packet)

View File

@@ -1,5 +1,5 @@
v1.6.5
2025-01-16 15:41:19
2025-01-16 16:08:04
1. 优化网卡启动和检测
2. 优化端口转发检测
3. 增加重置管理接口密码功能