mirror of
https://github.com/YuanDevTeam/Vole.git
synced 2026-11-07 00:05:27 +00:00
* Add mixed-port inbound and allow unauthenticated LAN access * Remove Invoke API and configuration version fields * Unify CLI and native lifecycle through Invoke Share Invoke dispatch across CLI, C ABI and JNI, make startup configuration-owned, and select Windows TUN backends at build time. Add fixed-name CLI tag releases and document scoped validation. * Rename project and public interfaces to Vole Rename crates, CLI and native libraries, C ABI and JNI symbols, environment variables, Windows identities and release assets consistently. Update repository references while preserving third-party code, fixed protocol vectors and historical validation evidence. * Unify CLI and FFI builds and tag releases * Simplify release packaging and fix Windows script tests Windows CI fixtures assumed LF bytes and a POSIX host, while a global subprocess mock also intercepted Windows platform detection. Preserve actual notice bytes, set the Android fixture platform explicitly, and mock native build boundaries for packaging tests. Remove internal build manifests, source snapshots, artifact hashes, delivery mode, and repeated archive inspection. Reuse platform builders, upload only the fixed archives, and assemble the complete CLI/FFI set once. Validated 56 script tests, 58 simulated Windows-condition regressions, Ruff checks, and a native macOS ARM64 CLI release build with offline flag and configuration checks. * Streamline build scripts, tests, and documentation Consolidate CLI/FFI packaging and license collection, reuse native Cargo build setup, and shorten CI job names. Remove duplicate audits, binary parsers, redundant script tests, and development-history documentation. Validation: 9 Python tests and Ruff passed; native macOS ARM64 CLI and FFI builds passed, including offline CLI checks and an Invoke version call. Resolved production feature graphs are unchanged. * Separate UWP headers from the shared FFI API Move VoleWindowsVpnInvoke into a UWP-only header and ship it only with the UWP backend. Include matching Windows build headers, keep Apple frameworks limited to shared headers, and update the UWP example. Clarify that dns-hijack ignores arbitrary scheme prefixes to match Mihomo without adding validation. Validation: 9 script tests, Ruff, and C/C++ header compilation for Windows x64 and ARM64 passed. Windows native builds were not run. * Fix Windows release metadata decoding and timeouts Decode Cargo and rustc output explicitly as UTF-8 instead of the Windows CP1252 default. Remove the fixed 60-second subprocess timeout that interrupted cold BoringSSL dependency downloads; release jobs already have a 90-minute limit. Add a regression using a real subprocess under a simulated CP1252 locale. Validation: 10 script tests and Ruff passed, all six Windows feature/target metadata combinations parsed, and CLI/Wintun/UWP notice collection passed. A 61-second subprocess failed before the fix and completed afterward. Windows native builds have not been rerun. * Validate UWP TUN settings and preserve absolute CLI paths * Parallelize Apple FFI builds and remove embedded licenses
110 lines
5.6 KiB
PowerShell
110 lines
5.6 KiB
PowerShell
param(
|
|
[string] $IdentityName = 'Vole.UwpDemo.Dev',
|
|
[Parameter(Mandatory = $true)]
|
|
[string] $Publisher,
|
|
[string] $Version = '1.0.0.0',
|
|
[Parameter(Mandatory = $true)]
|
|
[string] $PfxPath,
|
|
[Parameter(Mandatory = $true)]
|
|
[string] $PfxPassword,
|
|
[switch] $SkipVoleBuild,
|
|
[switch] $Install
|
|
)
|
|
|
|
$ErrorActionPreference = 'Stop'
|
|
$example = $PSScriptRoot
|
|
$root = Split-Path (Split-Path $example -Parent) -Parent
|
|
$nativeArchitecture = (Get-ItemProperty `
|
|
'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment' `
|
|
-Name PROCESSOR_ARCHITECTURE).PROCESSOR_ARCHITECTURE.ToLowerInvariant()
|
|
$Architecture = if ($nativeArchitecture -eq 'amd64') { 'x64' } else { $nativeArchitecture }
|
|
if ($Architecture -notin @('arm64', 'x64')) {
|
|
throw "unsupported native Windows processor architecture: $nativeArchitecture"
|
|
}
|
|
if ($Version -notmatch '^\d+\.\d+\.\d+\.\d+$') {
|
|
throw 'Version must contain four numeric components'
|
|
}
|
|
if (($Version.Split('.') | ForEach-Object { [int] $_ }) | Where-Object { $_ -gt 65535 }) {
|
|
throw 'each Version component must fit 0..65535'
|
|
}
|
|
if (-not (Test-Path $PfxPath -PathType Leaf)) {
|
|
throw "signing certificate not found: $PfxPath"
|
|
}
|
|
$PfxPath = (Resolve-Path $PfxPath).Path
|
|
|
|
$voleDist = Join-Path $root "dist\windows\$Architecture\uwp"
|
|
$importLibrary = Join-Path $voleDist 'vole.dll.lib'
|
|
$build = Join-Path $root "target\windows-uwp-demo\$Architecture"
|
|
$stage = Join-Path $build 'stage'
|
|
$packageDir = Join-Path $root 'dist\windows-uwp-demo'
|
|
|
|
Push-Location $root
|
|
try {
|
|
$vswhere = Join-Path ${env:ProgramFiles(x86)} 'Microsoft Visual Studio\Installer\vswhere.exe'
|
|
$vcvars = & $vswhere -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -find 'VC\Auxiliary\Build\vcvarsall.bat' |
|
|
Select-Object -First 1
|
|
if (-not $vcvars) { throw 'Visual Studio C++ tools were not found' }
|
|
$vcTarget = if ($Architecture -eq 'arm64') { 'amd64_arm64' } else { 'amd64' }
|
|
|
|
if (-not $SkipVoleBuild) {
|
|
& uv run --project (Join-Path $root 'scripts') --locked vole-scripts build windows --backend uwp
|
|
if ($LASTEXITCODE) { throw "Vole build failed: $LASTEXITCODE" }
|
|
}
|
|
foreach ($artifact in @('vole.dll', 'vole-windows-vpn-host.exe', 'vole-windows-session-host.exe')) {
|
|
if (-not (Test-Path (Join-Path $voleDist $artifact) -PathType Leaf)) {
|
|
throw "missing Vole artifact: $artifact"
|
|
}
|
|
}
|
|
if (-not (Test-Path $importLibrary -PathType Leaf)) {
|
|
throw "missing Vole import library: $importLibrary"
|
|
}
|
|
|
|
Remove-Item $stage -Recurse -Force -ErrorAction SilentlyContinue
|
|
New-Item $stage, (Join-Path $stage 'Assets'), $packageDir -ItemType Directory -Force | Out-Null
|
|
$demoExe = Join-Path $stage 'VoleUwpDemo.exe'
|
|
$compile = 'call "{0}" {1} >nul && cl.exe /nologo /std:c++20 /EHsc /O2 /MT /utf-8 /Fo"{2}" "{3}" /I"{4}" /link /out:"{5}" "{6}"' -f `
|
|
$vcvars, $vcTarget, (Join-Path $build 'demo.obj'), (Join-Path $example 'demo.cpp'), (Join-Path $root 'include'), $demoExe, $importLibrary
|
|
& $env:ComSpec /d /s /c $compile
|
|
if ($LASTEXITCODE) { throw "demo compile failed: $LASTEXITCODE" }
|
|
|
|
Copy-Item (Join-Path $voleDist 'vole.dll'), `
|
|
(Join-Path $voleDist 'vole-windows-vpn-host.exe'), `
|
|
(Join-Path $voleDist 'vole-windows-session-host.exe') $stage
|
|
|
|
$logo = 'iVBORw0KGgoAAAANSUhEUgAAAJYAAACWCAYAAAA8AXHiAAABIklEQVR42u3SMQ0AAAjAMAThDO1oAAOcnD1qYFlk9cC3EAFjYSwwFsbCWGAsjIWxwFgYC2OBsTAWxgJjYSyMBcbCWBgLjIWxMBYYC2NhLDAWxsJYYCyMhbHAWBgLY4GxMBbGAmNhLIwFxsJYGAuMhbEwFhgLY2EsMBbGwlhgLIyFscBYGAtjgbEwFsYCY2EsjAXGwlgYC4yFsTAWGAtjYSwwFsbCWBhLBIyFsTAWGAtjYSwwFsbCWGAsjIWxwFgYC2OBsTAWxgJjYSyMBcbCWBgLjIWxMBYYC2NhLDAWxsJYYCyMhbHAWBgLY4GxMBbGAmNhLIwFxsJYGAuMhbEwFhgLY2EsMBbGwlhgLIyFseC2BofOkWDAMyEAAAAASUVORK5CYII='
|
|
[IO.File]::WriteAllBytes((Join-Path $stage 'Assets\Logo.png'), [Convert]::FromBase64String($logo))
|
|
|
|
$manifest = Get-Content (Join-Path $example 'AppxManifest.xml.in') -Raw
|
|
$manifest = $manifest.Replace('__IDENTITY_NAME__', [Security.SecurityElement]::Escape($IdentityName))
|
|
$manifest = $manifest.Replace('__PUBLISHER__', [Security.SecurityElement]::Escape($Publisher))
|
|
$manifest = $manifest.Replace('__VERSION__', $Version)
|
|
$manifest = $manifest.Replace('__ARCHITECTURE__', $Architecture)
|
|
Set-Content (Join-Path $stage 'AppxManifest.xml') $manifest -Encoding utf8 -NoNewline
|
|
|
|
$sdk = Get-ChildItem (Join-Path ${env:ProgramFiles(x86)} 'Windows Kits\10\bin\*\x64\makeappx.exe') |
|
|
Sort-Object FullName -Descending |
|
|
Select-Object -First 1 |
|
|
Split-Path -Parent
|
|
if (-not $sdk) { throw 'Windows SDK packaging tools were not found' }
|
|
$package = Join-Path $packageDir "$($IdentityName)_$($Version)_$Architecture.msix"
|
|
Remove-Item $package -Force -ErrorAction SilentlyContinue
|
|
& (Join-Path $sdk 'makeappx.exe') pack /d $stage /p $package /o
|
|
if ($LASTEXITCODE) { throw "makeappx failed: $LASTEXITCODE" }
|
|
& (Join-Path $sdk 'signtool.exe') sign /fd SHA256 /f $PfxPath /p $PfxPassword $package
|
|
if ($LASTEXITCODE) { throw "signtool failed: $LASTEXITCODE" }
|
|
|
|
if ($Install) {
|
|
if (Get-NetRoute -DestinationPrefix '0.0.0.0/1' -ErrorAction SilentlyContinue) {
|
|
throw 'disconnect the active VPN before installing or updating the demo'
|
|
}
|
|
$installed = Get-AppxPackage -Name $IdentityName
|
|
if ($installed -and [version] $Version -le $installed.Version) {
|
|
throw "increment Version above $($installed.Version) before updating $IdentityName"
|
|
}
|
|
Add-AppxPackage $package -ForceApplicationShutdown
|
|
}
|
|
Get-FileHash $package -Algorithm SHA256 | Format-Table Path, Hash -AutoSize
|
|
} finally {
|
|
Pop-Location
|
|
}
|