nft

package
v1.15.0 Latest Latest
Warning

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

Go to latest
Published: May 29, 2024 License: MIT Imports: 34 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// MainTablePrefix -
	MainTablePrefix = "main"
)

Variables

View Source
var (
	// ErrNfTablesProcessor points to error came from 'NfTablesProcessor'
	ErrNfTablesProcessor = errors.New("NfTablesProcessor error")

	// ErrPortRange is a port range error
	ErrPortRange = errors.Errorf("out of port range [0, %v)", math.MaxUint16)

	// ErrPatchNotApplicable
	ErrPatchNotApplicable = errors.New("patch is not applicable")
)

Functions

func IfBaseRulesFromConfig

func IfBaseRulesFromConfig(ctx context.Context, cons func(BaseRules) error) error

IfBaseRulesFromConfig -

func LastAppliedRulesUpd

func LastAppliedRulesUpd(netNS string, data *AppliedRules)

LastAppliedRulesUpd -

func MakeBatchBackoff

func MakeBatchBackoff() backoff.Backoff

MakeBatchBackoff -

func PatchAppliedRules

func PatchAppliedRules(ctx context.Context, rules *AppliedRules, p Patch) (err error)

PatchAppliedRules -

func WithBaseRules

func WithBaseRules(baseRules BaseRules) funcBatchOpt

WithBaseRules -

func WithLogger

func WithLogger(l logger.TypeOfLogger) funcBatchOpt

WithLogger -

Types

type AppliedRules

type AppliedRules struct {
	ID          uuid.UUID
	NetNS       string
	TargetTable string
	BaseRules   BaseRules
	LocalData   cases.LocalData
}

AppliedRules -

func LastAppliedRules

func LastAppliedRules(netNS string) *AppliedRules

LastAppliedRules -

type BaseRules

type BaseRules struct {
	Nets []config.NetCIDR
}

BaseRules -

type BatchOpt

type BatchOpt interface {
	// contains filtered or unexported methods
}

BatchOpt -

type BatchPerformer

type BatchPerformer struct {
	TableName string
	Tx        TxProvider
}

BatchPerformer -

func (*BatchPerformer) Exec

func (exc *BatchPerformer) Exec(ctx context.Context, data cases.LocalData, opts ...BatchOpt) error

Exec -

type IPAdresses

type IPAdresses = host.IPAdresses

IPAdresses is an alias

type IPAdressesMapKey

type IPAdressesMapKey = host.IPAdressesMapKey

IPAdressesMapKey is an alias

type IpAddr

type IpAddr = host.IpAddr

IpAddr is an alias

type IpDev

type IpDev = host.IpDev

IpDev is an alias

type IpDevs

type IpDevs = host.IpDevs

IpDevs is an alias

type LinkID

type LinkID = host.LinkID

LinkID is an alias

type LinkRefs

type LinkRefs = host.LinkRefs

LinkRefs is an alias

type NFTablesConf

type NFTablesConf = inner.StateOfNFTables

NFTablesConf is a type alias

func NFTconfLoad added in v1.15.0

func NFTconfLoad(conn *nftlib.Conn) (NFTablesConf, error)

NFTconfLoad it loads current nftables config

type NetConf

type NetConf = host.NetConf

NetConf is an alias

type NfChain

type NfChain = inner.NfChain

NfChain is a type alias

type NfChainKey

type NfChainKey = inner.NfChainKey

NfChainKey is a type alias

type NfSet

type NfSet = inner.NfSet

NfSet is a type alias

type NfTableKey

type NfTableKey = inner.NfTableKey

NfTableKey is a type alias

type NfTablesProcessor

type NfTablesProcessor interface {
	ApplyConf(ctx context.Context, data cases.LocalData) (AppliedRules, error)
	Close() error
}

NfTablesProcessor abstract interface

func NewNfTablesProcessor

func NewNfTablesProcessor(client SGClient, opts ...NfTablesProcessorOpt) NfTablesProcessor

NewNfTablesProcessor creates NfTablesProcessor from SGClient

type NfTablesProcessorOpt

type NfTablesProcessorOpt interface {
	// contains filtered or unexported methods
}

NfTablesProcessorOpt constructor option(s)

type Patch

type Patch interface {
	String() string
	Apply(context.Context, *AppliedRules) error
	// contains filtered or unexported methods
}

Patch -

type SGClient

type SGClient = sgAPI.SecGroupServiceClient

SGClient is a type alias

type Tx

type Tx struct {
	*nftLib.Conn
	// contains filtered or unexported fields
}

Tx -

func NewTx

func NewTx(netNS string) (*Tx, error)

NewTx -

func (*Tx) Close

func (tx *Tx) Close() error

Close impl 'Closer'

func (*Tx) FlushAndClose

func (tx *Tx) FlushAndClose() error

FlushAndClose does flush and close

type TxProvider

type TxProvider func() (*Tx, error)

TxProvider -

type UpdStrategy

type UpdStrategy = host.UpdStrategy

UpdStrategy is an alias

type UpdateFqdnNetsets

type UpdateFqdnNetsets struct {
	IPVersion int
	FQDN      model.FQDN
	Addresses []net.IP
}

UpdateFqdnNetsets - is kind of Patch

func (UpdateFqdnNetsets) Apply

func (ns UpdateFqdnNetsets) Apply(ctx context.Context, rules *AppliedRules) error

Apply -

func (UpdateFqdnNetsets) NetSet

func (ns UpdateFqdnNetsets) NetSet() []net.IPNet

NetSet -

func (UpdateFqdnNetsets) String

func (p UpdateFqdnNetsets) String() string

String impl Stringer interface

type WithNetNS

type WithNetNS struct {
	NetNS string
}

WithNetNS use network namespace

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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