Skip to content

florianl/go-conntrack

main
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
March 18, 2023 11:10
November 28, 2020 14:29
October 8, 2022 16:51
January 2, 2020 08:44
October 23, 2019 11:15
February 14, 2020 16:03
March 18, 2023 11:10
September 10, 2022 10:29
November 28, 2019 10:15
October 21, 2019 19:33
October 21, 2019 19:33
January 8, 2022 15:50
January 8, 2022 15:50
December 3, 2022 10:16
February 18, 2020 20:04

go-conntrack PkgGoDev Go Report Card Go

This is go-conntrack and it is written in golang. It provides a C-binding free API to the conntrack subsystem of the Linux kernel.

Example

package main

import (
	"fmt"

	"github.com/florianl/go-conntrack"
)

func main() {
	nfct, err := conntrack.Open(&conntrack.Config{})
	if err != nil {
		fmt.Println("could not create nfct:", err)
		return
	}
	defer nfct.Close()

	// Get all IPv4 entries of the expected table.
	sessions, err := nfct.Dump(conntrack.Expected, conntrack.IPv4)
	if err != nil {
		fmt.Println("could not dump sessions:", err)
		return
	}

	// Print out all expected sessions.
	for _, session := range sessions {
		fmt.Printf("%#v\n", session)
	}
}

Requirements