collector

package
v0.0.0-...-12afc24 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2025 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Overview

Package collector implements the vanflow event listener that backs the network console collector. It contains a Collector responsible for orchestrating collection of vanflow records from remote sources into a vanflow Store as well as several controllers responsible for reacting to records to add inferred records and context into the Store.

Index

Constants

View Source
const (
	IndexByTypeParent      = "ByTypeAndParent"
	IndexByAddress         = "ByAddress"
	IndexByParentHost      = "ByParentHost"
	IndexByLifecycleStatus = "ByLifecycleStatus"
	IndexByTypeName        = "ByTypeAndName"
	IndexFlowByAddress     = "ByTypeAndAddress"
)

Variables

This section is empty.

Functions

func RecordIndexers

func RecordIndexers() map[string]store.Indexer

func RoutingKeyID

func RoutingKeyID(address, protocol string) string

func SiteHostID

func SiteHostID(site, host string) string

Types

type Address

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

func (Address) Get

func (b Address) Get() (entry store.Entry, found bool)

func (Address) GetRecord

func (n Address) GetRecord() (record AddressRecord, found bool)

func (Address) ID

func (n Address) ID() string

func (Address) IsKnown

func (n Address) IsKnown() bool

func (Address) RoutingKey

func (n Address) RoutingKey() RoutingKey

type AddressRecord

type AddressRecord struct {
	ID       string
	Name     string
	Protocol string
	Start    time.Time
}

func (AddressRecord) GetTypeMeta

func (r AddressRecord) GetTypeMeta() vanflow.TypeMeta

func (AddressRecord) Identity

func (r AddressRecord) Identity() string

type Collector

type Collector struct {
	Records store.Interface
	// contains filtered or unexported fields
}

func New

func New(logger *slog.Logger, factory session.ContainerFactory, reg *prometheus.Registry, flowRecordTTL time.Duration, flowLogger func(vanflow.RecordMessage)) *Collector

func (*Collector) GetGraph

func (c *Collector) GetGraph() Graph

func (*Collector) Run

func (c *Collector) Run(ctx context.Context) error

type ConnectionRecord

type ConnectionRecord struct {
	ID        string
	StartTime time.Time
	EndTime   time.Time

	Connector     NamedReference
	RoutingKey    string
	Protocol      string
	ConnectorHost string
	ConnectorPort string

	Listener     NamedReference
	Source       NamedReference
	Dest         NamedReference
	SourceSite   NamedReference
	DestSite     NamedReference
	SourceGroup  NamedReference
	DestGroup    NamedReference
	SourceRouter NamedReference
	DestRouter   NamedReference

	// FlowStore is the backing store containing the Biflow records. This was
	// split from the main record store to keep high volume flow producers from
	// affecting the rest of the event sources.
	FlowStore store.Interface
	// contains filtered or unexported fields
}

func (*ConnectionRecord) GetFlow

func (ConnectionRecord) GetTypeMeta

func (r ConnectionRecord) GetTypeMeta() vanflow.TypeMeta

func (ConnectionRecord) Identity

func (r ConnectionRecord) Identity() string

type Connector

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

func (Connector) Address

func (n Connector) Address() Address

func (Connector) Get

func (b Connector) Get() (entry store.Entry, found bool)

func (Connector) ID

func (n Connector) ID() string

func (Connector) IsKnown

func (n Connector) IsKnown() bool

func (Connector) Parent

func (n Connector) Parent() Router

func (Connector) Target

func (n Connector) Target() Process

type FlowSourceRecord

type FlowSourceRecord struct {
	ID    string
	Site  string
	Host  string
	Start time.Time
}

func (FlowSourceRecord) GetTypeMeta

func (r FlowSourceRecord) GetTypeMeta() vanflow.TypeMeta

func (FlowSourceRecord) Identity

func (r FlowSourceRecord) Identity() string

type Graph

type Graph interface {
	Address(id string) Address
	Connector(id string) Connector
	SiteHost(id string) SiteHost
	Link(id string) Link
	Listener(id string) Listener
	Process(id string) Process
	RouterAccess(id string) RouterAccess
	Site(id string) Site
}

Graph exposes more complex relations between record types than can be represented by store indexes and is more concice than would be possible fetching each individual record from a store along a chain of relations.

Each node type has a set of exposed relations, none of which are guaranteed to exist or be present in the backing store. To keep error checking to a minimum, all relations will return a valid node regardless if the relation exists or is present in the store. As an example, with an empty graph `graph.Link("doesnotexist").Parent().Parent() will return a Site node, but calling Get() on that node will return false.

func NewGraph

func NewGraph(stor store.Interface) Graph
type Link struct {
	// contains filtered or unexported fields
}

func (Link) Get

func (b Link) Get() (entry store.Entry, found bool)

func (Link) GetRecord

func (n Link) GetRecord() (record vanflow.LinkRecord, found bool)

func (Link) ID

func (n Link) ID() string

func (Link) IsKnown

func (n Link) IsKnown() bool

func (Link) Parent

func (n Link) Parent() Router

func (Link) Peer

func (n Link) Peer() RouterAccess

type Listener

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

func (Listener) Address

func (n Listener) Address() Address

func (Listener) Get

func (b Listener) Get() (entry store.Entry, found bool)

func (Listener) GetRecord

func (n Listener) GetRecord() (record vanflow.ListenerRecord, found bool)

func (Listener) ID

func (n Listener) ID() string

func (Listener) IsKnown

func (n Listener) IsKnown() bool

func (Listener) Parent

func (n Listener) Parent() Router

type NamedReference

type NamedReference struct {
	ID   string
	Name string
}

type Node

type Node interface {
	ID() string
	IsKnown() bool
	Get() (store.Entry, bool)
}

type ProcGroupPairRecord

type ProcGroupPairRecord struct {
	ID         string
	Protocol   string
	Source     string
	SourceName string
	Dest       string
	DestName   string
	Start      time.Time
}

func (ProcGroupPairRecord) GetTypeMeta

func (r ProcGroupPairRecord) GetTypeMeta() vanflow.TypeMeta

func (ProcGroupPairRecord) Identity

func (r ProcGroupPairRecord) Identity() string

type ProcPairRecord

type ProcPairRecord struct {
	ID       string
	Start    time.Time
	Source   string
	Dest     string
	Protocol string
}

func (ProcPairRecord) GetTypeMeta

func (r ProcPairRecord) GetTypeMeta() vanflow.TypeMeta

func (ProcPairRecord) Identity

func (r ProcPairRecord) Identity() string

type Process

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

func (Process) Connectors

func (n Process) Connectors() []Connector

func (Process) Get

func (b Process) Get() (entry store.Entry, found bool)

func (Process) GetRecord

func (n Process) GetRecord() (record vanflow.ProcessRecord, found bool)

func (Process) ID

func (n Process) ID() string

func (Process) IsKnown

func (n Process) IsKnown() bool

func (Process) Parent

func (n Process) Parent() Site

type ProcessGroupRecord

type ProcessGroupRecord struct {
	ID    string
	Name  string
	Start time.Time
}

func (ProcessGroupRecord) GetTypeMeta

func (r ProcessGroupRecord) GetTypeMeta() vanflow.TypeMeta

func (ProcessGroupRecord) Identity

func (r ProcessGroupRecord) Identity() string

type RequestRecord

type RequestRecord struct {
	ID          string
	TransportID string
	StartTime   time.Time
	EndTime     time.Time

	RoutingKey string
	Protocol   string

	Connector    NamedReference
	Listener     NamedReference
	Source       NamedReference
	Dest         NamedReference
	SourceSite   NamedReference
	SourceRouter NamedReference
	DestSite     NamedReference
	DestRouter   NamedReference
	SourceGroup  NamedReference
	DestGroup    NamedReference
	Trace        string
	// contains filtered or unexported fields
}

func (*RequestRecord) GetFlow

func (cr *RequestRecord) GetFlow() (vanflow.AppBiflowRecord, bool)

func (*RequestRecord) GetTransport

func (cr *RequestRecord) GetTransport() (vanflow.TransportBiflowRecord, bool)

func (RequestRecord) GetTypeMeta

func (r RequestRecord) GetTypeMeta() vanflow.TypeMeta

func (RequestRecord) Identity

func (r RequestRecord) Identity() string

type Router

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

func (Router) Connectors

func (n Router) Connectors() []Connector

func (Router) Get

func (b Router) Get() (entry store.Entry, found bool)

func (Router) GetRecord

func (n Router) GetRecord() (record vanflow.RouterRecord, found bool)

func (Router) ID

func (n Router) ID() string

func (Router) IsKnown

func (n Router) IsKnown() bool

func (Router) Listeners

func (n Router) Listeners() []Listener

func (Router) Parent

func (n Router) Parent() Site

type RouterAccess

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

func (RouterAccess) Get

func (b RouterAccess) Get() (entry store.Entry, found bool)

func (RouterAccess) ID

func (n RouterAccess) ID() string

func (RouterAccess) IsKnown

func (n RouterAccess) IsKnown() bool

func (RouterAccess) Parent

func (n RouterAccess) Parent() Router

func (RouterAccess) Peers

func (n RouterAccess) Peers() []Link

type RoutingKey

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

func (RoutingKey) Connectors

func (n RoutingKey) Connectors() []Connector

func (RoutingKey) Get

func (b RoutingKey) Get() (entry store.Entry, found bool)

func (RoutingKey) ID

func (n RoutingKey) ID() string

func (RoutingKey) IsKnown

func (n RoutingKey) IsKnown() bool

func (RoutingKey) Listeners

func (n RoutingKey) Listeners() []Listener

func (RoutingKey) Parent

func (n RoutingKey) Parent() Address

type Site

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

func (Site) Get

func (b Site) Get() (entry store.Entry, found bool)

func (Site) GetRecord

func (n Site) GetRecord() (record vanflow.SiteRecord, found bool)

func (Site) ID

func (n Site) ID() string

func (Site) IsKnown

func (n Site) IsKnown() bool
func (n Site) Links() []Link

func (Site) RouterAccess

func (n Site) RouterAccess() []RouterAccess

func (Site) Routers

func (n Site) Routers() []Router

type SiteHost

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

SiteHost references a siteID+Host combo. Serves as a relation between network traffic and processes.

func (SiteHost) Connectors

func (n SiteHost) Connectors() []Connector

func (SiteHost) Get

func (b SiteHost) Get() (entry store.Entry, found bool)

func (SiteHost) ID

func (n SiteHost) ID() string

func (SiteHost) IsKnown

func (n SiteHost) IsKnown() bool

func (SiteHost) Process

func (n SiteHost) Process() Process

type SitePairRecord

type SitePairRecord struct {
	ID       string
	Protocol string
	Source   string
	Dest     string
	Start    time.Time
}

func (SitePairRecord) GetTypeMeta

func (r SitePairRecord) GetTypeMeta() vanflow.TypeMeta

func (SitePairRecord) Identity

func (r SitePairRecord) Identity() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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