2022-06-22 09:29:52 +00:00
|
|
|
package parser
|
2020-05-15 09:39:16 +00:00
|
|
|
|
|
|
|
import (
|
|
|
|
"net"
|
|
|
|
|
|
|
|
"github.com/antonmedv/expr/vm"
|
2023-06-13 11:16:13 +00:00
|
|
|
|
2020-08-03 10:21:15 +00:00
|
|
|
"github.com/crowdsecurity/crowdsec/pkg/exprhelpers"
|
2020-05-15 09:39:16 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
type Whitelist struct {
|
|
|
|
Reason string `yaml:"reason,omitempty"`
|
|
|
|
Ips []string `yaml:"ip,omitempty"`
|
|
|
|
B_Ips []net.IP
|
|
|
|
Cidrs []string `yaml:"cidr,omitempty"`
|
|
|
|
B_Cidrs []*net.IPNet
|
|
|
|
Exprs []string `yaml:"expression,omitempty"`
|
2020-08-03 10:21:15 +00:00
|
|
|
B_Exprs []*ExprWhitelist
|
|
|
|
}
|
|
|
|
|
|
|
|
type ExprWhitelist struct {
|
|
|
|
Filter *vm.Program
|
|
|
|
ExprDebugger *exprhelpers.ExprDebugger // used to debug expression by printing the content of each variable of the expression
|
2020-05-15 09:39:16 +00:00
|
|
|
}
|