File: flow_notifier.go

package info (click to toggle)
fever 1.4.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 920 kB
  • sloc: sh: 41; makefile: 18
file content (40 lines) | stat: -rw-r--r-- 938 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package processing

// DCSO FEVER
// Copyright (c) 2020, DCSO GmbH

import (
	"github.com/DCSO/fever/types"
)

// FlowNotifier is a handler that just passes flow events on a
// given channel once encountered.
type FlowNotifier struct {
	FlowNotifyChan chan types.Entry
}

// MakeFlowNotifier creates a new FlowNotifier.
func MakeFlowNotifier(outChan chan types.Entry) *FlowNotifier {
	notifier := &FlowNotifier{
		FlowNotifyChan: outChan,
	}
	return notifier
}

// Consume processes an Entry, emitting an Entry on the output
// channel
func (n *FlowNotifier) Consume(e *types.Entry) error {
	n.FlowNotifyChan <- *e
	return nil
}

// GetName returns the name of the handler
func (n *FlowNotifier) GetName() string {
	return "Flow notifier"
}

// GetEventTypes returns a slice of event type strings that this handler
// should be applied to -- flow in this case.
func (n *FlowNotifier) GetEventTypes() []string {
	return []string{"flow"}
}