nft

package
v2.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2024 License: MIT Imports: 30 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")

	// ErrPatchNotApplicable
	ErrPatchNotApplicable = errors.New("patch is not applicable")
)
View Source
var NewTx = nftrc.NewTx

NewTx creates transaction conn to netfilter

Functions

func BeginRule

func BeginRule() (ret ruleBuilder)

BeginRule -

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   resources.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 resources.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 = nftrc.StateOfNFTables

NFTablesConf is a type alias

func NFTconfLoad

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 = nftrc.NfChain

NfChain is a type alias

type NfChainKey

type NfChainKey = nftrc.NfChainKey

NfChainKey is a type alias

type NfSet

type NfSet = nftrc.NfSet

NfSet is a type alias

type NfTableKey

type NfTableKey = nftrc.NfTableKey

NfTableKey is a type alias

type NfTablesProcessor

type NfTablesProcessor interface {
	ApplyConf(ctx context.Context, data resources.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 = nftrc.Tx

Tx -

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