userdata

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2025 License: Apache-2.0 Imports: 2 Imported by: 3

Documentation

Overview

Package userdata implements a TLV parser/serializer for libnftables-compatible comments

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Append

func Append(udata []byte, typ Type, data []byte) []byte

func AppendString

func AppendString(udata []byte, typ Type, str string) []byte

func AppendUint32

func AppendUint32(udata []byte, typ Type, num uint32) []byte

func Get

func Get(udata []byte, styp Type) []byte

func GetString

func GetString(udata []byte, typ Type) (string, bool)

func GetUint32

func GetUint32(udata []byte, typ Type) (uint32, bool)

Types

type Type

type Type byte
const (
	TypeComment Type = iota
	TypeEbtablesPolicy

	TypesCount
)

TLV type values are defined in: https://git.netfilter.org/iptables/tree/iptables/nft.c?id=73611d5582e72367a698faf1b5301c836e981465#n1659

const (
	NFTNL_UDATA_SET_KEYBYTEORDER Type = iota
	NFTNL_UDATA_SET_DATABYTEORDER
	NFTNL_UDATA_SET_MERGE_ELEMENTS
	NFTNL_UDATA_SET_KEY_TYPEOF
	NFTNL_UDATA_SET_DATA_TYPEOF
	NFTNL_UDATA_SET_EXPR
	NFTNL_UDATA_SET_DATA_INTERVAL
	NFTNL_UDATA_SET_COMMENT

	NFTNL_UDATA_SET_MAX
)

TLV type values are defined in: https://git.netfilter.org/libnftnl/tree/include/libnftnl/udata.h#n39

const (
	NFTNL_UDATA_SET_ELEM_COMMENT Type = iota
	NFTNL_UDATA_SET_ELEM_FLAGS
)

Set element userdata types

Jump to

Keyboard shortcuts

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