nft

package
v1.14.0 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2024 License: MIT Imports: 33 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 struct {
	Tables dkt.HDict[NfTableKey, *nftlib.Table]
	Sets   dkt.HDict[NfTableKey, dkt.HDict[string, NfSet]]
	Chains dkt.HDict[NfTableKey, dkt.HDict[NfChainKey, NfChain]]
}

NFTablesConf -

func (*NFTablesConf) Load

func (cnf *NFTablesConf) Load(conn *nftlib.Conn) error

type NetConf

type NetConf = host.NetConf

NetConf is an alias

type NfChain

type NfChain struct {
	*nftlib.Chain
	Rules []*nftlib.Rule
}

NfChain -

type NfChainKey

type NfChainKey struct {
	ChainType nftlib.ChainType
	Name      string
}

NfChainKey -

func (NfChainKey) String

func (k NfChainKey) String() string

String -

type NfSet

type NfSet struct {
	*nftlib.Set
	Elements []nftlib.SetElement
}

NfSet -

type NfTableKey

type NfTableKey struct {
	nftlib.TableFamily
	Name string
}

NfTableKey -

func (NfTableKey) String

func (k NfTableKey) String() string

String -

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