network

package
v1.7.1 Latest Latest
Warning

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

Go to latest
Published: May 1, 2024 License: MPL-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package network implements adapters wrapping resources/network to provide additional functionality.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BondMasterSpec

func BondMasterSpec(r *network.BondMasterSpec) bondMaster

BondMasterSpec adapter provides encoding/decoding to netlink structures.

func BridgeMasterSpec

func BridgeMasterSpec(r *network.BridgeMasterSpec) bridgeMaster

BridgeMasterSpec adapter provides encoding/decoding to netlink structures.

func BuildIPSet added in v1.6.0

func BuildIPSet(include, exclude []netip.Prefix) (*netipx.IPSet, error)

BuildIPSet builds an IPSet from the given include and exclude prefixes.

func NfTablesRule added in v1.6.0

func NfTablesRule(r *network.NfTablesRule) nftablesRule

NfTablesRule adapter provides encoding to nftables instructions.

func SplitIPSet added in v1.6.0

func SplitIPSet(set *netipx.IPSet) (ipv4, ipv6 []netipx.IPRange)

SplitIPSet splits the given IPSet into IPv4 and IPv6 ranges.

func VLANSpec

func VLANSpec(r *network.VLANSpec) vlanSpec

VLANSpec adapter provides encoding/decoding to netlink structures.

func WireguardSpec

func WireguardSpec(r *network.WireguardSpec) wireguardSpec

WireguardSpec adapter provides encoding/decoding to netlink structures.

Types

type NfTablesCompiled added in v1.6.0

type NfTablesCompiled struct {
	Rules [][]expr.Any
	Sets  []NfTablesSet
}

NfTablesCompiled is a compiled representation of the rule.

type NfTablesSet added in v1.6.0

type NfTablesSet struct {
	Kind            SetKind
	Addresses       []netipx.IPRange
	Ports           [][2]uint16
	Strings         [][]byte
	ConntrackStates []nethelpers.ConntrackState
}

NfTablesSet is a compiled representation of the set.

func (NfTablesSet) IsInterval added in v1.6.0

func (set NfTablesSet) IsInterval() bool

IsInterval returns true if the set is an interval set.

func (NfTablesSet) KeyType added in v1.6.0

func (set NfTablesSet) KeyType() nftables.SetDatatype

KeyType returns the type of the set.

func (NfTablesSet) SetElements added in v1.6.0

func (set NfTablesSet) SetElements() []nftables.SetElement

SetElements returns the set elements.

type SetKind added in v1.6.0

type SetKind uint8

SetKind is the type of the nftables Set.

const (
	SetKindIPv4 SetKind = iota
	SetKindIPv6
	SetKindPort
	SetKindIfName
	SetKindConntrackState
)

SetKind constants.

Jump to

Keyboard shortcuts

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