Publish Zonghengjia Windows 0.4.1 client source

This commit is contained in:
2026-11-30 13:57:46 +08:00
parent 7a00f97910
commit 859a1dec5e
16 changed files with 307 additions and 23 deletions
+4 -2
View File
@@ -15,10 +15,12 @@ internal sealed class ConnectionHealthPolicy
Revision++;
_advisoryCandidate = null;
}
internal void BeginCore(long now)
internal void BeginCore(long now, int initialGraceMilliseconds = 5_000)
{
if (initialGraceMilliseconds is < 5_000 or > 60_000)
throw new ArgumentOutOfRangeException(nameof(initialGraceMilliseconds));
Invalidate(); Failures = 0; HasBeenHealthy = false;
_nextProbe = now + 5_000;
_nextProbe = now + initialGraceMilliseconds;
}
internal void ResetFailures() => Failures = 0;
internal bool IsDue(long now, bool running) => !running || now >= _nextProbe;
+12
View File
@@ -7,10 +7,22 @@ internal static class ConnectionHealthSelfTest
internal static int Run()
{
var checks = new Dictionary<string, bool>();
checks["startup_accepts_verified_proxy_before_smart_learning_finishes"] =
ConnectionStartupPolicy.Accept(proxyHealthy: true, businessHealthy: false);
checks["startup_rejects_unverified_proxy_even_if_business_probe_is_inconclusive"] =
!ConnectionStartupPolicy.Accept(proxyHealthy: false, businessHealthy: false);
checks["smart_startup_grace_covers_bounded_learning_warmup"] =
ConnectionStartupPolicy.InitialHealthGraceMilliseconds("smart") >= 20_000;
checks["global_startup_keeps_short_health_grace"] =
ConnectionStartupPolicy.InitialHealthGraceMilliseconds("global") == 5_000;
var policy = new ConnectionHealthPolicy();
policy.BeginCore(1_000);
checks["new_core_has_short_background_grace"] = !policy.IsDue(5_999, true) && policy.IsDue(6_000, true);
checks["dead_core_does_not_wait_for_probe_due"] = policy.IsDue(1_001, false);
policy.BeginCore(10_000, ConnectionStartupPolicy.InitialHealthGraceMilliseconds("smart"));
checks["smart_core_is_not_torn_down_while_learning_is_bounded"] =
!policy.IsDue(29_999, true) && policy.IsDue(30_000, true);
policy.BeginCore(1_000);
var revision = policy.Revision;
ConnectionHealthPolicy.Decision Observe(bool healthy, long now, int? core = 10)
=> policy.Observe(policy.Revision, core, core, true, false, false, false, healthy, now);
+16
View File
@@ -0,0 +1,16 @@
namespace UCVL.VPNPlus;
// Initial connection acceptance is transport evidence, not a race against the
// smart-routing learner. Business-site probes continue through the established
// health policy after the verified proxy has been kept alive.
internal static class ConnectionStartupPolicy
{
internal static bool Accept(bool proxyHealthy, bool businessHealthy)
{
_ = businessHealthy; // Advisory after startup; never the initial gate.
return proxyHealthy;
}
internal static int InitialHealthGraceMilliseconds(string routeMode) =>
string.Equals(routeMode, "smart", StringComparison.Ordinal) ? 20_000 : 5_000;
}
+3 -2
View File
@@ -110,8 +110,9 @@ internal sealed partial class MainForm
_historyRangeCombo.DroppedDown = true;
checks["open_selector_does_not_scroll_page"] = !Wheel(_historyRangeCombo, -120) && _dashboardScrollBar.Value == 0;
_historyRangeCombo.DroppedDown = false;
checks["dashboard_uses_scenic_backdrop_and_keeps_login_artwork"] = _dashboardView.DashboardArtwork
&& _dashboardBody.ParentArtwork && _content.LoginArtwork;
checks["dashboard_restores_original_people_artwork"] = _dashboardView.LoginArtwork
&& !_dashboardView.DashboardArtwork && _dashboardBody.ParentArtwork
&& _content.LoginArtwork && ScenicTheme.LoginSceneAvailable;
checks["card_surface_is_half_transparent"] = CardPanel.SurfaceAlpha == 128;
checks["whole_content_composition_disabled"] = !_content.ComposeChildren;
checks["metric_dirty_refresh_clears_previous_digits"] = CheckMetricRefreshPaint();
+4
View File
@@ -73,6 +73,10 @@ internal static class DashboardLayout
}
if (p.TrafficCard != Rectangle.Empty || p.TailnetTrafficCard != Rectangle.Empty) return false;
if (p.ContentHeight > viewport.Height || p.Footer.Bottom > viewport.Height) return false;
if (cards.Any(card => card.Left != p.StatusCard.Left || card.Right != p.StatusCard.Right)) return false;
if (p.NodeCard.Top - p.StatusCard.Bottom != p.SpeedTrendCard.Top - p.NodeCard.Bottom
|| p.DailyCard.Top - (showServers ? p.ServerTrafficCard.Bottom : p.SpeedTrendCard.Bottom) != Sized(4)
|| p.Footer.Top - p.DailyCard.Bottom != Sized(4)) return false;
var baseline = Calculate(viewport, dpi, false, showServers);
if (p.Footer != baseline.Footer || p.ContentHeight != baseline.ContentHeight || p.TrafficCard != baseline.TrafficCard) return false;
if(p.SpeedTrendCard.Width!=p.DailyCard.Width || p.DailyCard.Height>Sized(24))return false;
+8 -1
View File
@@ -79,6 +79,14 @@ internal static class InstallationIntegration
{
stage = InstallationTransaction.Root(stage);
if (isolated) target = InstallationTransaction.IsolatedTarget(target);
using var hive = Hive();
var installedVersion = Read(hive, Key(target, isolated, 1), "DisplayVersion");
if (installedVersion is not null)
{
if (installedVersion.Kind != RegistryValueKind.String)
throw new IOException("当前安装版本登记无效,未修改现有程序。");
InstallationVersionPolicy.RequireNotDowngrade(version, (string)Decode(installedVersion));
}
var components = new List<Component>();
for (var i = 0; i < 3; i++)
{
@@ -96,7 +104,6 @@ internal static class InstallationIntegration
}
components.Add(new(i, InstallationTransaction.Digest(source), previous));
}
using var hive = Hive();
var existed = new bool[2];
for (var i = 0; i < 2; i++) { using var key = hive.OpenSubKey(Key(target, isolated, i)); existed[i] = key is not null; }
// Never redirect another registered installation by trusting /D alone.
+11 -2
View File
@@ -10,7 +10,7 @@ internal static class InstallationIntegrationSelfTest
{
using var hive = RegistryKey.OpenBaseKey(RegistryHive.CurrentUser, RegistryView.Registry32);
var fixtures = new List<string>();
(string Source, string Target) Fixture(bool existing = true)
(string Source, string Target) Fixture(bool existing = true, string installedVersion = "0.3.20")
{
var job = Path.Combine(Path.GetTempPath(), "ucvl-nsis-acceptance-" + Guid.NewGuid().ToString("N"));
var source = Path.Combine(job, "payload"); var target = Path.Combine(job, "installed");
@@ -38,7 +38,7 @@ internal static class InstallationIntegrationSelfTest
app.SetValue("Path", target); app.SetValue("", Path.Combine(target, "VPNPlus.exe"));
app.SetValue("fixture-sentinel", "keep");
using var uninstall = hive.CreateSubKey(InstallationIntegration.Key(target, true, 1));
uninstall.SetValue("DisplayVersion", "old version");
uninstall.SetValue("DisplayVersion", installedVersion);
uninstall.SetValue("Publisher", "%fixture%", RegistryValueKind.ExpandString);
uninstall.SetValue("NoModify", new byte[] { 1, 2, 3 }, RegistryValueKind.Binary);
uninstall.SetValue("NoRepair", 4294967297L, RegistryValueKind.QWord);
@@ -68,6 +68,11 @@ internal static class InstallationIntegrationSelfTest
}
try
{
Assert("version_policy_allows_first_install", InstallationVersionPolicy.CanInstall("0.4.1", null));
Assert("version_policy_allows_same_version_repair", InstallationVersionPolicy.CanInstall("0.4.1", "0.4.1"));
Assert("version_policy_allows_upgrade", InstallationVersionPolicy.CanInstall("0.4.1", "0.4.0"));
Assert("version_policy_rejects_downgrade", !InstallationVersionPolicy.CanInstall("0.3.20", "0.4.0"));
Assert("version_policy_rejects_invalid_candidate", !InstallationVersionPolicy.CanInstall("broken", "0.4.0"));
for (var index = 0; index < 13; index++)
{
var fixture = Fixture(); var before = Snapshot(fixture.Target);
@@ -99,6 +104,10 @@ internal static class InstallationIntegrationSelfTest
File.Delete(Path.Combine(Path.GetDirectoryName(missing.Source)!, "integration", "Desktop.lnk"));
Assert("integration_missing_staged_component_rejected_before_payload", Fails(() => InstallationTransaction.Apply(missing.Source,
missing.Target, integrated: true, isolated: true)) && Snapshot(missing.Target) == missingBefore);
var downgrade = Fixture(installedVersion: "9.0.0"); var downgradeBefore = Snapshot(downgrade.Target);
Assert("integration_rejects_downgrade_before_any_file_or_registry_change",
Fails(() => InstallationTransaction.Apply(downgrade.Source, downgrade.Target,
integrated: true, isolated: true)) && Snapshot(downgrade.Target) == downgradeBefore);
var success = Fixture();
InstallationTransaction.Apply(success.Source, success.Target, integrated: true, isolated: true);
var committed = Snapshot(success.Target); InstallationTransaction.Recover(success.Target, isolated: true);
+33
View File
@@ -0,0 +1,33 @@
namespace UCVL.VPNPlus;
internal static class InstallationVersionPolicy
{
private static bool TryParse(string? value, out Version normalized)
{
normalized = new Version(0, 0, 0, 0);
if (string.IsNullOrWhiteSpace(value)) return false;
var text = value.Trim();
var suffix = text.IndexOfAny(['-', '+']);
if (suffix >= 0) text = text[..suffix];
if (!Version.TryParse(text, out var parsed) || parsed is null) return false;
normalized = new Version(parsed.Major, parsed.Minor,
parsed.Build < 0 ? 0 : parsed.Build,
parsed.Revision < 0 ? 0 : parsed.Revision);
return true;
}
internal static bool CanInstall(string candidate, string? installed)
{
if (!TryParse(candidate, out var next)) return false;
if (string.IsNullOrWhiteSpace(installed)) return true;
return TryParse(installed, out var current) && next >= current;
}
internal static void RequireNotDowngrade(string candidate, string? installed)
{
if (CanInstall(candidate, installed)) return;
throw new IOException(string.IsNullOrWhiteSpace(installed)
? "安装包版本无效,未修改现有程序。"
: $"检测到旧版安装包({candidate}),当前版本为 {installed};已拒绝降级且未修改现有程序。");
}
}
+6 -1
View File
@@ -40,7 +40,12 @@ internal sealed partial class MainForm
{
_dashboardView.Dock = DockStyle.Fill;
_dashboardView.BackColor = Brand.Surface;
_dashboardView.DashboardArtwork = true;
// Keep the original user-supplied mountain-and-people scene on the
// working dashboard as well as the login view. The dedicated
// DashboardArtwork branch intentionally omits the people, which made
// the compact single-node dashboard look empty after the 0.4.0 redesign.
_dashboardView.LoginArtwork = true;
_dashboardView.DashboardArtwork = false;
_dashboardView.AutoScroll = false;
_dashboardView.Visible = false;
_dashboardView.Resize += (_, _) => LayoutDashboard();
+4 -4
View File
@@ -556,10 +556,9 @@ internal sealed partial class MainForm : Form
candidateStarted = true;
replacementStarted = true;
await _xray.StartAsync(runtimeConfig, route.Id, candidate.Slug, connectionToken);
if (!await _xray.CheckProxyHealthAsync(connectionToken))
var proxyHealthy = await _xray.CheckProxyHealthAsync(connectionToken);
if (!ConnectionStartupPolicy.Accept(proxyHealthy, businessHealthy: false))
throw new IOException("默认公网入口代理出口验证失败。");
if (!await _xray.CheckHealthAsync(connectionToken))
throw new IOException("默认公网入口已建立,但当前代理模式的业务路径验证失败。");
connectedTailnet = false;
connectionToken.ThrowIfCancellationRequested();
if (attempt.IsPrivate && candidateResponse.ConfigExpiresAt <= DateTimeOffset.UtcNow)
@@ -609,7 +608,8 @@ internal sealed partial class MainForm : Form
UpdateConnectedTransportPresentation(connectedTailnet);
_handover.Reset();
_currentNodeLabel.Text = _currentNodeName;
_connectionHealth.BeginCore(Environment.TickCount64);
_connectionHealth.BeginCore(Environment.TickCount64,
ConnectionStartupPolicy.InitialHealthGraceMilliseconds(route.Id));
_activeRouteModeId = route.Id;
SetConnectionState(true, "已安全连接", route.Name);
_notifyIcon.Text = "纵横家 · 已连接";
+12
View File
@@ -1,5 +1,17 @@
# 优创⁺纵横家 Windows 客户端
## Windows 0.4.1
修复 0.4.0 在 AI 智能代理冷启动时过早执行普通业务路径验证、误拆已经取得代理出口证据的连接。首次连接现在以真实代理 HTTPS 出口响应为必要条件,智能规则在后台有界学习,并在连接后继续健康复核。
安装事务新增禁止降级保护;最终安装包还会重新提取内嵌主程序和清单,核对版本与 SHA-256,防止旧版安装包覆盖新版或发布元数据与实际载荷不一致。
主界面恢复原山水人物背景,信息卡维持 50% 半透明玻璃面;紧凑窗口保持单页无滚动、统一边线和间距。
## Windows 0.4.0
客户端固定使用 VPN004 默认公网线路,不再调度或显示节点。保留 AI 智能代理和全局代理,并支持运行中切换模式。
## Windows 0.3.20
连接准备完成后立即验证真实代理出口,后台学习不再阻塞首次连接。自动调度线路连续出现业务级不可用时,会先从同节点 Tailscale 入口回退到青岛公网入口;同节点仍不可用时再冷却并选择其他可用节点。手动选定节点不会被自动切换。
+4 -4
View File
@@ -10,10 +10,10 @@
<ApplicationIcon>assets\zonghengjia-app-v1.ico</ApplicationIcon>
<ApplicationManifest>app.manifest</ApplicationManifest>
<ApplicationHighDpiMode>PerMonitorV2</ApplicationHighDpiMode>
<Version>0.4.0</Version>
<AssemblyVersion>0.4.0.0</AssemblyVersion>
<FileVersion>0.4.0.0</FileVersion>
<InformationalVersion>0.4.0</InformationalVersion>
<Version>0.4.1</Version>
<AssemblyVersion>0.4.1.0</AssemblyVersion>
<FileVersion>0.4.1.0</FileVersion>
<InformationalVersion>0.4.1</InformationalVersion>
<Product>纵横家</Product>
<Company>优创未来(UCVL)</Company>
<Description>纵横家 Windows 智能网络客户端</Description>
@@ -7,7 +7,7 @@ param(
[string]$DependencyPayloadRoot,
[ValidateSet(2,3,4)][int]$PreviewRevision = 2,
[switch]$FormalChannel,
[ValidateSet('0.2.20','0.2.21','0.2.22','0.2.23','0.2.24','0.3.0','0.4.0')][string]$FormalVersion = '0.2.21'
[ValidateSet('0.2.20','0.2.21','0.2.22','0.2.23','0.2.24','0.3.0','0.4.0','0.4.1')][string]$FormalVersion = '0.2.21'
)
$ErrorActionPreference='Stop'
Set-StrictMode -Version Latest
@@ -45,7 +45,7 @@ function Copy-Checked([string]$From,[string]$To){
if((Get-FileHash -LiteralPath $To).Hash -cne $hash -or (Get-FileHash -LiteralPath $From).Hash -cne $hash){throw 'Source changed during snapshot'}
return $hash
}
$releaseEvidence=if($FormalChannel -and $FormalVersion -eq '0.4.0'){
$releaseEvidence=if($FormalChannel -and $FormalVersion -in @('0.4.0','0.4.1')){
@($releaseNotes)
}else{
@($releaseNotes,'release/TAILNET-PRIORITY-20260924.md','release/INSTALLER-GUARDIAN-GATE-20260924.md','release/PRODUCTION-NETWORK-BASELINE-20260924.md')
@@ -54,7 +54,7 @@ $relative=@(Get-ChildItem -LiteralPath $project -File -Filter '*.cs' | ForEach-O
@(Get-ChildItem -LiteralPath (Join-Path $project 'assets') -File | ForEach-Object {'assets/'+$_.Name})+
@(Get-ChildItem -LiteralPath (Join-Path $project 'installer') -File | Where-Object Extension -in @('.nsi','.nsh') | ForEach-Object {'installer/'+$_.Name})+
@('build/Build-TailnetGuardianCandidate.ps1','build/GuardianGateFixture.cs','build/GuardianGateFixture.csproj','build/GuardianApprovalPipe.cs','build/Test-InstallerGuardianGate.ps1',
'build/ProductionNetworkBaseline.ps1','build/Test-ProductionNetworkBaseline.ps1','build/ProductionInstallationBaseline.ps1','build/Test-ProductionInstallationBaseline.ps1','build/OwnedProcessGroup.cs')+$releaseEvidence
'build/ProductionNetworkBaseline.ps1','build/Test-ProductionNetworkBaseline.ps1','build/ProductionInstallationBaseline.ps1','build/Test-ProductionInstallationBaseline.ps1','build/Test-ExactInstallerContents.ps1','build/Invoke-LiveCandidateAcceptance.ps1','build/OwnedProcessGroup.cs')+$releaseEvidence
$snapshot=@(foreach($name in @($relative | Sort-Object -Unique)){
$hash=Copy-Checked (Join-Path $project $name) (Join-Path $source $name)
[ordered]@{Path=$name;Sha256=$hash}
@@ -80,7 +80,7 @@ function Run-Offline([string]$File,[string]$Argument,[int]$Timeout=45){
return $child.ExitCode
} finally {$child.Dispose()}
}
$offlineTests=if($FormalChannel -and $FormalVersion -eq '0.4.0'){
$offlineTests=if($FormalChannel -and $FormalVersion -in @('0.4.0','0.4.1')){
@('single-node-client-self-test','client-runtime-self-test','connection-health-self-test','connection-selection-self-test',
'dashboard-interaction-self-test','chart-freshness-self-test','speed-display-self-test','window-chrome-self-test',
'installation-self-test','update-self-test','uninstall-self-test')
@@ -114,7 +114,7 @@ if($startupExit -ne 0 -or $startup.passed -ne $true){throw 'Offline startup/logi
foreach($name in @('startup-self-test.json','startup-login-test.png')){
Copy-Checked (Join-Path $candidate $name) (Join-Path $evidence $name) | Out-Null
}
if($FormalChannel -and $FormalVersion -in @('0.3.0','0.4.0')){
if($FormalChannel -and $FormalVersion -in @('0.3.0','0.4.0','0.4.1')){
$previewExit=Run-Offline $exe '--render-preview'
$previewReport=Join-Path $candidate 'dashboard-ui-self-test.json'
$preview=Get-Content -LiteralPath $previewReport -Raw | ConvertFrom-Json
@@ -136,7 +136,7 @@ $manifest=@(foreach($name in $expected){
})
Save (Join-Path $payload 'install-manifest.json') $manifest
if((Run-Offline (Join-Path $payload 'VPNPlus.exe') '--installer-verify') -ne 0){throw 'Exact new payload installer verification failed'}
if($FormalChannel -and $FormalVersion -eq '0.4.0'){
if($FormalChannel -and $FormalVersion -in @('0.4.0','0.4.1')){
$payloadTest=Join-Path $root 'payload-self-test'
Copy-Item -LiteralPath $payload -Destination $payloadTest -Recurse
$payloadExe=Join-Path $payloadTest 'VPNPlus.exe'
@@ -158,12 +158,14 @@ $setupHash=(Get-FileHash -LiteralPath $setup).Hash
[IO.File]::WriteAllText(($setup+'.sha256'),($setupHash.ToLowerInvariant()+' '+$filename+[Environment]::NewLine),[Text.Encoding]::ASCII)
$packageInfo=[Diagnostics.FileVersionInfo]::GetVersionInfo($setup)
if($packageInfo.ProductVersion -cne $version -or $packageInfo.FileVersion -cne $version){throw 'Package prerelease metadata mismatch'}
$exactInstallerEvidence=& (Join-Path $source 'build/Test-ExactInstallerContents.ps1') -Installer $setup -ExpectedVersion $baseVersion
[IO.File]::WriteAllText((Join-Path $evidence 'exact-installer-contents.json'),($exactInstallerEvidence -join [Environment]::NewLine),[Text.UTF8Encoding]::new($false))
foreach($row in $manifest){if((Get-FileHash -LiteralPath (Join-Path $payload $row.Path)).Hash -cne $row.Sha256){throw 'Payload changed during packaging'}}
$actual=@(Get-ChildItem -LiteralPath $payload -Recurse -File | ForEach-Object {[IO.Path]::GetRelativePath($payload,$_.FullName).Replace('\','/')})
if(@(Compare-Object (@($expected)+@('install-manifest.json') | Sort-Object) ($actual | Sort-Object)).Count){throw 'Unexpected diagnostics in release payload'}
foreach($row in $snapshot){if((Get-FileHash -LiteralPath (Join-Path $source $row.Path)).Hash -cne $row.Sha256){throw 'Frozen source changed during build'}}
$signatures=@(foreach($file in @($exe,$setup)){[ordered]@{File=[IO.Path]::GetFileName($file);Status=[string](Get-AuthenticodeSignature -LiteralPath $file).Status}})
$notAccepted=if($FormalChannel -and $FormalVersion -eq '0.4.0'){
$notAccepted=if($FormalChannel -and $FormalVersion -in @('0.4.0','0.4.1')){
@('live authenticated VPN004 public session','production in-place UAC upgrade and complete guardian rollback',
'current VPN004 host firewall and upstream availability','physical multi-monitor DPI, drag and snap')
}else{
@@ -0,0 +1,98 @@
#requires -Version 7.0
param(
[Parameter(Mandatory)][string]$Candidate,
[Parameter(Mandatory)][string]$Installed
)
$ErrorActionPreference = 'Stop'
Set-StrictMode -Version Latest
$candidatePath = [IO.Path]::GetFullPath($Candidate)
$installedPath = [IO.Path]::GetFullPath($Installed)
foreach ($path in @($candidatePath, $installedPath)) {
if (-not (Test-Path -LiteralPath $path -PathType Leaf)) { throw "Missing client: $path" }
}
$candidateRoot = Split-Path $candidatePath
foreach ($relative in @('xray\xray.exe', 'xray\geoip.dat', 'xray\geosite.dat', 'wintun.dll')) {
$component = Join-Path $candidateRoot $relative
if (-not (Test-Path -LiteralPath $component -PathType Leaf)) {
throw "Candidate must be the complete formal payload; missing runtime component: $component"
}
}
$curl = (Get-Command curl.exe -ErrorAction Stop).Source
$started = Get-Date
$result = [ordered]@{
StartedAt = $started.ToString('o')
CandidateVersion = (Get-Item -LiteralPath $candidatePath).VersionInfo.ProductVersion
OldStopped = $false
CandidateStarted = $false
ProxyGoogle = $null
ProxyOpenAI = $null
ProxyCodex = $null
TunGoogle = $null
TunCodex = $null
CandidateExit = $null
OldRestored = $false
Error = $null
}
$candidateProcess = $null
try {
$shutdown = Start-Process -FilePath $installedPath -ArgumentList '--shutdown' `
-WorkingDirectory (Split-Path $installedPath) -PassThru -WindowStyle Hidden
if (-not $shutdown.WaitForExit(20000)) { throw '旧客户端关闭请求超时。' }
$deadline = (Get-Date).AddSeconds(40)
do {
Start-Sleep -Milliseconds 500
$old = @(Get-Process -Name VPNPlus -ErrorAction SilentlyContinue |
Where-Object { $_.Path -eq $installedPath })
} while ($old.Count -gt 0 -and (Get-Date) -lt $deadline)
if ($old.Count -gt 0) { throw '旧客户端未安全退出,未启动候选版。' }
$result.OldStopped = $true
$candidateProcess = Start-Process -FilePath $candidatePath -ArgumentList '--auto-connect' `
-WorkingDirectory (Split-Path $candidatePath) -PassThru -WindowStyle Hidden
$result.CandidateStarted = $true
$deadline = (Get-Date).AddSeconds(75)
do {
Start-Sleep -Seconds 2
if ($candidateProcess.HasExited) { throw "候选客户端提前退出,exit=$($candidateProcess.ExitCode)" }
$code = & $curl --proxy http://127.0.0.1:10809 --connect-timeout 5 --max-time 12 `
-sS -o NUL -w '%{http_code}' https://www.google.com/generate_204 2>$null
if ($code -eq '204') { break }
} while ((Get-Date) -lt $deadline)
$result.ProxyGoogle = [string](& $curl --proxy http://127.0.0.1:10809 --connect-timeout 8 --max-time 20 -sS -o NUL -w '%{http_code}' https://www.google.com/generate_204 2>$null)
$result.ProxyOpenAI = [string](& $curl --proxy http://127.0.0.1:10809 --connect-timeout 8 --max-time 20 -sS -o NUL -w '%{http_code}' https://api.openai.com/v1/models 2>$null)
$result.ProxyCodex = [string](& $curl --proxy http://127.0.0.1:10809 --connect-timeout 8 --max-time 20 -sS -o NUL -w '%{http_code}' https://chatgpt.com/backend-api/codex/models 2>$null)
$result.TunGoogle = [string](& $curl --noproxy '*' --connect-timeout 8 --max-time 20 -sS -o NUL -w '%{http_code}' https://www.google.com/generate_204 2>$null)
$result.TunCodex = [string](& $curl --noproxy '*' --connect-timeout 8 --max-time 20 -sS -o NUL -w '%{http_code}' https://chatgpt.com/backend-api/codex/models 2>$null)
}
catch {
$result.Error = $_.Exception.Message
}
finally {
if ($candidateProcess -and -not $candidateProcess.HasExited) {
$stop = Start-Process -FilePath $candidatePath -ArgumentList '--shutdown' `
-WorkingDirectory (Split-Path $candidatePath) -PassThru -WindowStyle Hidden
[void]$stop.WaitForExit(20000)
if (-not $candidateProcess.WaitForExit(45000)) {
$result.Error = (@($result.Error, '候选客户端未安全退出。') | Where-Object { $_ }) -join '; '
}
}
if ($candidateProcess -and $candidateProcess.HasExited) { $result.CandidateExit = $candidateProcess.ExitCode }
$running = @(Get-Process -Name VPNPlus -ErrorAction SilentlyContinue |
Where-Object { $_.Path -eq $installedPath })
if ($running.Count -eq 0) {
Start-Process -FilePath $installedPath -ArgumentList '--auto-connect' `
-WorkingDirectory (Split-Path $installedPath) -WindowStyle Hidden | Out-Null
}
$deadline = (Get-Date).AddSeconds(60)
do {
Start-Sleep -Seconds 2
$running = @(Get-Process -Name VPNPlus -ErrorAction SilentlyContinue |
Where-Object { $_.Path -eq $installedPath })
} while ($running.Count -eq 0 -and (Get-Date) -lt $deadline)
$result.OldRestored = $running.Count -gt 0
$result.FinishedAt = (Get-Date).ToString('o')
$result | ConvertTo-Json -Depth 4
}
@@ -0,0 +1,73 @@
#requires -Version 7.0
param(
[Parameter(Mandatory)][string]$Installer,
[Parameter(Mandatory)][ValidatePattern('^\d+\.\d+\.\d+$')][string]$ExpectedVersion,
[string]$SevenZip = 'C:\Program Files\7-Zip\7z.exe'
)
$ErrorActionPreference = 'Stop'
Set-StrictMode -Version Latest
$installerPath = [IO.Path]::GetFullPath($Installer)
if (-not (Test-Path -LiteralPath $installerPath -PathType Leaf)) {
throw "Installer does not exist: $installerPath"
}
if (-not (Test-Path -LiteralPath $SevenZip -PathType Leaf)) {
throw "7-Zip does not exist: $SevenZip"
}
$work = Join-Path ([IO.Path]::GetTempPath()) ('ucvl-exact-installer-' + [Guid]::NewGuid().ToString('N'))
New-Item -ItemType Directory -Path $work | Out-Null
try {
$packageInfo = [Diagnostics.FileVersionInfo]::GetVersionInfo($installerPath)
if ($packageInfo.ProductVersion -cne $ExpectedVersion -or $packageInfo.FileVersion -cne $ExpectedVersion) {
throw "Installer metadata version mismatch: expected $ExpectedVersion, product=$($packageInfo.ProductVersion), file=$($packageInfo.FileVersion)"
}
& $SevenZip x '-bd' '-y' ("-o$work") $installerPath '$PLUGINSDIR\payload\VPNPlus.exe' '$PLUGINSDIR\payload\install-manifest.json' | Out-Null
if ($LASTEXITCODE -ne 0) { throw "7-Zip extraction failed with exit code $LASTEXITCODE" }
$payloadRoot = Join-Path $work '$PLUGINSDIR\payload'
$payloadExe = Join-Path $payloadRoot 'VPNPlus.exe'
$manifestPath = Join-Path $payloadRoot 'install-manifest.json'
if (-not (Test-Path -LiteralPath $payloadExe -PathType Leaf) -or
-not (Test-Path -LiteralPath $manifestPath -PathType Leaf)) {
throw 'Production installer does not contain the expected payload executable and manifest.'
}
$payloadInfo = [Diagnostics.FileVersionInfo]::GetVersionInfo($payloadExe)
$expectedFileVersion = "$ExpectedVersion.0"
if ($payloadInfo.ProductVersion -cne $ExpectedVersion -or $payloadInfo.FileVersion -cne $expectedFileVersion) {
throw "Embedded client version mismatch: expected product=$ExpectedVersion file=$expectedFileVersion, product=$($payloadInfo.ProductVersion), file=$($payloadInfo.FileVersion)"
}
$manifest = @(Get-Content -LiteralPath $manifestPath -Raw | ConvertFrom-Json)
$exeRows = @($manifest | Where-Object Path -ceq 'VPNPlus.exe')
if ($exeRows.Count -ne 1) { throw 'Embedded manifest must contain exactly one VPNPlus.exe row.' }
$payloadHash = (Get-FileHash -LiteralPath $payloadExe -Algorithm SHA256).Hash
if ($exeRows[0].Sha256 -cne $payloadHash) {
throw "Embedded manifest hash mismatch: manifest=$($exeRows[0].Sha256), actual=$payloadHash"
}
[pscustomobject]@{
Passed = $true
ExpectedVersion = $ExpectedVersion
Installer = $installerPath
InstallerSha256 = (Get-FileHash -LiteralPath $installerPath -Algorithm SHA256).Hash
InstallerProductVersion = $packageInfo.ProductVersion
PayloadProductVersion = $payloadInfo.ProductVersion
PayloadFileVersion = $payloadInfo.FileVersion
PayloadSha256 = $payloadHash
ManifestSha256 = (Get-FileHash -LiteralPath $manifestPath -Algorithm SHA256).Hash
} | ConvertTo-Json -Depth 4
}
finally {
if (Test-Path -LiteralPath $work) {
$resolved = [IO.Path]::GetFullPath($work)
$tempRoot = [IO.Path]::GetFullPath([IO.Path]::GetTempPath())
if ($resolved.StartsWith($tempRoot, [StringComparison]::OrdinalIgnoreCase) -and
[IO.Path]::GetFileName($resolved).StartsWith('ucvl-exact-installer-', [StringComparison]::Ordinal)) {
Remove-Item -LiteralPath $resolved -Recurse -Force
}
}
}
+10
View File
@@ -0,0 +1,10 @@
# 纵横家 Windows v0.4.1
- 恢复主界面的原山水人物背景;卡片继续采用 50% 半透明玻璃面,保持 480×360 单页、不滚动和整齐对齐。
- 修复 AI 智能代理首次连接时,后台学习尚未完成就被业务探测误判为失败的问题。
- 初始连接只在默认公网代理取得真实 HTTPS 出口响应后成立;智能规则在后台完成,并在连接后继续健康复核。
- AI 智能代理增加 20 秒启动健康宽限,避免 15 秒内的有界学习任务被提前拆除;全局代理仍保持 5 秒复核。
- 安装事务在改动任何程序文件或登记前比较版本,拒绝旧安装包覆盖新版本。
- 发布门禁从最终 NSIS 安装包重新提取主程序及清单,核对安装器版本、内嵌程序版本和 SHA-256。
- 真实连接验收工具拒绝缺少 Xray/Geo/Wintun 的编译目录,防止把不完整目录误判成产品连接故障。