Версия 0.1.0 #1

Merged
kor-elf merged 15 commits from develop into main 2025-10-22 23:10:42 +05:00
Showing only changes of commit d056f5dbf8 - Show all commits

24
nft.go
View File

@@ -15,20 +15,20 @@ type NFT interface {
// 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
// nft add table (ip|ip6|inet|arp|bridge) {table_name}
AddTable(family FamilyType, tableName 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
// nft delete table (ip|ip6|inet|arp|bridge) {table_name}
DeleteTable(family FamilyType, tableName 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
// nft flush table (ip|ip6|inet|arp|bridge) {table_name}
ClearTable(family FamilyType, tableName string) error
}
type nft struct {
@@ -65,17 +65,17 @@ func (n *nft) Clear() error {
return executeCommand(n.path, args...)
}
func (n *nft) AddTable(family FamilyType, name string) error {
args := []string{"add", "table", family.String(), name}
func (n *nft) AddTable(family FamilyType, tableName string) error {
args := []string{"add", "table", family.String(), tableName}
return executeCommand(n.path, args...)
}
func (n *nft) DeleteTable(family FamilyType, name string) error {
args := []string{"delete", "table", family.String(), name}
func (n *nft) DeleteTable(family FamilyType, tableName string) error {
args := []string{"delete", "table", family.String(), tableName}
return executeCommand(n.path, args...)
}
func (n *nft) ClearTable(family FamilyType, name string) error {
args := []string{"flush", "table", family.String(), name}
func (n *nft) ClearTable(family FamilyType, tableName string) error {
args := []string{"flush", "table", family.String(), tableName}
return executeCommand(n.path, args...)
}