feat!: universal redesign — drop Minecraft stack, single-crate architecture

- remove Java plugins (velocity/paper), dashboard, all MC-specific code
  (handshake, death_code, varint, hostname-HMAC); available in history pre-v0.2
- merge crates/* into one package with src/bin/{rampart,rampart-manager,rampart-cli}
- ProtocolHandler trait + registry (no implementations yet), universal PoW kept
- XDP: universal L3/L4 filter (xdp/core/) + pluggable hook API (xdp/hooks/),
  fix IPv6 saddr bug; clang build verified
- docs: bilingual knowledge base (docs/kb/: attacks x4, defense-levels,
  practice x3), rewrite README/architecture for universal concept
- TODO.md v4.0: <=300-line module limit, competitor benchmark section (ref/)
- deploy/CI/docs cleanup: no MC references, new binary names

cargo build/clippy(-D warnings)/test green (55 tests)
This commit is contained in:
Loki 2026-08-24 01:50:22 +02:00
parent 7d15dfd45e
commit 08e26df73f
Signed by: boba
GPG key ID: 6CDE87BC9A778D97
179 changed files with 5044 additions and 11519 deletions

53
src/xdp/metrics.rs Normal file
View file

@ -0,0 +1,53 @@
use anyhow::{Context, Result};
use prometheus::{IntGauge, register};
use super::XdpStats;
pub struct XdpMetrics {
total: IntGauge,
tcp: IntGauge,
whitelist: IntGauge,
blacklist: IntGauge,
syn_throttle: IntGauge,
passed: IntGauge,
dropped: IntGauge,
udp: IntGauge,
rate_limit: IntGauge,
}
impl XdpMetrics {
fn new_gauge(name: &str, help: &str) -> Result<IntGauge> {
let gauge = IntGauge::new(name, help)?;
register(Box::new(gauge.clone())).context(format!("failed to register {name}"))?;
Ok(gauge)
}
pub fn register() -> Result<Self> {
let m = Self {
total: Self::new_gauge("rampart_xdp_total", "Total XDP packets processed")?,
tcp: Self::new_gauge("rampart_xdp_tcp", "TCP packets processed")?,
whitelist: Self::new_gauge("rampart_xdp_whitelist", "Whitelisted packets")?,
blacklist: Self::new_gauge("rampart_xdp_blacklist", "Blacklisted packets")?,
syn_throttle: Self::new_gauge("rampart_xdp_syn_throttle", "SYN packets rate-limited")?,
passed: Self::new_gauge("rampart_xdp_passed", "Packets passed to upper layers")?,
dropped: Self::new_gauge("rampart_xdp_dropped", "Packets dropped by filter")?,
udp: Self::new_gauge("rampart_xdp_udp", "UDP packets processed")?,
rate_limit: Self::new_gauge("rampart_xdp_rate_limit", "Packets rate-limited by window counter")?,
};
tracing::info!("XDP Prometheus metrics registered");
Ok(m)
}
pub fn update(&self, stats: &XdpStats) {
self.total.set(stats.total as i64);
self.tcp.set(stats.tcp as i64);
self.whitelist.set(stats.whitelist as i64);
self.blacklist.set(stats.blacklist as i64);
self.syn_throttle.set(stats.syn_throttle as i64);
self.passed.set(stats.passed as i64);
self.dropped.set(stats.dropped as i64);
self.udp.set(stats.udp as i64);
self.rate_limit.set(stats.rate_limit as i64);
tracing::debug!("XDP metrics updated");
}
}