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