nstats
nstats is a small Go project for loading an XDP program on a network interface and viewing basic packet and byte counters in the terminal.

Requirements
- Linux with XDP/eBPF support
- Go 1.20+
clang for go generate
- Root privileges to attach the XDP program
Fedora
If you are building on Fedora, install the required packages first:
sudo dnf install clang llvm libbpf libbpf-devel bpftool elfutils-libelf-devel kernel-headers
Build
go generate ./...
go build -o nstats .
Usage
Load the XDP program onto an interface:
sudo ./nstats load --dev eth0 --sec xdp.pass
Available sections:
xdp.pass
xdp.drop
xdp.aborted
In another terminal, view stats:
sudo ./nstats stats
For extra map details:
sudo ./nstats stats --verbose
The stats view updates once per second. Press q or Ctrl-C to quit.