https://github.com/banyc/xdp_hello
DDoS mitigation
https://github.com/banyc/xdp_hello
ddos ebpf xdp
Last synced: 4 months ago
JSON representation
DDoS mitigation
- Host: GitHub
- URL: https://github.com/banyc/xdp_hello
- Owner: Banyc
- Created: 2024-01-30T04:55:23.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-02-04T07:52:40.000Z (over 2 years ago)
- Last Synced: 2025-06-12T22:04:01.098Z (about 1 year ago)
- Topics: ddos, ebpf, xdp
- Language: Rust
- Homepage:
- Size: 46.9 KB
- Stars: 1
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# app
## Prerequisites
1. Install bpf-linker: `cargo install bpf-linker`
## Build eBPF
```bash
cargo xtask build-ebpf
```
To perform a release build you can use the `--release` flag.
You may also change the target architecture with the `--target` flag.
## Build Userspace
```bash
cargo build
```
## Run
### DDoS mitigation
Run BPF program:
```bash
RUST_LOG=info cargo xtask run --bin ddos_mitigation -- --port 80 --port 443 --pps 1
```
- The restricted local ports are `443` and `80`
- Restriction will be imposted if the packets per second exceed `1` for each port
Trust an IP:
```bash
curl -X PUT http://127.0.0.1:6969/ip/1.1.1.1
```
Forget an IP:
```bash
curl -X DELETE http://127.0.0.1:6969/ip/1.1.1.1
```