evs

package module
v0.4.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 2, 2020 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddressToIp

func AddressToIp(addr *pb.Address) net.IP

Converts an Address (compiled protobuf object) to an IP address. Return nil if conversion is not possible.

func AddressToString

func AddressToString(addr *pb.Address) string

Converts an Address (compiled protobuf object) to string form.

func BytesToIp

func BytesToIp(b []byte) net.IP

Converts a byte array to an IP address. This is for IPv6 addresses.

func CheckAndStartMetricsService

func CheckAndStartMetricsService()

func Int32ToIp

func Int32ToIp(ipLong uint32) net.IP

Converts a 32-bit int to an IP address

Types

type Config

type Config struct {
	Broker      string
	Name        string
	Input       string
	Outputs     []string
	Persistence string
	Tenant      string
	Namespace   string
}

func NewConfig

func NewConfig(defname, defbind string, defout []string) *Config

func (*Config) GetInputTopic added in v0.4.0

func (c *Config) GetInputTopic() string

func (*Config) GetName added in v0.4.0

func (c *Config) GetName() string

func (*Config) GetOutputTopics added in v0.4.0

func (c *Config) GetOutputTopics() []string

func (*Config) SetInput

func (c *Config) SetInput(val string)

func (*Config) SetNamespace added in v0.4.0

func (c *Config) SetNamespace(val string)

func (*Config) SetOutputs

func (c *Config) SetOutputs(val []string)

func (*Config) SetPersistence added in v0.4.0

func (c *Config) SetPersistence(val string)

func (*Config) SetTenant added in v0.4.0

func (c *Config) SetTenant(val string)

type EventHandler

type EventHandler interface {
	Event(*pb.Event, map[string]string) error
}

Users of the EventAnalytic API implement the Handler interface.

type EventProducer

type EventProducer struct {
	*Producer
}

Wraps Pulsar communication and cyberprobe event encoding

func NewEventProducer

func NewEventProducer(c HasOutputTopics) (*EventProducer, error)

Initialise the analyitc

func (*EventProducer) Output

func (a *EventProducer) Output(ev *pb.Event, properties map[string]string) error

Output an event by iterating over all outputs

type EventSubscriber

type EventSubscriber struct {
	*Subscriber
	// contains filtered or unexported fields
}

EventAnalytic API wraps Pulsar communication and cyberprobe event decoding

func NewEventSubscriber

func NewEventSubscriber(c HasInputTopics, e EventHandler) (*EventSubscriber, error)

Initialise the analyitc

func (*EventSubscriber) Handle

func (s *EventSubscriber) Handle(msg pulsar.Message) error

Internal Handler implementation of EventAnalytic, decodes messages as cyberprobe events and delegates to the EventHandler interface for processing.

type Handler

type Handler interface {
	Handle(msg pulsar.Message) error
}

Users of the Analytic API implement the Handler interface.

type HasInputTopics added in v0.4.0

type HasInputTopics interface {
	GetName() string
	GetInputTopic() string
}

type HasOutputTopics added in v0.4.0

type HasOutputTopics interface {
	GetName() string
	GetOutputTopics() []string
}

type Interruptible

type Interruptible struct {
	Context context.Context
	Cancel  context.CancelFunc
	// contains filtered or unexported fields
}

func (*Interruptible) RegisterStop

func (i *Interruptible) RegisterStop(stop Stoppable)

type Producer

type Producer struct {
	// contains filtered or unexported fields
}

Describes Users of the Analytic API implement the Handler interface.

func NewProducer

func NewProducer(c HasOutputTopics) (*Producer, error)

Initialise the Analytic.

func (*Producer) Output

func (a *Producer) Output(msg *pulsar.ProducerMessage)

Output a message by iterating over all outputs. Retries until message is sent.

type Stoppable

type Stoppable interface {
	Stop()
}

type Subscriber

type Subscriber struct {
	// contains filtered or unexported fields
}

Describes Users of the Analytic API implement the Handler interface.

func NewSubscriber

func NewSubscriber(c HasInputTopics, h Handler) (*Subscriber, error)

Initialise the Analytic.

func (*Subscriber) Close

func (s *Subscriber) Close()

func (*Subscriber) Run

func (s *Subscriber) Run()

Go into the 'run' state getting messages from the consumer and delivering to Handler.

func (*Subscriber) Stop

func (s *Subscriber) Stop()

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL