feat(aa): add rule constructors from internal parser.
This commit is contained in:
parent
ac9d6d859f
commit
163c5be61c
19 changed files with 456 additions and 75 deletions
|
|
@ -27,6 +27,21 @@ type Rlimit struct {
|
|||
Value string
|
||||
}
|
||||
|
||||
func newRlimit(q Qualifier, rule rule) (Rule, error) {
|
||||
if len(rule) != 4 {
|
||||
return nil, fmt.Errorf("invalid set format: %s", rule)
|
||||
}
|
||||
if rule.Get(0) != RLIMIT.Tok() {
|
||||
return nil, fmt.Errorf("invalid rlimit format: %s", rule)
|
||||
}
|
||||
return &Rlimit{
|
||||
RuleBase: newBase(rule),
|
||||
Key: rule.Get(1),
|
||||
Op: rule.Get(2),
|
||||
Value: rule.Get(3),
|
||||
}, nil
|
||||
}
|
||||
|
||||
func newRlimitFromLog(log map[string]string) Rule {
|
||||
return &Rlimit{
|
||||
RuleBase: newBaseFromLog(log),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue