Publish Zonghengjia Windows 0.3.17 client source

This commit is contained in:
2026-11-15 21:33:18 +08:00
parent 36de255318
commit ebec81ceb1
25 changed files with 3745 additions and 3412 deletions
+22 -8
View File
@@ -176,7 +176,12 @@ internal sealed partial class MainForm : Form
_updateTimer.Tick += async (_, _) => await CheckForClientUpdateAsync();
_updateTimer.Start();
_trafficTimer.Tick += async (_, _) => await RefreshTrafficAsync();
_healthTimer.Tick += async (_, _) => { await CheckTailnetReadinessAsync(); await MaintainConnectionAsync(); };
_healthTimer.Tick += async (_, _) =>
{
if (_checkingTailnetReadiness) return;
await CheckTailnetReadinessAsync();
await MaintainConnectionAsync();
};
_trafficTimer.Start();
_healthTimer.Start();
InitializeHandover();
@@ -830,7 +835,8 @@ internal sealed partial class MainForm : Form
if (_runtimeRepairRequired) return;
await CheckUplinkAsync();
if (_uplinkChecking || _handover.Pending || _handover.Settling) return;
if (!_wantConnected || _busy || _xray.IsTransitioning || _healthChecking || _exiting || DateTimeOffset.UtcNow < _nextReconnect) return;
if (!_wantConnected || _busy || _xray.IsTransitioning || _healthChecking || _checkingTailnetReadiness
|| _exiting || DateTimeOffset.UtcNow < _nextReconnect) return;
_healthChecking = true;
try
{
@@ -869,6 +875,8 @@ internal sealed partial class MainForm : Form
_tailnetPreference.Failed(_currentNodeSlug, Environment.TickCount64);
_tailnetPreference.CommitDomainFallback();
_transportRetryNodeSlug = _currentNodeSlug;
AppPaths.WriteLog(new TransportDiagnostic("health_recovery",
"tailnet_egress_failed_same_node_domain_fallback", _currentNodeSlug).SafeMessage);
}
else
{
@@ -876,9 +884,10 @@ internal sealed partial class MainForm : Form
if (!ManualSelection) _tailnetPreference.ReleaseDomainFallbackAfterNodeFailure();
}
}
SetConnectionState(false, "链路异常,正在恢复", ManualSelection
? "正在重试手动指定节点,不会切换其他节点"
: "连续检查失败,向 vpn-ai 申请备用工作节点");
var recoveryDetail = _transportRetryNodeSlug is not null
? "内网代理出口持续异常,正在验证同一节点的公网入口"
: ManualSelection ? "正在重试手动指定节点" : "连续检查失败,正在申请备用工作节点";
SetConnectionState(false, "链路异常,正在恢复", recoveryDetail);
await ToggleConnectionAsync(suppressDialogs: true, reconnect: true);
}
catch (OperationCanceledException) { }
@@ -1161,7 +1170,7 @@ internal sealed partial class MainForm : Form
_routeCombo.SelectedItem = profile.RouteModes.FirstOrDefault(route => route.Id == selectedRoute) ?? profile.RouteModes.FirstOrDefault();
_routeReadOnly.Text = _selectionUiConnected ? _routeCombo.Text : "未生效";
_connectButton.Enabled = _availableNodeCount > 0 && !_busy;
RefreshConnectButtonAvailability();
if (_availableNodeCount == 0 && !_wantConnected)
{
SetConnectionState(false, "暂无线上的线路", "请联系管理员检查节点状态");
@@ -1197,8 +1206,7 @@ internal sealed partial class MainForm : Form
_passwordText.ReadOnly = busy;
_loginButton.Text = busy && _loginView.Visible ? status ?? "请稍候…" : "安全登录";
_logoutButton.Enabled = !busy;
_connectButton.Enabled = _connectionAttemptCancellation is { IsCancellationRequested: false }
|| !busy && (_availableNodeCount > 0 || _wantConnected);
RefreshConnectButtonAvailability();
if (_connectionAttemptCancellation is { IsCancellationRequested: false }) _connectButton.Text = "取消连接";
else if (!busy) _connectButton.Text = _selectionUiConnected ? "断开连接" : "连接";
RefreshSelectionControls();
@@ -1208,6 +1216,12 @@ internal sealed partial class MainForm : Form
}
}
private void RefreshConnectButtonAvailability()
{
_connectButton.Enabled = _connectionAttemptCancellation is { IsCancellationRequested: false }
|| !_busy && (_availableNodeCount > 0 || _wantConnected);
}
private void CenterCards()
{
ApplyCompactTypography();