yuuki / go-conntracer-bpf

Go library using eBPF to trace network flow events

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

go-conntracer-bpf

Go Reference

go-conntracer-bpf is a library for Go for tracing network connection (TCP/UDP) events (connect, accept, sendto, recvfrom) on BPF kprobe inspired by weaveworks/tcptracer-bpf. go-conntracer-bpf is implemented on top of libbpf, which is a representative C library for BPF included Linux kernel.

Features

  • Low-overhead tracing by aggregating connection events in kernel.
  • BPF CO-RE (Compile Once – Run Everywhere)-enabled

Flow events aggregation in kernel

Prerequisites

Compilation phase

  • libbpf source code
  • Clang/LLVM >= 9

Runtime phase

Common to both phase

  • libelf and zlib libraries

Features of Linux kernel included in go-conntracer-bpf

go-conntracer-bpf makes use of some latest features of Linux kernel.

  • BPF Type Format (BTF) in kernel version 4.18.
  • Batch API to BPF map (BPF_MAP_UPDATE_BATCH, BPF_MAP_LOOKUP_AND_DELETE_BATCH) in kernel version 5.6.
  • Ring Buffer in kernel version 5.8 (only a flavor of no-aggregation in kernel).

Usage

conntop

conntop is a CLI tool to show connection events.

Build conntop

$ make DOCKER=1

Projects using go-conntracer-bpf

About

Go library using eBPF to trace network flow events

License:Apache License 2.0


Languages

Language:C 98.8%Language:Go 1.0%Language:Makefile 0.1%Language:Shell 0.0%Language:Dockerfile 0.0%Language:Ruby 0.0%