Refactor proxy routing and session management

This commit is contained in:
2026-07-08 00:09:38 +03:00
parent c5bdb10445
commit b45dd2ae05
26 changed files with 5193 additions and 307 deletions

View File

@@ -10,8 +10,14 @@ mod models;
mod proxifyre;
#[path = "../src/adapters/proxy_router.rs"]
mod proxy_router;
#[path = "../src/adapters/singbox.rs"]
mod singbox;
#[path = "../src/singbox_service.rs"]
mod singbox_service;
#[path = "../src/storage.rs"]
mod storage;
#[path = "../src/subscription.rs"]
mod subscription;
#[path = "../src/validation.rs"]
mod validation;
@@ -155,6 +161,25 @@ fn proxifyre_install_script_parses_as_powershell() {
cleanup(&root);
}
#[test]
fn singbox_runner_preserves_installer_args_with_spaces() {
let script = commands::singbox_installer_runner_script(
Path::new(r"C:\ProgramData\VpnProxy\state\install-singbox.ps1"),
Path::new(r"C:\ProgramData\VpnProxy\state\install.log"),
&[
"-InstallRoot".to_string(),
r"C:\Program Files\VpnProxy\sing-box".to_string(),
"-ServiceName".to_string(),
"VpnProxySingBox".to_string(),
"-Uninstall".to_string(),
],
);
assert!(script.contains("$installerArgs = @('-InstallRoot', 'C:\\Program Files\\VpnProxy\\sing-box'"));
assert!(script.contains("& powershell.exe -NoProfile -ExecutionPolicy Bypass -File $installerPath @installerArgs"));
assert!(!script.contains("Start-Process -FilePath 'powershell.exe' -ArgumentList $argumentList"));
}
#[test]
fn apply_generates_derived_config_and_records_activity_with_mock_helper() {
let root = test_root("apply");
@@ -241,6 +266,7 @@ fn component_status_merges_detected_existing_proxifyre() {
running: true,
service_name: Some("ProxiFyreService".to_string()),
}),
None,
);
let proxyfier = components
.iter()