Compare commits
2 Commits
f5b1888420
...
053ca9a37f
| Author | SHA1 | Date | |
|---|---|---|---|
|
053ca9a37f
|
|||
|
7cd41f8491
|
17
nft.go
17
nft.go
@@ -7,10 +7,22 @@ import (
|
|||||||
// NFT A client for working with nftables
|
// NFT A client for working with nftables
|
||||||
type NFT interface {
|
type NFT interface {
|
||||||
// Clear clears all rules.
|
// Clear clears all rules.
|
||||||
|
//
|
||||||
|
// This command is equivalent to:
|
||||||
|
// nft flush ruleset
|
||||||
Clear() error
|
Clear() error
|
||||||
|
|
||||||
// AddTable adds a new table.
|
// AddTable adds a new table.
|
||||||
|
//
|
||||||
|
// This command is equivalent to:
|
||||||
|
// nft add table (ip|ip6|inet|arp|bridge) {name}
|
||||||
AddTable(family FamilyType, name string) error
|
AddTable(family FamilyType, name string) error
|
||||||
|
|
||||||
|
// DeleteTable deletes a table.
|
||||||
|
//
|
||||||
|
// This command is equivalent to:
|
||||||
|
// nft delete table (ip|ip6|inet|arp|bridge) {name}
|
||||||
|
DeleteTable(family FamilyType, name string) error
|
||||||
}
|
}
|
||||||
|
|
||||||
type nft struct {
|
type nft struct {
|
||||||
@@ -51,3 +63,8 @@ func (n *nft) AddTable(family FamilyType, name string) error {
|
|||||||
args := []string{"add", "table", family.String(), name}
|
args := []string{"add", "table", family.String(), name}
|
||||||
return executeCommand(n.path, args...)
|
return executeCommand(n.path, args...)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (n *nft) DeleteTable(family FamilyType, name string) error {
|
||||||
|
args := []string{"delete", "table", family.String(), name}
|
||||||
|
return executeCommand(n.path, args...)
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user