@@ -23,6 +23,7 @@ import (
2323 "github.com/crowdsecurity/crowdsec/pkg/enrichment"
2424 "github.com/crowdsecurity/crowdsec/pkg/exprhelpers"
2525 "github.com/crowdsecurity/crowdsec/pkg/logging"
26+ "github.com/crowdsecurity/crowdsec/pkg/pipeline"
2627 "github.com/crowdsecurity/crowdsec/pkg/types"
2728)
2829
@@ -63,7 +64,7 @@ type BucketFactory struct {
6364 CancelOnFilter string `yaml:"cancel_on,omitempty"` // a filter that, if matched, kills the bucket
6465 leakspeed time.Duration // internal representation of `Leakspeed`
6566 duration time.Duration // internal representation of `Duration`
66- ret chan types .Event // the bucket-specific output chan for overflows
67+ ret chan pipeline .Event // the bucket-specific output chan for overflows
6768 processors []Processor // processors is the list of hooks for pour/overflow/create (cf. uniq, blackhole etc.)
6869 ScenarioVersion string `yaml:"version,omitempty"`
6970 hash string
@@ -223,7 +224,7 @@ func compileScopeFilter(bucketFactory *BucketFactory) error {
223224 return errors .New ("filter is mandatory for non-IP, non-Range scope" )
224225 }
225226
226- runTimeFilter , err := expr .Compile (bucketFactory .ScopeType .Filter , exprhelpers .GetExprOptions (map [string ]any {"evt" : & types .Event {}})... )
227+ runTimeFilter , err := expr .Compile (bucketFactory .ScopeType .Filter , exprhelpers .GetExprOptions (map [string ]any {"evt" : & pipeline .Event {}})... )
227228 if err != nil {
228229 return fmt .Errorf ("error compiling the scope filter: %w" , err )
229230 }
@@ -233,7 +234,7 @@ func compileScopeFilter(bucketFactory *BucketFactory) error {
233234 return nil
234235}
235236
236- func loadBucketFactoriesFromFile (item * cwhub.Item , hub * cwhub.Hub , buckets * Buckets , tomb * tomb.Tomb , response chan types .Event , orderEvent bool , simulationConfig csconfig.SimulationConfig ) ([]BucketFactory , error ) {
237+ func loadBucketFactoriesFromFile (item * cwhub.Item , hub * cwhub.Hub , buckets * Buckets , tomb * tomb.Tomb , response chan pipeline .Event , orderEvent bool , simulationConfig csconfig.SimulationConfig ) ([]BucketFactory , error ) {
237238 itemPath := item .State .LocalPath
238239
239240 // process the yaml
@@ -312,9 +313,9 @@ func loadBucketFactoriesFromFile(item *cwhub.Item, hub *cwhub.Hub, buckets *Buck
312313 return factories , nil
313314}
314315
315- func LoadBuckets (cscfg * csconfig.CrowdsecServiceCfg , hub * cwhub.Hub , scenarios []* cwhub.Item , tomb * tomb.Tomb , buckets * Buckets , orderEvent bool ) ([]BucketFactory , chan types .Event , error ) {
316+ func LoadBuckets (cscfg * csconfig.CrowdsecServiceCfg , hub * cwhub.Hub , scenarios []* cwhub.Item , tomb * tomb.Tomb , buckets * Buckets , orderEvent bool ) ([]BucketFactory , chan pipeline .Event , error ) {
316317 allFactories := []BucketFactory {}
317- response := make (chan types .Event , 1 )
318+ response := make (chan pipeline .Event , 1 )
318319
319320 for _ , item := range scenarios {
320321 log .Debugf ("Loading '%s'" , item .State .LocalPath )
@@ -377,13 +378,13 @@ func LoadBucket(bucketFactory *BucketFactory, tomb *tomb.Tomb) error {
377378 return errors .New ("bucket without filter directive" )
378379 }
379380
380- bucketFactory .RunTimeFilter , err = expr .Compile (bucketFactory .Filter , exprhelpers .GetExprOptions (map [string ]any {"evt" : & types .Event {}})... )
381+ bucketFactory .RunTimeFilter , err = expr .Compile (bucketFactory .Filter , exprhelpers .GetExprOptions (map [string ]any {"evt" : & pipeline .Event {}})... )
381382 if err != nil {
382383 return fmt .Errorf ("invalid filter '%s' in %s: %w" , bucketFactory .Filter , bucketFactory .Filename , err )
383384 }
384385
385386 if bucketFactory .GroupBy != "" {
386- bucketFactory .RunTimeGroupBy , err = expr .Compile (bucketFactory .GroupBy , exprhelpers .GetExprOptions (map [string ]any {"evt" : & types .Event {}})... )
387+ bucketFactory .RunTimeGroupBy , err = expr .Compile (bucketFactory .GroupBy , exprhelpers .GetExprOptions (map [string ]any {"evt" : & pipeline .Event {}})... )
387388 if err != nil {
388389 return fmt .Errorf ("invalid groupby '%s' in %s: %w" , bucketFactory .GroupBy , bucketFactory .Filename , err )
389390 }
@@ -411,7 +412,7 @@ func LoadBucket(bucketFactory *BucketFactory, tomb *tomb.Tomb) error {
411412 bucketFactory .logger .Tracef ("Adding a non duplicate filter" )
412413 bucketFactory .processors = append (bucketFactory .processors , & Uniq {})
413414 // we're compiling and discarding the expression to be able to detect it during loading
414- _ , err = expr .Compile (bucketFactory .Distinct , exprhelpers .GetExprOptions (map [string ]any {"evt" : & types .Event {}})... )
415+ _ , err = expr .Compile (bucketFactory .Distinct , exprhelpers .GetExprOptions (map [string ]any {"evt" : & pipeline .Event {}})... )
415416 if err != nil {
416417 return fmt .Errorf ("invalid distinct '%s' in %s: %w" , bucketFactory .Distinct , bucketFactory .Filename , err )
417418 }
@@ -421,7 +422,7 @@ func LoadBucket(bucketFactory *BucketFactory, tomb *tomb.Tomb) error {
421422 bucketFactory .logger .Tracef ("Adding a cancel_on filter" )
422423 bucketFactory .processors = append (bucketFactory .processors , & CancelOnFilter {})
423424 // we're compiling and discarding the expression to be able to detect it during loading
424- _ , err = expr .Compile (bucketFactory .CancelOnFilter , exprhelpers .GetExprOptions (map [string ]any {"evt" : & types .Event {}})... )
425+ _ , err = expr .Compile (bucketFactory .CancelOnFilter , exprhelpers .GetExprOptions (map [string ]any {"evt" : & pipeline .Event {}})... )
425426 if err != nil {
426427 return fmt .Errorf ("invalid cancel_on '%s' in %s: %w" , bucketFactory .CancelOnFilter , bucketFactory .Filename , err )
427428 }
@@ -455,7 +456,7 @@ func LoadBucket(bucketFactory *BucketFactory, tomb *tomb.Tomb) error {
455456 bucketFactory .logger .Tracef ("Adding conditional overflow" )
456457 bucketFactory .processors = append (bucketFactory .processors , & ConditionalOverflow {})
457458 // we're compiling and discarding the expression to be able to detect it during loading
458- _ , err = expr .Compile (bucketFactory .ConditionalOverflow , exprhelpers .GetExprOptions (map [string ]any {"queue" : & types .Queue {}, "leaky" : & Leaky {}, "evt" : & types .Event {}})... )
459+ _ , err = expr .Compile (bucketFactory .ConditionalOverflow , exprhelpers .GetExprOptions (map [string ]any {"queue" : & pipeline .Queue {}, "leaky" : & Leaky {}, "evt" : & pipeline .Event {}})... )
459460 if err != nil {
460461 return fmt .Errorf ("invalid condition '%s' in %s: %w" , bucketFactory .ConditionalOverflow , bucketFactory .Filename , err )
461462 }
0 commit comments