ti-mo/conntrack

Pure-Go Conntrack implementation; for humans.

Go

164

268 commits

updated Nov 12, 2025

See the code

README

conntrack GoDoc Tests Status Coverage Status Go Report Card

Package conntrack implements the Conntrack subsystem of the Netfilter (Netlink) protocol family. The package is intended to be clear, user-friendly, thoroughly tested and easy to understand.

It is purely written in Go, without any dependency on Cgo or any C library, kernel headers or userspace tools. It uses a native Netlink implementation (https://github.com/mdlayher/netlink) and does not parse or scrape any output of the conntrack command.

It is designed in a way that makes the user acquainted with the structure of the protocol, with a clean separation between the Conntrack types/attributes and the Netfilter layer (implemented in https://github.com/ti-mo/netfilter).

All Conntrack attributes known to the kernel up until version 4.17 are implemented. There is experimental support for manipulating Conntrack 'expectations', beside listening and dumping. The original focus of the package was receiving Conntrack events over Netlink multicast sockets, but was since expanded to be a full implementation supporting queries.

Features

With this library, the user can:

  • Interact with conntrack connections and expectations through Flow and Expect types respectively
  • Create, get, update and delete Flows in an idiomatic way (and Expects, to an extent)
  • Listen for create/update/destroy events
  • Flush (empty) and dump (display) the whole conntrack table, optionally filtering on specific flow fields

There are many usage examples in the godoc.

Contributing

Contributions are absolutely welcome! Before starting work on large changes, please create an issue first, or join #networking on Gophers Slack to discuss the design.

If you encounter a problem implementing the library, please open a GitHub issue for help.

conntrack
golang-library
hacktoberfest
netfilter
netlink

ti-mo/conntrack

Pure-Go Conntrack implementation; for humans.

Go

164

268 commits

updated Nov 12, 2025

See the code

README

conntrack GoDoc Tests Status Coverage Status Go Report Card

Package conntrack implements the Conntrack subsystem of the Netfilter (Netlink) protocol family. The package is intended to be clear, user-friendly, thoroughly tested and easy to understand.

It is purely written in Go, without any dependency on Cgo or any C library, kernel headers or userspace tools. It uses a native Netlink implementation (https://github.com/mdlayher/netlink) and does not parse or scrape any output of the conntrack command.

It is designed in a way that makes the user acquainted with the structure of the protocol, with a clean separation between the Conntrack types/attributes and the Netfilter layer (implemented in https://github.com/ti-mo/netfilter).

All Conntrack attributes known to the kernel up until version 4.17 are implemented. There is experimental support for manipulating Conntrack 'expectations', beside listening and dumping. The original focus of the package was receiving Conntrack events over Netlink multicast sockets, but was since expanded to be a full implementation supporting queries.

Features

With this library, the user can:

  • Interact with conntrack connections and expectations through Flow and Expect types respectively
  • Create, get, update and delete Flows in an idiomatic way (and Expects, to an extent)
  • Listen for create/update/destroy events
  • Flush (empty) and dump (display) the whole conntrack table, optionally filtering on specific flow fields

There are many usage examples in the godoc.

Contributing

Contributions are absolutely welcome! Before starting work on large changes, please create an issue first, or join #networking on Gophers Slack to discuss the design.

If you encounter a problem implementing the library, please open a GitHub issue for help.

conntrack
golang-library
hacktoberfest
netfilter
netlink

Project health

Overall

3.0/10

Maintained

0/10

Code review

2/10
OpenSSF Scorecard

Latest release

v0.6.0 · Oct 20, 2025

Releases this year

1

Significant stargazers

Antonio Ojea

599 followers · starred Jan 2024

Cyclinder

46 followers · starred Oct 2023

Andrew Onyshchuk

35 followers · starred Oct 2024

jony montana

38 followers · starred Oct 2023