VNOX-Server/serverd/src/main.rs
loki5512344 742cf03a5f
Phase 2: PostgreSQL, E2EE, channel CRUD, voice signaling, Slint migration
Server:
- PostgreSQL backend (Pool enum over Sqlite/PgPool, all storage methods dual-dialect)
- E2EE for DM (4 new protobuf packets, handlers, storage of ciphertext only)
- ChannelEdit packet + server-authoritative channel create/delete
- Gateway → voice-node membership signaling via broadcast channel

Client:
- E2EE crypto (X25519 from Ed25519, HKDF, ChaCha20-Poly1305) + UI lock icons
- E2EE net layer (PID 0x0071-0x0074, JSON payloads, dispatch, session handlers)
- Slint migration: all .slint files, bridge.rs, update.rs, main.rs rewritten
- Removed egui UI (~50 files) and all dead code (clean clippy -D warnings)
2026-07-14 13:25:14 +02:00

48 lines
1.4 KiB
Rust

use anyhow::Result;
use std::sync::Arc;
use tokio::sync::broadcast;
use tracing::info;
#[tokio::main]
async fn main() -> Result<()> {
tracing_subscriber::fmt()
.with_env_filter(std::env::var("VNOX_LOG").unwrap_or_else(|_| "info".into()))
.init();
let config_path = std::env::args()
.skip_while(|a| a != "--config")
.nth(1)
.unwrap_or_else(|| "/etc/vnox/config.toml".into());
let text = std::fs::read_to_string(&config_path)?;
let cfg: vnox_gateway::domain::config::Config =
toml::from_str(&text).map_err(|e| anyhow::anyhow!("invalid config: {e}"))?;
info!("VNOX Server starting — node: {}", cfg.node.name);
info!("Gateway TCP: {}", cfg.gateway.bind);
info!("Voice UDP: {}", cfg.voice.bind);
let node_name = cfg.node.name.clone();
let voice_bind = cfg.voice.bind.clone();
let gate_cfg = Arc::new(cfg);
let (voice_member_tx, voice_member_rx) = broadcast::channel::<String>(256);
let voice_handle = tokio::spawn(async move {
vnox_voice_node::runner::run_bind(&node_name, &voice_bind, voice_member_rx).await
});
let gate_handle =
tokio::spawn(async move { vnox_gateway::run(gate_cfg, Some(voice_member_tx)).await });
tokio::select! {
r = voice_handle => {
info!("voice node exited: {:?}", r);
}
r = gate_handle => {
info!("gateway exited: {:?}", r);
}
}
Ok(())
}