Add Batch API for building and executing batched nftables commands.

This commit is contained in:
2026-04-22 23:34:43 +05:00
parent 3c47e7566b
commit a7ec170096
5 changed files with 135 additions and 0 deletions
+31
View File
@@ -0,0 +1,31 @@
package contract
import (
"git.kor-elf.net/kor-elf-shield/go-nftables-client/contract/batch"
)
// BatchBuilder is an API for building a batch of commands.
type BatchBuilder interface {
// Clear clears all rules.
//
// This command is equivalent to:
// nft flush ruleset
Clear() error
// Table returns an API for working with tables.
Table() batch.Table
// Chain returns an API for working with chains.
Chain() batch.Chain
// Rule returns an API for working with rules.
Rule() batch.Rule
// Build returns a batch of commands.
Build() Batch
}
type Batch interface {
// Args returns the arguments of the batch.
Args() []string
}