v0.2.0 #3

Merged
kor-elf merged 22 commits from develop into main 2026-04-26 16:50:47 +05:00
2 changed files with 19 additions and 3 deletions
Showing only changes of commit fedf0966bc - Show all commits
+15
View File
@@ -0,0 +1,15 @@
package nft
import "git.kor-elf.net/kor-elf-shield/go-nftables-client/family"
func TableAdd(family family.Type, tableName string) []string {
return []string{"add", "table", family.String(), tableName}
}
func TableDelete(family family.Type, tableName string) []string {
return []string{"delete", "table", family.String(), tableName}
}
func TableClear(family family.Type, tableName string) []string {
return []string{"flush", "table", family.String(), tableName}
}
+4 -3
View File
@@ -4,6 +4,7 @@ import (
"git.kor-elf.net/kor-elf-shield/go-nftables-client/contract" "git.kor-elf.net/kor-elf-shield/go-nftables-client/contract"
"git.kor-elf.net/kor-elf-shield/go-nftables-client/contract/nft" "git.kor-elf.net/kor-elf-shield/go-nftables-client/contract/nft"
"git.kor-elf.net/kor-elf-shield/go-nftables-client/family" "git.kor-elf.net/kor-elf-shield/go-nftables-client/family"
nftCommand "git.kor-elf.net/kor-elf-shield/go-nftables-client/internal/pkg/nft"
) )
type table struct { type table struct {
@@ -17,16 +18,16 @@ func New(command contract.Command) nft.Table {
} }
func (t *table) Add(family family.Type, tableName string) error { func (t *table) Add(family family.Type, tableName string) error {
args := []string{"add", "table", family.String(), tableName} args := nftCommand.TableAdd(family, tableName)
return t.command.Run(args...) return t.command.Run(args...)
} }
func (t *table) Delete(family family.Type, tableName string) error { func (t *table) Delete(family family.Type, tableName string) error {
args := []string{"delete", "table", family.String(), tableName} args := nftCommand.TableDelete(family, tableName)
return t.command.Run(args...) return t.command.Run(args...)
} }
func (t *table) Clear(family family.Type, tableName string) error { func (t *table) Clear(family family.Type, tableName string) error {
args := []string{"flush", "table", family.String(), tableName} args := nftCommand.TableClear(family, tableName)
return t.command.Run(args...) return t.command.Run(args...)
} }