Add Batch API for building and executing batched nftables commands.
This commit is contained in:
@@ -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
|
||||
}
|
||||
Reference in New Issue
Block a user