Initial commit: Rampart v0.2.0

Multi-layer DDoS protection for Minecraft servers.

- rampart-core: Edge node with XDP/eBPF + Rust L7 filtering
- rampart-manager: REST API with JWT auth, Redis sync
- rampart-cli: CLI tool for operators
- velocity-plugin: Domain check, HMAC verify, server registry, load balancer
- paper-plugin: Auto-registration, heartbeat, HMAC verify
- dashboard: React + Vite web UI for management
This commit is contained in:
loki5512344 2026-07-20 20:53:32 +02:00
commit cf9608ce5d
Signed by: boba
GPG key ID: 253067914055423B
159 changed files with 15341 additions and 0 deletions

View file

@ -0,0 +1,43 @@
use crate::AppState;
use axum::{Json, extract::State};
use redis::AsyncCommands;
use serde::{Deserialize, Serialize};
use std::sync::Arc;
#[derive(Debug, Serialize, Deserialize)]
pub struct NodeInfo {
pub id: String,
pub role: String,
pub ip: String,
pub status: String,
pub last_heartbeat: String,
}
#[derive(Serialize)]
pub struct NodesResponse {
pub nodes: Vec<NodeInfo>,
}
pub async fn list_nodes(State(state): State<Arc<AppState>>) -> Json<NodesResponse> {
let mut conn = match state.redis_client.get_multiplexed_async_connection().await {
Ok(c) => c,
Err(_) => return Json(NodesResponse { nodes: vec![] }),
};
let keys: Vec<String> = match redis::cmd("KEYS").arg("rampart:nodes:*").query_async(&mut conn).await {
Ok(k) => k,
Err(_) => return Json(NodesResponse { nodes: vec![] }),
};
let mut nodes = Vec::with_capacity(keys.len());
for key in &keys {
let raw: Option<String> = conn.get(key).await.unwrap_or(None);
if let Some(json) = raw
&& let Ok(node) = serde_json::from_str::<NodeInfo>(&json)
{
nodes.push(node);
}
}
Json(NodesResponse { nodes })
}