Oryx is split across two execution contexts: a small eBPF program that runs inside the Linux kernel as a TC (Traffic Control) classifier, and a userspace application built on Aya and Ratatui. The kernel program sees every packet on the selected interface before the networking stack processes it, decodes the relevant headers, and writes the result into a shared ring buffer. The userspace process drains that buffer in aDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/pythops/oryx/llms.txt
Use this file to discover all available pages before exploring further.
mio event loop, parses the raw bytes into typed Rust structures, and renders the TUI in real time.
The current release is 0.8.0.
Workspace layout
The repository is a Cargo workspace with four crates:oryx-ebpf
eBPF kernel programs. Compiled with
#![no_std] for the BPF target using aya-ebpf. Contains the single oryx TC classifier entry point and all eBPF maps.oryx-common
Shared data types that cross the kernel/userspace boundary:
RawData, RawFrame, RawPacket, ProtoHdr, IgmpHdr, and the Protocol / TransportProtocol / NetworkProtocol / LinkProtocol enums. Also compiled with #![no_std] so it can be used by oryx-ebpf.oryx-tui
Userspace TUI application. Loads the eBPF program with Aya, manages all eBPF maps, processes packets, and renders the interface with Ratatui and crossterm.
xtask
Build orchestration. Invoked via
cargo xtask build or cargo xtask run. Compiles oryx-ebpf for the BPF target first, then compiles oryx-tui for the host.Data flow
Key components
RingBuffer and the DATA map
The eBPF side declares aRingBuf map named DATA:
RawData value — a fixed-size repr(C) struct containing the Ethernet frame (RawFrame) and an optional PID for egress packets. The PID is available only on egress when the bpf_get_current_pid_tgid helper is enabled.
On the userspace side, RingBuffer wraps the Aya RingBuf handle and implements mio::event::Source so it can be polled efficiently without spinning:
eBPF maps
| Map | Type | Purpose |
|---|---|---|
DATA | RingBuf | Kernel-to-userspace packet stream |
NETWORK_FILTERS | Array<u32> | Per-protocol network filter flags (8 slots) |
TRANSPORT_FILTERS | Array<u32> | Per-protocol transport filter flags (8 slots) |
LINK_FILTERS | Array<u32> | Per-protocol link filter flags (8 slots) |
TRAFFIC_DIRECTION_FILTER | Array<u8> | Direction filter flag |
BLOCKLIST_IPV4 | HashMap<u32, [u16; 32]> | IPv4 firewall rules (up to 32 entries, 32 ports each) |
BLOCKLIST_IPV6 | HashMap<u128, [u16; 32]> | IPv6 firewall rules (up to 32 entries, 32 ports each) |
Traffic direction
Two TC programs are attached — one on ingress and one on egress — sharing the same classifier function. Direction is communicated via theTRAFFIC_DIRECTION global variable (-1 = ingress, 1 = egress). The TRAFFIC_DIRECTION_FILTER map can suppress one direction entirely.
TUI sections
The Ratatui interface is divided into five sections, accessible viaTab / Shift+Tab:
| Section | Description |
|---|---|
| Inspection | Live packet list with fuzzy search (/) and per-packet detail view (i) |
| Firewall | Create, edit, enable/disable, and persist eBPF-backed firewall rules |
| Stats | Traffic statistics including top destinations |
| Metrics | Metrics explorer for bandwidth and packet counts |
| Alert | Displays detected anomalies such as potential SYN flood attacks |
Firewall
Firewall rules are enforced inside the kernel classifier before any data is written to the ring buffer. When a TCP, UDP, or SCTP packet arrives, the eBPF program looks up the relevant address inBLOCKLIST_IPV4 or BLOCKLIST_IPV6. If the address is found and either all ports are blocked (blocked_ports[0] == 0) or the specific port matches, the packet is dropped with TC_ACT_SHOT. Rules can be saved to ~/oryx/firewall.json and are reloaded on the next run.
Key dependencies
| Crate | Version | Role |
|---|---|---|
aya | 0.13 | Load and manage eBPF programs and maps from userspace |
aya-ebpf | 0.1.1 | eBPF-side macros and helpers (#[map], #[classifier], etc.) |
ratatui | 0.30 | Terminal UI framework |
crossterm | 0.29 | Cross-platform terminal backend for Ratatui |
mio | 1 | Async I/O event loop for polling the ring buffer |
kanal | 0.1 | Fast MPMC channels for passing packets between threads |
network-types | git | Zero-copy Rust structs for Ethernet, IP, TCP, UDP, SCTP, ICMP, IGMP, ARP headers |
clap | 4 | CLI argument parsing |
serde_json | 1 | Serialise/deserialise firewall rules |