network

package
v0.6.3 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2024 License: MPL-2.0 Imports: 17 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

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

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

func NfTablesRule

func NfTablesRule(r *network.NfTablesRule) nftablesRule

NfTablesRule adapter provides encoding to nftables instructions.

func SplitIPSet

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

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

NfTablesCompiled is a compiled representation of the rule.

type NfTablesSet

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

func (set NfTablesSet) IsInterval() bool

IsInterval returns true if the set is an interval set.

func (NfTablesSet) KeyType

func (set NfTablesSet) KeyType() nftables.SetDatatype

KeyType returns the type of the set.

func (NfTablesSet) SetElements

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

SetElements returns the set elements.

type SetKind

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