Refactor Clear method to use nftCommand.Clear for improved code reuse
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
package nft
|
||||
|
||||
func Clear() []string {
|
||||
return []string{"flush", "ruleset"}
|
||||
}
|
||||
@@ -9,6 +9,7 @@ import (
|
||||
nftContract "git.kor-elf.net/kor-elf-shield/go-nftables-client/contract/nft"
|
||||
"git.kor-elf.net/kor-elf-shield/go-nftables-client/internal/chain"
|
||||
"git.kor-elf.net/kor-elf-shield/go-nftables-client/internal/command"
|
||||
nftCommand "git.kor-elf.net/kor-elf-shield/go-nftables-client/internal/pkg/nft"
|
||||
"git.kor-elf.net/kor-elf-shield/go-nftables-client/internal/rule"
|
||||
"git.kor-elf.net/kor-elf-shield/go-nftables-client/internal/table"
|
||||
)
|
||||
@@ -50,7 +51,7 @@ func NewWithPath(path string) (contract.NFT, error) {
|
||||
}
|
||||
|
||||
func (n *nft) Clear() error {
|
||||
args := []string{"flush", "ruleset"}
|
||||
args := nftCommand.Clear()
|
||||
return n.command.Run(args...)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user