Refactor to consolidate APIs into contract package and introduce NFT interface for better modularity and maintainability.

This commit is contained in:
2026-04-22 21:54:59 +05:00
parent 92803286f5
commit 3c47e7566b
12 changed files with 182 additions and 154 deletions
+31
View File
@@ -0,0 +1,31 @@
package contract
import "git.kor-elf.net/kor-elf-shield/go-nftables-client/contract/nft"
// 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
// Clear clears all rules.
//
// This command is equivalent to:
// nft flush ruleset
Clear() error
// Version returns the version of nftables.
//
// This command is equivalent to:
// nft -V
Version() (nft.Version, error)
// Table returns an API for working with tables.
Table() nft.Table
// Chain returns an API for working with chains.
Chain() nft.Chain
// Rule returns an API for working with rules.
Rule() nft.Rule
}