- 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)
45 lines
1.5 KiB
Rust
45 lines
1.5 KiB
Rust
use std::path::PathBuf;
|
|
use std::process::Command;
|
|
|
|
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|
let has_xdp_feature = std::env::var("CARGO_FEATURE_XDP").is_ok();
|
|
if !has_xdp_feature {
|
|
return Ok(());
|
|
}
|
|
|
|
let manifest_dir = PathBuf::from(std::env::var("CARGO_MANIFEST_DIR")?);
|
|
let xdp_dir = manifest_dir.join("xdp");
|
|
let out_dir = PathBuf::from(std::env::var("OUT_DIR")?);
|
|
|
|
let src = xdp_dir.join("core/universal_filter.c");
|
|
let dst = out_dir.join("universal_filter.o");
|
|
|
|
println!("cargo:rerun-if-changed={}", src.display());
|
|
|
|
let host_triple = std::env::var("HOST").unwrap_or_default();
|
|
let arch = host_triple.split('-').next().unwrap_or(&host_triple);
|
|
let status = Command::new("clang")
|
|
.args([
|
|
"-O2",
|
|
"-g",
|
|
"-target",
|
|
"bpf",
|
|
"-mcpu=v3",
|
|
"-c",
|
|
src.to_str().ok_or("src path is not valid UTF-8")?,
|
|
"-o",
|
|
dst.to_str().ok_or("dst path is not valid UTF-8")?,
|
|
&format!("-I{}", xdp_dir.display()),
|
|
&format!("-I{}", xdp_dir.join("core").display()),
|
|
&format!("-I{}", xdp_dir.join("hooks").display()),
|
|
&format!("-I/usr/include/{}-linux-gnu", arch),
|
|
])
|
|
.status()?;
|
|
|
|
if !status.success() {
|
|
return Err("XDP C compilation failed (see clang errors above)".into());
|
|
}
|
|
|
|
println!("cargo:rerun-if-env-changed=CARGO_FEATURE_XDP");
|
|
Ok(())
|
|
}
|