feat(aa): add initial profile validation structure.
This commit is contained in:
parent
2dd6046697
commit
92641e7e28
20 changed files with 222 additions and 2 deletions
|
|
@ -4,6 +4,10 @@
|
|||
|
||||
package aa
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
const tokNETWORK = "network"
|
||||
|
||||
func init() {
|
||||
|
|
@ -77,6 +81,19 @@ func newNetworkFromLog(log map[string]string) Rule {
|
|||
}
|
||||
}
|
||||
|
||||
func (r *Network) Validate() error {
|
||||
if err := validateValues(r.Kind(), "domains", []string{r.Domain}); err != nil {
|
||||
return fmt.Errorf("%s: %w", r, err)
|
||||
}
|
||||
if err := validateValues(r.Kind(), "type", []string{r.Type}); err != nil {
|
||||
return fmt.Errorf("%s: %w", r, err)
|
||||
}
|
||||
if err := validateValues(r.Kind(), "protocol", []string{r.Protocol}); err != nil {
|
||||
return fmt.Errorf("%s: %w", r, err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (r *Network) Less(other any) bool {
|
||||
o, _ := other.(*Network)
|
||||
if r.Domain != o.Domain {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue