nstats

command module
v0.0.0-...-158867b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 5, 2026 License: MIT Imports: 10 Imported by: 0

README

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.

Example nstats stats output

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.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL