feat: add tunnel status checking with active interface verification

Add tunnel_status command to desktop client for querying active tunnel state. Add is_active method to tunnel_manager that calls status command on bundled backend. Add status command to tunnel-helper that checks WireGuard service state on Windows via sc query and interface state on macOS via wg show. Add windows_client_status function for IPC-based status queries with active field in TunnelResponse. Update App.tsx to query tunnel status on
This commit is contained in:
2026-03-18 07:02:39 +01:00
parent 0b29331f26
commit 31369a7743
5 changed files with 145 additions and 6 deletions

View File

@@ -47,6 +47,23 @@ pub fn disconnect(app: &AppHandle, profile_path: &Path) -> Result<(), String> {
Ok(())
}
pub fn is_active(app: &AppHandle, profile_path: &Path) -> Result<bool, String> {
let backend = bundled_backend(app)?;
let output = Command::new(backend)
.arg("status")
.arg("--profile")
.arg(profile_path)
.output()
.map_err(|err| format!("Unable to query embedded tunnel backend: {}", err))?;
if !output.status.success() {
return Err(format_helper_error("status", &output));
}
let stdout = String::from_utf8_lossy(&output.stdout);
Ok(stdout.trim().eq_ignore_ascii_case("active"))
}
fn bundled_backend(app: &AppHandle) -> Result<PathBuf, String> {
let resource_dir = app
.path()