#[cfg(target_os = "linux")]
pub mod linux;
#[cfg(target_os = "macos")]
pub mod macos;
#[cfg(not(any(target_os = "macos", target_os = "linux")))]
compile_error!("Vortix currently only supports macOS and Linux");
use crate::core::killswitch::Result as KsResult;
pub use crate::constants::DEFAULT_VPN_INTERFACE;
pub use crate::constants::KILLSWITCH_EMERGENCY_MSG;
pub trait Firewall {
fn enable_blocking(vpn_interface: &str, vpn_server_ip: Option<&str>) -> KsResult<()>;
fn disable_blocking() -> KsResult<()>;
}
pub trait NetworkStatsProvider {
fn get_total_bytes() -> (u64, u64);
}
pub trait InterfaceDetector {
fn check_wireguard_interface(name: &str) -> bool;
fn resolve_wireguard_interface(name: &str) -> Option<String>;
fn get_wireguard_pid(interface: &str) -> Option<u32>;
fn get_interface_info(interface: &str) -> (String, String);
}
pub trait DnsResolver {
fn get_dns_server() -> Option<String>;
}
#[cfg(target_os = "macos")]
#[must_use]
pub fn install_hint(pkg: &str) -> String {
format!("brew install {pkg}")
}
#[cfg(target_os = "linux")]
#[must_use]
pub fn install_hint(pkg: &str) -> String {
format!("sudo apt install {pkg} # or: sudo dnf install {pkg}")
}