nftables

package
v1.5.3 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2024 License: AGPL-3.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsSupported

func IsSupported() bool

func LineParser

func LineParser(i uint, t string) (rowInfo cmdutils.RowInfo, err error)

func ResetCheck

func ResetCheck()

Types

type Base added in v1.3.5

type Base struct {
	TableFamily nftables.TableFamily

	*biz.NFTables
	// contains filtered or unexported fields
}

documention: https://wiki.nftables.org/wiki-nftables/index.php/Simple_rule_management

func (*Base) DeleteElementInSet added in v1.3.5

func (a *Base) DeleteElementInSet(table, set, element string) (err error)

func (*Base) DeleteElementInSetByHandleID added in v1.3.5

func (a *Base) DeleteElementInSetByHandleID(table, set string, handleID uint64) (err error)

func (*Base) DeleteRuleByHandleID added in v1.3.5

func (a *Base) DeleteRuleByHandleID(table, chain string, handleID uint64) (err error)

func (*Base) DeleteSet added in v1.3.5

func (a *Base) DeleteSet(table, set string) (err error)

func (*Base) FindPositionByID added in v1.3.5

func (a *Base) FindPositionByID(table, chain string, id uint) (uint, error)

func (*Base) ListChainRules added in v1.3.5

func (a *Base) ListChainRules(table, chain string, startOffset, limit uint) (rows []cmdutils.RowInfo, hasMore bool, offset uint, err error)

func (*Base) ListSets added in v1.3.5

func (a *Base) ListSets(table, set string, startOffset, limit uint) (rows []cmdutils.RowInfo, hasMore bool, offset uint, err error)

func (*Base) NewRuleTarget added in v1.3.5

func (a *Base) NewRuleTarget(table, chain string) (ruleutils.RuleTarget, error)

type NFTables

type NFTables struct {
	// contains filtered or unexported fields
}

func New

func New(proto driver.Protocol) (*NFTables, error)

func (*NFTables) AddDefault added in v1.4.7

func (a *NFTables) AddDefault() error

func (*NFTables) Append

func (a *NFTables) Append(rules ...driver.Rule) (err error)

func (*NFTables) AsWhitelist

func (a *NFTables) AsWhitelist(tableName, chainName string) error

func (*NFTables) Ban added in v1.4.7

func (a *NFTables) Ban(ips []string, expires time.Duration) error

func (*NFTables) Base added in v1.3.5

func (a *NFTables) Base() *Base

func (*NFTables) Clear added in v1.3.5

func (a *NFTables) Clear() error

Clear 清空规则

func (*NFTables) Delete

func (a *NFTables) Delete(rules ...driver.Rule) (err error)

func (*NFTables) DeleteByHandleID

func (a *NFTables) DeleteByHandleID(rules ...driver.Rule) (err error)

func (*NFTables) Enabled

func (a *NFTables) Enabled(on bool) error

func (*NFTables) Exists

func (a *NFTables) Exists(rule driver.Rule) (bool, error)

func (*NFTables) Export

func (a *NFTables) Export(wfwFile string) error

func (*NFTables) FindPositionByID added in v1.3.5

func (a *NFTables) FindPositionByID(table, chain string, id uint) (uint, error)

func (*NFTables) Import

func (a *NFTables) Import(wfwFile string) error

func (*NFTables) Insert

func (a *NFTables) Insert(rules ...driver.Rule) (err error)

func (*NFTables) Reset

func (a *NFTables) Reset() error

Reset 删除本实例创建的所有数据

func (*NFTables) Update

func (a *NFTables) Update(rule driver.Rule) error

Update update rulespec in specified table/chain

Jump to

Keyboard shortcuts

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