Documentation ¶
Overview ¶
Package feeder is responsible for sanitizing and relaying telemetry and alerts data to connected clients
Index ¶
- Constants
- Variables
- func GetProtocolFromName(proto string) string
- type BaseFeeder
- type EventStruct
- type EventStructs
- func (es *EventStructs) AddAlertStruct(filter string, queueSize int) (string, chan *pb.Alert)
- func (es *EventStructs) AddLogStruct(filter string, queueSize int) (string, chan *pb.Log)
- func (es *EventStructs) AddMsgStruct(filter string, queueSize int) (string, chan *pb.Message)
- func (es *EventStructs) RemoveAlertStruct(uid string)
- func (es *EventStructs) RemoveLogStruct(uid string)
- func (es *EventStructs) RemoveMsgStruct(uid string)
- type Feeder
- func (fd *Feeder) Debug(message string)
- func (fd *Feeder) Debugf(message string, args ...interface{})
- func (fd *Feeder) Err(message string)
- func (fd *Feeder) Errf(message string, args ...interface{})
- func (fd *Feeder) Print(message string)
- func (fd *Feeder) Printf(message string, args ...interface{})
- func (fd *Feeder) PushLog(log tp.Log)
- func (fd *Feeder) PushMessage(level, message string)
- func (fd *Feeder) StrToFile(str string)
- func (fd *Feeder) UpdateDefaultPosture(action string, namespace string, defaultPosture tp.DefaultPosture)
- func (fd *Feeder) UpdateEnforcer(enforcer string)
- func (fd *Feeder) UpdateHostSecurityPolicies(action string, secPolicies []tp.HostSecurityPolicy)
- func (fd *Feeder) UpdateMatchedPolicy(log tp.Log) tp.Log
- func (fd *Feeder) UpdateSecurityPolicies(action string, endPoint tp.EndPoint)
- func (fd *Feeder) Warn(message string)
- func (fd *Feeder) Warnf(message string, args ...interface{})
- type FeederInterface
- type LogService
- func (ls *LogService) HealthCheck(ctx context.Context, nonce *pb.NonceMessage) (*pb.ReplyMessage, error)
- func (ls *LogService) WatchAlerts(req *pb.RequestMessage, svr pb.LogService_WatchAlertsServer) error
- func (ls *LogService) WatchLogs(req *pb.RequestMessage, svr pb.LogService_WatchLogsServer) error
- func (ls *LogService) WatchMessages(req *pb.RequestMessage, svr pb.LogService_WatchMessagesServer) error
Constants ¶
const QueueSize = 1000
QueueSize
Variables ¶
var Running bool
Running flag
Functions ¶
func GetProtocolFromName ¶
GetProtocolFromName function gets protocol name from visibility data
Types ¶
type BaseFeeder ¶
type BaseFeeder struct { // node Node *tp.Node NodeLock **sync.RWMutex // wait group WgServer sync.WaitGroup // output Output string LogFile *os.File // Activated Enforcer Enforcer string // Msg, log and alert connection stores EventStructs *EventStructs // True if feeder and its workers are working Running bool // port Port string // gRPC listener Listener net.Listener // log server LogServer *grpc.Server }
func (*BaseFeeder) DestroyFeeder ¶
func (fd *BaseFeeder) DestroyFeeder() error
DestroyFeeder Function
type EventStruct ¶
EventStruct Structure
type EventStructs ¶
type EventStructs struct { MsgStructs map[string]EventStruct[pb.Message] MsgLock sync.RWMutex AlertStructs map[string]EventStruct[pb.Alert] AlertLock sync.RWMutex LogStructs map[string]EventStruct[pb.Log] LogLock sync.RWMutex }
func (*EventStructs) AddAlertStruct ¶
AddAlertStruct Function
func (*EventStructs) AddLogStruct ¶
addLogStruct Function
func (*EventStructs) AddMsgStruct ¶
AddMsgStruct Function
func (*EventStructs) RemoveAlertStruct ¶
func (es *EventStructs) RemoveAlertStruct(uid string)
removeAlertStruct Function
func (*EventStructs) RemoveLogStruct ¶
func (es *EventStructs) RemoveLogStruct(uid string)
removeLogStruct Function
func (*EventStructs) RemoveMsgStruct ¶
func (es *EventStructs) RemoveMsgStruct(uid string)
RemoveMsgStruct Function
type Feeder ¶
type Feeder struct { BaseFeeder // namespace name + endpoint name / host name -> corresponding security policies SecurityPolicies map[string]tp.MatchPolicies SecurityPoliciesLock *sync.RWMutex // DefaultPosture (namespace -> postures) DefaultPostures map[string]tp.DefaultPosture DefaultPosturesLock *sync.Mutex }
Feeder Structure
func (*Feeder) PushMessage ¶
PushMessage Function
func (*Feeder) UpdateDefaultPosture ¶
func (fd *Feeder) UpdateDefaultPosture(action string, namespace string, defaultPosture tp.DefaultPosture)
UpdateDefaultPosture Function
func (*Feeder) UpdateEnforcer ¶
UpdateEnforcer Function
func (*Feeder) UpdateHostSecurityPolicies ¶
func (fd *Feeder) UpdateHostSecurityPolicies(action string, secPolicies []tp.HostSecurityPolicy)
UpdateHostSecurityPolicies Function
func (*Feeder) UpdateMatchedPolicy ¶
UpdateMatchedPolicy Function
func (*Feeder) UpdateSecurityPolicies ¶
UpdateSecurityPolicies Function
type FeederInterface ¶
type FeederInterface interface { // How does the feeder pushes logs and messages PushLog(tp.Log) PushMessage(string, string) // How does this feeder match log with policy UpdateMatchedPolicy(tp.Log) // How this feeder serves log feeds ServeLogFeeds() }
============ // == Feeder == // ============ //
type LogService ¶
type LogService struct { QueueSize int EventStructs *EventStructs Running *bool }
LogService struct holds the state of feeder's log server
func (*LogService) HealthCheck ¶
func (ls *LogService) HealthCheck(ctx context.Context, nonce *pb.NonceMessage) (*pb.ReplyMessage, error)
HealthCheck Function Deprecated: use the server created with google.golang.org/grpc/health/grpc_health_v1
func (*LogService) WatchAlerts ¶
func (ls *LogService) WatchAlerts(req *pb.RequestMessage, svr pb.LogService_WatchAlertsServer) error
WatchAlerts Function
func (*LogService) WatchLogs ¶
func (ls *LogService) WatchLogs(req *pb.RequestMessage, svr pb.LogService_WatchLogsServer) error
WatchLogs Function
func (*LogService) WatchMessages ¶
func (ls *LogService) WatchMessages(req *pb.RequestMessage, svr pb.LogService_WatchMessagesServer) error
WatchMessages Function