Add Chain API for managing nftables chains, including Add, Create, Delete, Clear, and Rename operations.

This commit is contained in:
2025-10-22 20:56:46 +05:00
parent 09ac999346
commit e7e53fc123
5 changed files with 210 additions and 0 deletions

36
chain/hook.go Normal file
View File

@@ -0,0 +1,36 @@
package chain
import "fmt"
type Hook int8
const (
HookInput Hook = iota
HookOutput
HookForward
HookPrerouting
HookPostrouting
HookIngress
HookEgress
)
func (h Hook) String() string {
switch h {
case HookInput:
return "input"
case HookOutput:
return "output"
case HookForward:
return "forward"
case HookPrerouting:
return "prerouting"
case HookPostrouting:
return "postrouting"
case HookIngress:
return "ingress"
case HookEgress:
return "egress"
default:
return fmt.Sprintf("unknown hook %d", h)
}
}