windows: the component manager, verified programs, a Wine test

components.json pins sing-box, XRay, Flowseal's zapret, bol-van's
winws2 bundle with nfqws2-keenetic's strategies, and tg-ws-proxy (built
with the release): release assets by archive hash, commit snapshots by
the hash of every file taken. The service installs them (admin only),
staged and swapped in, refusing archive paths that leave the directory,
and checks each program against the hashes recorded at install before
running it. stage-components does the same for building a release.

The state root is created with its protected descriptor in one call,
or, existing, checked through a handle that does not follow links.

tools/wine-e2e.sh runs the Windows build under Wine: the service, the
named pipe, impersonation, the component check, rendering and the
supervisor all work; Wine lacks an iphlpapi call sing-box needs, so
proxying itself needs real Windows.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
faumarayandClaude Opus 5.5 committed 2026-10-26 23:33:55 +03:00
1 parent b878dd93db
commit 68b496cafa
10 files changed
+709 -81

No files matched your search

+17 -1
View File
@@ -7,6 +7,7 @@ mod api;
mod clash;
mod components;
mod fetch;
mod install;
#[cfg(windows)]
mod job;
mod paths;
@@ -46,6 +47,15 @@ enum Command {
Install,
/// Remove the Windows service.
Uninstall,
/// For building a release: fetch and verify every component into DIR.
#[command(hide = true)]
StageComponents {
#[arg(long)]
to: PathBuf,
#[arg(long)]
cache: PathBuf,
only: Vec<String>,
},
}
fn address(arg: Option<String>) -> Address {
@@ -103,13 +113,19 @@ fn main() -> Result<()> {
.with_env_filter(tracing_subscriber::EnvFilter::try_from_default_env().unwrap_or_else(|_| "info".into()))
.with_writer(std::io::stderr)
.init();
if let Some(Command::StageComponents { to, cache, only }) = &args.command {
let _ = rustls::crypto::ring::default_provider().install_default();
let rt = tokio::runtime::Runtime::new()?;
return rt.block_on(install::stage(to, cache, only));
}
match args.command {
#[cfg(windows)]
Some(Command::Install) => return winsvc::install(),
#[cfg(windows)]
Some(Command::Uninstall) => return winsvc::uninstall(),
#[cfg(not(windows))]
Some(_) => anyhow::bail!("there are no services to install off Windows; use --console"),
Some(Command::Install | Command::Uninstall) => anyhow::bail!("there are no services to install off Windows; use --console"),
Some(Command::StageComponents { .. }) => unreachable!(),
None => {}
}
if args.console || !cfg!(windows) {