Skip to content

Commit ad8fd36

Browse files
authored
Exported Ahocorasick core in engine (#3880)
1 parent c05bb4d commit ad8fd36

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

pkg/engine/engine.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ type Engine struct {
181181
scanEntireChunk bool
182182

183183
// ahoCorasickHandler manages the Aho-Corasick trie and related keyword lookups.
184-
ahoCorasickCore *ahocorasick.Core
184+
AhoCorasickCore *ahocorasick.Core
185185

186186
// Engine synchronization primitives.
187187
sourceManager *sources.SourceManager
@@ -524,7 +524,7 @@ func (e *Engine) initialize(ctx context.Context) error {
524524
}
525525

526526
ctx.Logger().V(4).Info("setting up aho-corasick core")
527-
e.ahoCorasickCore = ahocorasick.NewAhoCorasickCore(e.detectors, ahoCOptions...)
527+
e.AhoCorasickCore = ahocorasick.NewAhoCorasickCore(e.detectors, ahoCOptions...)
528528
ctx.Logger().V(4).Info("set up aho-corasick core")
529529

530530
return nil
@@ -789,7 +789,7 @@ func (e *Engine) scannerWorker(ctx context.Context) {
789789
continue
790790
}
791791

792-
matchingDetectors := e.ahoCorasickCore.FindDetectorMatches(decoded.Chunk.Data)
792+
matchingDetectors := e.AhoCorasickCore.FindDetectorMatches(decoded.Chunk.Data)
793793
if len(matchingDetectors) > 1 && !e.verificationOverlap {
794794
wgVerificationOverlap.Add(1)
795795
e.verificationOverlapChunksChan <- verificationOverlapChunk{

pkg/engine/postman.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ func (e *Engine) ScanPostman(ctx context.Context, c sources.PostmanConfig) (sour
4141

4242
// Turn AhoCorasick keywordsToDetectors into a map of keywords
4343
keywords := make(map[string]struct{})
44-
for key := range e.ahoCorasickCore.KeywordsToDetectors() {
44+
for key := range e.AhoCorasickCore.KeywordsToDetectors() {
4545
keywords[key] = struct{}{}
4646
}
4747

0 commit comments

Comments
 (0)