Implement XDP firewall with real-time TUI monitoring

Features:
- High-performance packet filtering via eBPF/XDP
- Instant blocklist with dynamic CLI management
- Exact-match rules with Drop/Pass/Log actions
- CIDR-based IP range dropping via LPM trie
- Token-bucket rate limiting (IP-based and flow-based)
- Auto temp bans for rate limit violators
- Real-time event logging via BPF ring buffer
- Interactive TUI monitor with live stats

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-15 09:10:52 +07:00
commit 6101de6887
24 changed files with 3235 additions and 0 deletions

21
xdp-firewall/Cargo.toml Normal file
View File

@@ -0,0 +1,21 @@
[package]
name = "xdp-firewall"
version = "0.1.0"
edition = "2021"
[dependencies]
aya = { version = "0.13.1", features = ["async_tokio"] }
aya-log = "0.2.1"
clap = { version = "4.5", features = ["derive"] }
tokio = { version = "1.44", features = ["macros", "rt", "rt-multi-thread", "time", "sync", "signal"] }
ratatui = "0.29"
crossterm = { version = "0.29", features = ["event-stream"] }
anyhow = "1.0"
thiserror = "2.0"
tracing = "0.1"
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
ipnetwork = "0.21"
xdp-firewall-common = { path = "../xdp-firewall-common", features = ["userspace"] }
[build-dependencies]
duct = "0.13"