feat: complete nx9-wg v0.8.0 platform

This commit is contained in:
thakares committed 2026-08-17 14:25:45 +05:30
1 parent c75e5c4e71
commit c8a9b7cde6
52 files changed
+7751 -725

No files matched your search

+10 -10
View File
@@ -46,7 +46,7 @@ use uuid::Uuid;
author = "NX9 Systems",
version,
about = "Native Rust WireGuard Appliance and Management Platform",
long_about = "A high-performance, native Rust WireGuard management system with zero external runtime dependencies."
long_about = "A high-performance, native Rust WireGuard management system with minimal, explicitly documented Linux runtime dependencies."
)]
struct Cli {
#[arg(
@@ -1166,8 +1166,8 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
}
// Start background periodic reconciliation
let wg_engine = Arc::new(SimulatedWireGuardEngine::new());
let net_engine = Arc::new(SimulatedNetworkEngine::new());
let wg_engine = Arc::new(NativeLinuxWireGuardEngine::new());
let net_engine = Arc::new(NativeLinuxNetworkEngine::new());
let reconciler = Arc::new(ReconciliationEngine::new(app_state, wg_engine, net_engine));
reconciler.start_background_loop(config.reconciliation_interval_secs);
@@ -2384,7 +2384,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
}
RouteSubcommands::Sync => {
let routes = store.list_routes().await?;
let net = SimulatedNetworkEngine::new();
let net = NativeLinuxNetworkEngine::new();
net.sync_routes(&routes).await?;
println!("Routes synchronized successfully with kernel.");
}
@@ -2540,12 +2540,12 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
let rules = store.list_firewall_rules().await?;
let ifaces = store.list_interfaces().await?;
let subnets: Vec<_> = ifaces.into_iter().map(|i| i.address_v4).collect();
let net = SimulatedNetworkEngine::new();
let net = NativeLinuxNetworkEngine::new();
net.sync_firewall(&rules, true, &subnets).await?;
println!("Firewall ruleset synchronized successfully.");
}
FirewallSubcommands::Status => {
let net = SimulatedNetworkEngine::new();
let net = NativeLinuxNetworkEngine::new();
let ruleset = net.get_active_nftables_ruleset().await?;
let status = serde_json::json!({
"rules_count": store.list_firewall_rules().await?.len(),
@@ -2595,7 +2595,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
let rules = store.list_firewall_rules().await?;
let ifaces = store.list_interfaces().await?;
let subnets: Vec<_> = ifaces.into_iter().map(|i| i.address_v4).collect();
let net = SimulatedNetworkEngine::new();
let net = NativeLinuxNetworkEngine::new();
net.sync_firewall(&rules, true, &subnets).await?;
println!("NAT masquerade rules synchronized with nftables.");
}
@@ -2627,8 +2627,8 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
let store = Store::connect(&db_url).await?;
store.migrate().await?;
let state = AppState::new(store);
let wg = Arc::new(SimulatedWireGuardEngine::new());
let net = Arc::new(SimulatedNetworkEngine::new());
let wg = Arc::new(NativeLinuxWireGuardEngine::new());
let net = Arc::new(NativeLinuxNetworkEngine::new());
let reconciler = ReconciliationEngine::new(state, wg, net);
match args.subcommand {
@@ -2835,7 +2835,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
print_output(&status, format)?;
}
LiveSubcommands::Firewall => {
let net = SimulatedNetworkEngine::new();
let net = NativeLinuxNetworkEngine::new();
let ruleset = net.get_active_nftables_ruleset().await?;
print_output(&ruleset, format)?;
}