mirror of
https://github.com/bettercap/bettercap
synced 2025-08-14 10:46:57 -07:00
new: the events ignore list is now exported as the events.stream state object via api.rest
This commit is contained in:
parent
2e3e4f453b
commit
80000ed737
2 changed files with 11 additions and 2 deletions
|
@ -1,6 +1,7 @@
|
|||
package session
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"strings"
|
||||
|
@ -30,6 +31,12 @@ func NewEventsIgnoreList() *EventsIgnoreList {
|
|||
}
|
||||
}
|
||||
|
||||
func (l *EventsIgnoreList) MarshalJSON() ([]byte, error) {
|
||||
l.RLock()
|
||||
defer l.RUnlock()
|
||||
return json.Marshal(l.filters)
|
||||
}
|
||||
|
||||
func (l *EventsIgnoreList) checkExpression(expr string) (string, error) {
|
||||
expr = str.Trim(expr)
|
||||
if expr == "" {
|
||||
|
@ -88,8 +95,8 @@ func (l *EventsIgnoreList) Remove(expr string) (err error) {
|
|||
}
|
||||
|
||||
func (l *EventsIgnoreList) Clear() {
|
||||
l.RLock()
|
||||
defer l.RUnlock()
|
||||
l.Lock()
|
||||
defer l.Unlock()
|
||||
l.filters = make([]filter, 0)
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue