Categorygithub.com/florianl/go-conntrack
modulepackage
0.4.0
Repository: https://github.com/florianl/go-conntrack.git
Documentation: pkg.go.dev

# README

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

func main() {
	nfct, err := ct.Open(&ct.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(ct.Expected, ct.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

# Functions

Open a connection to the conntrack subsystem.
ParseAttributes extracts all the attributes from the given data.

# Constants

variable length */.
variable length */.
u64 bits */.
u8 bits */.
u8 bits */.
u32 bits */.
u128 bits */.
u16 bits */.
u32 bits */.
u32 bits */.
u32 bits */.
u32 bits */.
variable length */.
string (30 bytes max) */.
u8 bits */.
u16 bits */.
u8 bits */.
u8 bits */.
u16 bits */.
u8 bits */.
u32 bits */.
u32 bits, requires a mask if applied as filter */.
u32 bits */.
u32 bits */.
u32 bits */.
u128 bits */.
u128 bits */.
u8 bits */.
u8 bits */.
u16 bits */.
u16 bits */.
u64 bits */.
u64 bits */.
u32 bits, requires a mask if applied as filter */.
u32 bits, requires a mask if applied as filter */.
u128 bits */.
u128 bits */.
u8 bits */.
u8 bits */.
u32 bits */.
u32 bits */.
u32 bits */.
u16 bits */.
u16 bits */.
u16 bits */.
u64 bits */.
u64 bits */.
u32 bits, requires a mask if applied as filter */.
u32 bits, requires a mask if applied as filter */.
u128 bits */.
u128 bits */.
u8 bits */.
u8 bits */.
u32 bits */.
u32 bits */.
u32 bits */.
u16 bits */.
u16 bits */.
u16 bits */.
u8 bits */.
u32 bits */.
u32 bits */.
string */.
u32 bits */.
u32 bits */.
u128 bits */.
u16 bits */.
u32 bits */.
u8 bits */.
u8 bits */.
u8 bits */.
u8 bits */.
u8 bits */.
u8 bits */.
u8 bits */.
u32 bits */.
u64 bits linux >= 2.6.38 */.
u64 bits linux >= 2.6.38 */.
u32 bits */.
u16 bits */.
Conntrack is the default table containing a list of all tracked connections.
Expected is a table containing information about related connections to existing ones.
Supported family types.
Supported family types.
Supported Netlink groups.
Supported Netlink groups.
Supported Netlink groups.
Supported Netlink groups.
Supported Netlink groups.
Supported Netlink groups.

# Variables

Various errors which may occur when processing attributes.
Various errors which may occur when processing attributes.
Various errors which may occur when processing attributes.
Various errors which may occur when processing attributes.
Various errors which may occur when processing filters.
Various errors which may occur when processing filters.
Various errors which may occur when processing filters.
Various errors which may occur when processing filters.
Error which may occur when processing the filter attribute.
Various errors which may occur when processing filters.
ErrUnknownCtTable will be return, if the function can not be performed on this subsystem.

# Structs

Con contains all the information of a connection.
Config contains options for a Conn.
ConnAttr represents the type and value of a attribute of a connection.
Counter contains additional information about the traffic.
CPUStat contains various conntrack related per CPU statistics.
DCCPInfo contains additional information for DCCP sessions.
ErrMsg as defined in nlmsgerr.
Exp extends the information of a connection by information from the expected table.
FilterAttr represents a very basic filter.
Helper contains additional information.
InfoSource provides further information from Netlink about a connection.
IPTuple contains the source and destination IP.
Nat contains information for source/destination NAT.
NatInfo contains addition NAT information of a connection.
Nfct represents a conntrack handler.
ProtoInfo contains additional information to certain protocols.
ProtoTuple contains information about the used protocol.
SCTPInfo contains additional information for SCTP sessions.
SecCtx contains additional information about the security context.
SeqAdj contains additional information about corrections.
TCPFlags contains additional information for TCP flags.
TCPInfo contains additional information for TCP sessions.
Timestamp contains start and/or stop times.

# Type aliases

ConnAttrType specifies the attribute of a connection.
Family specifies the network family.
HookFunc is a function, that receives events from a Netlinkgroup.
NetlinkGroup represents a Netlink multicast group.
Table specifies the subsystem of conntrack.