Add ClearTable method to NFT interface and implementation.
This commit is contained in:
11
nft.go
11
nft.go
@@ -23,6 +23,12 @@ type NFT interface {
|
|||||||
// This command is equivalent to:
|
// This command is equivalent to:
|
||||||
// nft delete table (ip|ip6|inet|arp|bridge) {name}
|
// nft delete table (ip|ip6|inet|arp|bridge) {name}
|
||||||
DeleteTable(family FamilyType, name string) error
|
DeleteTable(family FamilyType, name string) error
|
||||||
|
|
||||||
|
// ClearTable clears all rules in a table.
|
||||||
|
//
|
||||||
|
// This command is equivalent to:
|
||||||
|
// nft flush table (ip|ip6|inet|arp|bridge) {name}
|
||||||
|
ClearTable(family FamilyType, name string) error
|
||||||
}
|
}
|
||||||
|
|
||||||
type nft struct {
|
type nft struct {
|
||||||
@@ -68,3 +74,8 @@ func (n *nft) DeleteTable(family FamilyType, name string) error {
|
|||||||
args := []string{"delete", "table", family.String(), name}
|
args := []string{"delete", "table", family.String(), name}
|
||||||
return executeCommand(n.path, args...)
|
return executeCommand(n.path, args...)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (n *nft) ClearTable(family FamilyType, name string) error {
|
||||||
|
args := []string{"flush", "table", family.String(), name}
|
||||||
|
return executeCommand(n.path, args...)
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user