From 90b232aa05d31e9bf3cabbd444d8095c10f0a271 Mon Sep 17 00:00:00 2001 From: Leonid Nikitin Date: Wed, 22 Oct 2025 20:59:49 +0500 Subject: [PATCH] Add Command method to NFT interface and RunWithOutput support to command package --- internal/command/command.go | 3 +++ nft.go | 8 ++++++++ 2 files changed, 11 insertions(+) diff --git a/internal/command/command.go b/internal/command/command.go index a21834d..e197b91 100644 --- a/internal/command/command.go +++ b/internal/command/command.go @@ -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) } diff --git a/nft.go b/nft.go index 2e4b86d..83a953a 100644 --- a/nft.go +++ b/nft.go @@ -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 +}