Documentation
¶
Overview ¶
Package matcher provides Aho-Corasick based keyword pre-filtering. It builds an automaton from detector keywords and efficiently identifies which detectors are relevant for a given chunk of data.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Matcher ¶
type Matcher struct {
// contains filtered or unexported fields
}
Matcher performs Aho-Corasick keyword pre-filtering to determine which detectors should be run against a given chunk of data.
func New ¶
New builds an Aho-Corasick automaton from the given detectors' keywords. Detectors with no keywords are always included in match results.
func (*Matcher) Match ¶
Match returns the subset of detectors whose keywords appear in the data. Detectors without keywords are always included.
Match is safe for concurrent use by multiple goroutines: a single Matcher is shared across all engine workers, so the underlying Aho-Corasick automaton is queried via the thread-safe MatchThreadSafe entry point (see below). The non-thread-safe Match method of the ahocorasick library mutates shared trie node counters and would otherwise cause a data race and silently drop matches (missed secrets) under concurrent calls.