-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* use own struct instead of exposing Bpf directly * checkpoint * checkpoint * refactor into single struct entrypoint * fix warning * add ipnet instead of own cidr (test broken) * fix tests * add proto default * add default trait for * feat: adds API docs, correct error handling on RuleTracker and refactors rules into its own module We add a draft of the API docs and refactored `Rule` into its own module this way we reduce the public API surface area and improve readability. Furthemore, we do some checks before inserting in `RuleTracker` making sure that in case of rule exhaustion or other non-predictable errors we don't leave `RuleTracker` in a partial state. * feat: add `remove_by_id` method `remove_by_id` allows removing all the ips related to a given id instead of having to go one by one. * fix * docs: add examples and expand * feat: make number of rules/ranges configurable + benchmark draft * Adds features to control the number of rules and port ranges to be able to fine-tune the map sizes * Adds a draft for a benchmarking program + an enviroment where it would work using iperf3 * feat: update id size u32 -> u128 for uuid compatibility * fix: use [u8; 16] instead of u128 and scope logging * feat: log format improvements * fix: PacketLog padding * fix: uuid endianess * feature: log as json * fix: hide ports when not applicable * refactor: dry logger code * fix: ci to use latest stable * fix: clippy * fix: ci-run ip parsing * fix: PacketLogger is no longer dead code * fix: comment typos Co-authored-by: Andrew <[email protected]> Co-authored-by: Andrew <[email protected]>
- Loading branch information
Showing
31 changed files
with
1,425 additions
and
604 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
{ | ||
"rust-analyzer.linkedProjects": ["userspace/Cargo.toml", "ebpf/Cargo.toml"] | ||
"rust-analyzer.linkedProjects": ["userspace/Cargo.toml", "ebpf/Cargo.toml"], | ||
"rust-analyzer.checkOnSave.extraArgs": ["--manifest-path", "userspace/Cargo.toml"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
{ | ||
"rust-analyzer.cargo.target": "bpfel-unknown-none", | ||
"rust-analyzer.checkOnSave.allTargets": false, | ||
"rust-analyzer.checkOnSave.extraArgs": ["--manifest-path", "ebpf/Cargo.toml"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
peers/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
FROM lscr.io/linuxserver/wireguard:latest | ||
|
||
|
||
RUN \ | ||
echo "**** install dependencies ****" && \ | ||
apt-get update && \ | ||
apt-get install -y --no-install-recommends \ | ||
iperf3 && \ | ||
echo "**** cleanup ****" && \ | ||
apt-get autoremove && \ | ||
apt-get clean && \ | ||
rm -rf \ | ||
/tmp/* \ | ||
/var/lib/apt/lists/* \ | ||
/var/tmp/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
version: '3.8' | ||
|
||
services: | ||
wireguard_server: | ||
build: . | ||
image: fw-benchmark:latest | ||
volumes: | ||
- ../target/release/examples/benchmark:/benchmark | ||
- ./peers/:/config/:rw | ||
environment: | ||
- PEERS=2 | ||
- SERVERURL=172.8.0.2 | ||
- LOG_CONFS=false | ||
- PUID=1000 | ||
- PGID=1000 | ||
- RUST_LOG=trace | ||
cap_add: | ||
- NET_ADMIN | ||
- SYS_MODULE | ||
sysctls: | ||
- net.ipv4.ip_forward=1 | ||
- net.ipv4.conf.all.src_valid_mark=1 | ||
# Not sure what capabilities are required to create eBPF maps | ||
privileged: true | ||
networks: | ||
internal: | ||
ipv4_address: 172.8.0.100 | ||
command: /benchmark --iface wg0 | ||
|
||
peer1: | ||
image: fw-benchmark:latest | ||
volumes: | ||
- ./peers/peer1/peer1.conf:/config/wg0.conf | ||
cap_add: | ||
- NET_ADMIN | ||
- SYS_MODULE | ||
sysctls: | ||
- net.ipv4.ip_forward=1 | ||
- net.ipv4.conf.all.src_valid_mark=1 | ||
environment: | ||
- PUID=1000 | ||
- PGID=1000 | ||
networks: | ||
- internal | ||
command: iperf3 -s -B 10.13.13.2 | ||
#command: ping 10.13.13.3 | ||
|
||
peer2: | ||
image: fw-benchmark:latest | ||
volumes: | ||
- ./peers/peer2/peer2.conf:/config/wg0.conf | ||
cap_add: | ||
- NET_ADMIN | ||
- SYS_MODULE | ||
sysctls: | ||
- net.ipv4.ip_forward=1 | ||
- net.ipv4.conf.all.src_valid_mark=1 | ||
environment: | ||
- PUID=1000 | ||
- PGID=1000 | ||
networks: | ||
- internal | ||
command: iperf3 -c 10.13.13.2 -b 1G | ||
#command: ping 10.13.13.2 | ||
|
||
networks: | ||
internal: | ||
ipam: | ||
config: | ||
- subnet: 172.8.0.0/16 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.