Documentation
¶
Index ¶
- Constants
- func Apply(nft Nft) error
- func ApplyFromFile(cfg string) error
- func Drop(family Family, table, chain string, handle int) error
- func DropRules(sub Nft) error
- func IPv4Set(family Family, table string, name string, ips ...string) error
- func IPv4SetDel(family Family, table, name string, ips ...string) error
- func IPv4SetGet(family Family, table, name string) ([]string, error)
- type Chain
- type Chains
- type Family
- type Nft
- type NftChainBlock
- type NftJsonBlock
- type NftRuleBlock
- type NftSetBlock
- type NftTableBlock
- type Rule
- type Set
- type Sets
- type Table
- type Type
Constants ¶
View Source
const ( NFT = iota TABLE CHAIN FamilyIP = Family("ip") FamilyIP6 = Family("ip6") FamilyNET = Family("net") FamilyINET = Family("inet") FamilyARP = Family("arp") FamilyBridge = Family("bridge") TypeSkipCreate = Type("") TypeNAT = Type("nat") TypeFilter = Type("filter") )
View Source
const ( //NFTDebug if true, nft files will not be deleted for inspection NFTDebug = false )
Variables ¶
This section is empty.
Functions ¶
func ApplyFromFile ¶
ApplyFromFile applies nft rules from a file
func IPv4SetDel ¶ added in v1.5.0
IPv4SetDel delete ips from a ipv4_addr set
Types ¶
type Nft ¶
func (Nft) MarshalText ¶
type NftChainBlock ¶ added in v1.5.0
type NftChainBlock struct {
/*
{'hook': 'prerouting',
'family': 'ip',
'prio': 0,
'table': 'nat',
'name': 'pre',
'handle': 1,
'type': 'nat',
'policy': 'accept'}
*/
Hook string `json:"hook"`
Family Family `json:"family"`
Priority int `json:"prio"`
Table string `json:"table"`
Name string `json:"name"`
Handle int `json:"handle"`
Type Type `json:"type"`
Policy string `json:"policy"`
}
type NftJsonBlock ¶ added in v1.5.0
type NftJsonBlock map[string]json.RawMessage
NftJsonBlock defines a nft json block
type NftRuleBlock ¶ added in v1.5.0
type NftRuleBlock struct {
/*
{'family': 'inet',
'expr': [{'match': {'right': {'set': ['established', 'related']},
'left': {'ct': {'key': 'state'}}}},
{'accept': None}],
'table': 'filter',
'handle': 5,
'chain': 'input'}
*/
Family Family `json:"family"`
Expresion []NftJsonBlock `json:"expr"`
Table string `json:"table"`
Handle int `json:"handle"`
Chain string `json:"chain"`
}
type NftSetBlock ¶ added in v1.5.0
type NftTableBlock ¶ added in v1.5.0
Click to show internal directories.
Click to hide internal directories.