Remove old, broken Validation

This commit is contained in:
Samuel Lorch 2023-10-09 23:37:40 +02:00
parent e12a1fe16f
commit f67ec52fae
13 changed files with 39 additions and 64 deletions

View file

@ -1,7 +1,7 @@
package firewall
type Firewall struct {
ForwardRules []ForwardRule `json:"forward_rules" validate:"required,dive"`
DestinationNATRules []DestinationNATRule `json:"destination_nat_rules" validate:"required,dive"`
SourceNATRules []SourceNATRule `json:"source_nat_rules" validate:"required,dive"`
ForwardRules []ForwardRule `json:"forward_rules"`
DestinationNATRules []DestinationNATRule `json:"destination_nat_rules"`
SourceNATRules []SourceNATRule `json:"source_nat_rules"`
}

View file

@ -3,15 +3,15 @@ package firewall
import "encoding/json"
type Rule struct {
Name string `json:"name" validate:"required"`
Match Match `json:"match" validate:"required,dive"`
Name string `json:"name"`
Match Match `json:"match"`
Comment string `json:"comment,omitempty"`
Counter bool `json:"counter,omitempty"`
}
type ForwardRule struct {
Rule
Verdict Verdict `json:"verdict" validate:"min=0,max=2"`
Verdict Verdict `json:"verdict"`
}
type Verdict int

View file

@ -4,7 +4,7 @@ import "encoding/json"
type SourceNATRule struct {
Rule
Type SnatType `json:"type" validate:"min=0,max=1"`
Type SnatType `json:"type"`
Address *string `json:"address,omitempty"`
Service *string `json:"service,omitempty"`
}