v0.3: 6-layer architecture complete
Layers: Layer 1: XDP/eBPF — TCP state machine, SYN throttle, blacklist, ringbuf Layer 2: PoW Challenge — SHA-256 hashcash, dynamic difficulty, constant-time verify Layer 3: Rust Core — HMAC handshake, rate limit, death code (existing) Layer 4: Velocity — Physics check, CAPTCHA, protocol verification Layer 5: Paper — Heartbeat, auto-registration (existing) Layer 6: Traffic Intel — EWMA, 168h profiling, reputation, alerts Infra: XDP→Prometheus metrics, ClickHouse + Grafana dashboard, Docker Compose Testing: 100-IP DDoS simulation, MHDDoS ref analysis, load test report Fixes: VarInt sign extension UB, pure ACK deadlock, RST/FIN cleanup Ref: MHDDoS, Sonar, LimboFilter, AtomGuard, Infrarust, MC-XDP-eBPF, PowGo
This commit is contained in:
parent
414d3be659
commit
6d76a7eeb1
66 changed files with 4529 additions and 1003 deletions
|
|
@ -2,8 +2,9 @@ use rampart_core::config::Config;
|
|||
use rampart_core::filter::blacklist::Blacklist;
|
||||
use rampart_core::filter::rate_limit::RateLimiter;
|
||||
use rampart_core::metrics;
|
||||
use rampart_core::pow::difficulty::DifficultyAdjuster;
|
||||
use rampart_core::proxy::listener::ProxyListener;
|
||||
use std::sync::Arc;
|
||||
use std::sync::{Arc, Mutex};
|
||||
use std::time::Duration;
|
||||
use tokio::sync::watch;
|
||||
use tracing_subscriber::EnvFilter;
|
||||
|
|
@ -63,10 +64,32 @@ async fn main() -> anyhow::Result<()> {
|
|||
});
|
||||
}
|
||||
|
||||
#[cfg(feature = "xdp")]
|
||||
if config.xdp.enabled {
|
||||
use rampart_core::xdp::{XdpFilter, XdpMetrics};
|
||||
|
||||
let mut filter = XdpFilter::new(&config.xdp.interface);
|
||||
filter.load()?;
|
||||
let xdp_metrics = XdpMetrics::register()?;
|
||||
|
||||
let sd = shutdown_rx.clone();
|
||||
std::thread::spawn(move || {
|
||||
while !*sd.borrow() {
|
||||
filter.drain_events();
|
||||
if let Ok(stats) = filter.get_stats() {
|
||||
xdp_metrics.update(&stats);
|
||||
}
|
||||
std::thread::sleep(Duration::from_secs(5));
|
||||
}
|
||||
filter.unload().ok();
|
||||
});
|
||||
}
|
||||
|
||||
tracing::info!("Rampart edge starting on {}:{}", config.bind.address, config.bind.port);
|
||||
tracing::info!("Backend: {}:{}", config.backend.address, config.backend.port);
|
||||
|
||||
let listener = ProxyListener::new(config, rate_limiter, blacklist);
|
||||
let adjuster = Arc::new(Mutex::new(DifficultyAdjuster::default()));
|
||||
let listener = ProxyListener::new(config, rate_limiter, blacklist, adjuster);
|
||||
listener.run(shutdown_rx).await
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue