initial nftables config generation test

This commit is contained in:
Samuel Lorch 2023-03-01 11:10:33 +01:00
parent ba99844ae4
commit b279746017
17 changed files with 215 additions and 0 deletions

View file

@ -0,0 +1,6 @@
package definitions
type Config struct {
ConfigVersion int64 `json:"config_version"`
Netfilter Netfilter `json:"netfilter"`
}

View file

@ -0,0 +1,7 @@
package definitions
type Netfilter struct {
ForwardRules []ForwardRule `json:"forward_rules"`
DestinationNATRules []DestinationNATRule `json:"destination_nat_rules"`
SourceNATRules []SourceNATRule `json:"source_nat_rules"`
}

23
pkg/definitions/rules.go Normal file
View file

@ -0,0 +1,23 @@
package definitions
type Rule struct {
Match RuleMatch `json:"match"`
Comment string `json:"comment"`
Counter bool `json:"counter"`
}
type RuleMatch struct {
TCPDestinationPort uint64 `json:"tcp_destination_port"`
}
type ForwardRule struct {
Rule
}
type DestinationNATRule struct {
Rule
}
type SourceNATRule struct {
Rule
}