Add Command method to NFT interface and RunWithOutput support to command package

This commit is contained in:
2025-10-22 20:59:49 +05:00
parent e7e53fc123
commit 90b232aa05
2 changed files with 11 additions and 0 deletions

View File

@@ -6,7 +6,10 @@ import (
)
type NFT interface {
// Run nft command.
Run(arg ...string) error
// RunWithOutput Run nft command with output.
RunWithOutput(arg ...string) (string, error)
}

8
nft.go
View File

@@ -12,6 +12,10 @@ import (
// NFT A client for working with nftables
type NFT interface {
// Command returns the command used to execute nft.
// You can execute your raw request.
Command() command.NFT
// Clear clears all rules.
//
// This command is equivalent to:
@@ -111,3 +115,7 @@ func (n *nft) Table() table.API {
func (n *nft) Chain() chain.API {
return n.chain
}
func (n *nft) Command() command.NFT {
return n.command
}