flow

package
v0.0.0-...-6b10bcf Latest Latest
Warning

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

Go to latest
Published: May 2, 2024 License: Apache-2.0 Imports: 33 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BeaconAddress string = "mc/sfe.all"
	RecordPrefix  string = "mc/sfe."
	DirectPrefix  string = "sfe."
)
View Source
const (
	Site             = iota // 0
	Router                  // 1
	Link                    // 2
	Controller              // 3
	Listener                // 4
	Connector               // 5
	Flow                    // 6
	Process                 // 7
	Image                   // 8
	Ingress                 // 9
	Egress                  // 10
	Collector               // 11
	ProcessGroup            // 12
	Host                    // 13
	LogEvent                // 14
	FlowPair                // 15 (generated)
	FlowAggregate           // 16
	EventSource             // 17
	SitePair                // 18
	ProcessGroupPair        // 19
	ProcessPair             // 20
	Address                 // 21
)

RecordTypes

View Source
const (
	TypeOfRecord    = iota //0
	Identity               // 1
	Parent                 // 2
	StartTime              // 3
	EndTime                // 4
	CounterFlow            // 5
	PeerIdentity           // 6
	ProcessIdentity        // 7
	SiblingOrdinal         // 8
	Location               // 9
	Provider               // 10
	Platform               // 11
	Namespace              // 12
	Mode                   // 13
	SourceHost             // 14
	DestHost               // 15
	Protocol               // 16
	SourcePort             // 17
	DestPort               // 18
	VanAddress             // 19
	ImageName              // 20
	ImageVersion           // 21
	HostName               // 22
	Octets                 // 23
	Latency                // 24
	TransitLatency         // 25
	Backlog                // 26
	Method                 // 27
	Result                 // 28
	Reason                 // 29
	Name                   // 30
	Trace                  // 31
	BuildVersion           // 32
	LinkCost               // 33
	Direction              // 34
	OctetRate              // 35
	OctetsOut              // 36
	OctetsUnacked          // 37
	WindowClosures         // 38
	WindowSize             // 39
	FlowCountL4            // 40
	FlowCountL7            // 41
	FlowRateL4             // 42
	FlowRateL7             // 43
	Duration               // 44
	ImageAttr              // 45
	Group                  // 46
	StreamIdentity         // 47
	LogSeverity            // 48
	LogText                // 49
	SourceFile             // 50
	SourceLine             // 51
	Version                // 52
	Policy                 // 53
	Target                 // 54
)

Attribute Types

View Source
const (
	FlowControllerEvent string = "FlowControllerEvent"
)
View Source
const WithPolicyDisabled = policyEnabledConst(false)

Variables

View Source
var Bound string = "bound"
View Source
var Disabled string = "disabled"
View Source
var Enabled string = "enabled"
View Source
var External string = "external"
View Source
var Incoming string = "incoming"
View Source
var Internal string = "internal"
View Source
var Outgoing string = "outgoing"
View Source
var Remote string = "remote"
View Source
var Unbound string = "unbound"

Functions

func UpdateHost

func UpdateHost(c *FlowController, deleted bool, name string, host *HostRecord) error

func UpdateProcess

func UpdateProcess(c *FlowController, deleted bool, name string, process *ProcessRecord) error

Types

type ApiRequest

type ApiRequest struct {
	RecordType  int
	HandlerName string
	Request     *http.Request
}

type ApiResponse

type ApiResponse struct {
	Body   *string
	Status int
}

type Base

type Base struct {
	RecType   string `json:"recType,omitempty"`
	Identity  string `json:"identity,omitempty"`
	Parent    string `json:"parent,omitempty"`
	StartTime uint64 `json:"startTime"`
	EndTime   uint64 `json:"endTime"`
	Purged    bool   `json:"purged,omitempty"`
	Source    string `json:"source,omitempty"`
}

func (*Base) TimeRangeValid

func (base *Base) TimeRangeValid(qp QueryParams) bool

type BeaconRecord

type BeaconRecord struct {
	Version    uint32 `json:"version,omitempty"`
	SourceType string `json:"sourceType,omitempty"`
	Address    string `json:"address,omitempty"`
	Direct     string `json:"direct,omitempty"`
	Identity   string `json:"identity,omitempty"`
}

type CollectorMode

type CollectorMode int
const (
	RecordStatus CollectorMode = iota
	RecordMetrics
)

type CollectorRecord

type CollectorRecord struct {
	Base
	PrometheusUrl string
}

type ConnectorRecord

type ConnectorRecord struct {
	Base
	DestHost    *string `json:"destHost,omitempty"`
	DestPort    *string `json:"destPort,omitempty"`
	Protocol    *string `json:"protocol,omitempty"`
	Address     *string `json:"address,omitempty"`
	FlowCountL4 *uint64 `json:"flowCountL4,omitempty"`
	FlowRateL4  *uint64 `json:"flowRateL4,omitempty"`
	FlowCountL7 *uint64 `json:"flowCountL7,omitempty"`
	FlowRateL7  *uint64 `json:"flowRateL7,omitempty"`
	Target      *string `json:"target,omitempty"`
	ProcessId   *string `json:"processId,omitempty"`
	AddressId   *string `json:"addressId,omitempty"`
}

type ControllerRecord

type ControllerRecord struct {
	ImageName    string `json:"imageName,omitempty"`
	ImageVersion string `json:"imageVersion,omitempty"`
	Hostname     string `json:"hostame,omitempty"`
	Name         string `json:"name,omitempty"`
	BuildVersion string `json:"buildVersion,omitempty"`
	// contains filtered or unexported fields
}

type EventSourceRecord

type EventSourceRecord struct {
	Base
	Beacon     *BeaconRecord `json:"beacon,omitempty"`
	LastHeard  uint64        `json:"lastHeard,omitempty"`
	Heartbeats int           `json:"heartbeats,omitempty"`
	Beacons    int           `json:"beacons,omitempty"`
	Messages   int           `json:"messages,omitempty"`
}

type FlowAggregateRecord

type FlowAggregateRecord struct {
	Base
	PairType            string  `json:"pairType,omitempty"`
	RecordCount         uint64  `json:"recordCount,omitempty"`
	SourceId            *string `json:"sourceId,omitempty"`
	SourceName          *string `json:"sourceName,omitempty"`
	DestinationId       *string `json:"destinationId,omitempty"`
	DestinationName     *string `json:"destinationName,omitempty"`
	SourceSiteId        *string `json:"sourceSiteId,omitempty"`
	SourceSiteName      *string `json:"sourceSiteName,omitempty"`
	DestinationSiteId   *string `json:"destinationSiteId,omitempty"`
	DestinationSiteName *string `json:"destinationSiteName,omitempty"`
	Protocol            *string `json:"protocol,omitempty"`
}

type FlowCollector

type FlowCollector struct {
	Collector CollectorRecord

	Request  chan ApiRequest
	Response chan ApiResponse

	Beacons    map[string]*BeaconRecord
	Sites      map[string]*SiteRecord
	Hosts      map[string]*HostRecord
	Routers    map[string]*RouterRecord
	Links      map[string]*LinkRecord
	Listeners  map[string]*ListenerRecord
	Connectors map[string]*ConnectorRecord

	Flows          map[string]*FlowRecord
	FlowPairs      map[string]*FlowPairRecord
	FlowAggregates map[string]*FlowAggregateRecord
	Processes      map[string]*ProcessRecord
	ProcessGroups  map[string]*ProcessGroupRecord
	VanAddresses   map[string]*VanAddressRecord
	// contains filtered or unexported fields
}

func NewFlowCollector

func NewFlowCollector(spec FlowCollectorSpec) *FlowCollector

func (*FlowCollector) NewMetrics

func (fc *FlowCollector) NewMetrics(reg prometheus.Registerer) *collectorMetrics

func (*FlowCollector) PrimeSiteBeacons

func (c *FlowCollector) PrimeSiteBeacons(controllerID, routerID string)

PrimeSiteBeacons "sends" the collector phony beacon records for a controller and a router event source when their addresses are known in order to avoid the startup time waiting for beacon records.

func (*FlowCollector) Start

func (c *FlowCollector) Start(stopCh <-chan struct{})

type FlowCollectorSpec

type FlowCollectorSpec struct {
	Mode                CollectorMode
	Namespace           string
	Origin              string
	PromReg             prometheus.Registerer
	ConnectionFactory   messaging.ConnectionFactory
	FlowRecordTtl       time.Duration
	NetworkStatusClient kubernetes.Interface
}

type FlowController

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

func NewFlowController

func NewFlowController(origin string, version string, creationTime uint64, connectionFactory messaging.ConnectionFactory, policyEvaluator PolicyEvaluator) *FlowController

func (*FlowController) Start

func (c *FlowController) Start(stopCh <-chan struct{})

type FlowPairRecord

type FlowPairRecord struct {
	Base
	Duration                uint64      `json:"duration"`
	Protocol                *string     `json:"protocol,omitempty"`
	SourceSiteId            string      `json:"sourceSiteId,omitempty"`
	SourceSiteName          *string     `json:"sourceSiteName,omitempty"`
	DestinationSiteId       string      `json:"destinationSiteId,omitempty"`
	DestinationSiteName     *string     `json:"destinationSiteName,omitempty"`
	FlowTrace               *string     `json:"flowTrace,omitempty"`
	ForwardFlow             *FlowRecord `json:"forwardFlow,omitempty"`
	CounterFlow             *FlowRecord `json:"counterFlow,omitempty"`
	SiteAggregateId         *string     `json:"siteAggregateId,omitempty"`
	ProcessGroupAggregateId *string     `json:"processGroupAggregateId,omitempty"`
	ProcessAggregateId      *string     `json:"processAggregateId,omitempty"`
}

Note a flowpair does not have a defined parent relationship through Base

type FlowPlace

type FlowPlace int

type FlowRecord

type FlowRecord struct {
	Base
	SourceHost     *string   `json:"sourceHost,omitempty"`
	SourcePort     *string   `json:"sourcePort,omitempty"`
	CounterFlow    *string   `json:"counterFlow,omitempty"`
	Trace          *string   `json:"trace,omitempty"`
	Latency        *uint64   `json:"latency,omitempty"`
	Octets         *uint64   `json:"octets"`
	OctetsOut      *uint64   `json:"octetsOut,omitempty"`
	OctetsUnacked  *uint64   `json:"octetsUnacked,omitempty"`
	WindowClosures *uint64   `json:"windowClosures,omitempty"`
	WindowSize     *uint64   `json:"windowSize,omitempty"`
	Reason         *string   `json:"reason,omitempty"`
	Method         *string   `json:"method,omitempty"`
	Result         *string   `json:"result,omitempty"`
	StreamIdentity *uint64   `json:"streamIdentity,omitempty"`
	Process        *string   `json:"process,omitempty"`
	ProcessName    *string   `json:"processName,omitempty"`
	Protocol       *string   `json:"protocol,omitempty"`
	Place          FlowPlace `json:"place"`
	// contains filtered or unexported fields
}

type FlowToPairRecord

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

type FlushRecord

type FlushRecord struct {
	Address string `json:"address,omitempty"`
	Source  string `json:"source,omitempty"`
}

type HeartbeatRecord

type HeartbeatRecord struct {
	Source   string `json:"source,omityempty"`
	Identity string `json:"identity,omitempty"`
	Version  uint32 `json:"version,omitempty"`
	Now      uint64 `json:"now,omitempty"`
}

type HostRecord

type HostRecord struct {
	Base
	Location          *string `json:"location,omitempty"`
	Provider          *string `json:"provider,omitempty"`
	Platform          *string `json:"platform,omitempty"`
	Name              *string `json:"name,omitempty"`
	Arch              *string `json:"arch,omitempty"`
	OperatingSystem   *string `json:"operatingSystem,omitempty"`
	OperatingSystemId *string `json:"operatingSystemId,omitempty"`
	Region            *string `json:"region,omitempty"`
	Zone              *string `json:"zone,omitempty"`
	ContainerRuntime  *string `json:"containerRuntime,omitempty"`
	KernelVersion     *string `json:"kernelVersion,omitempty"`
	KubeProxyVersion  *string `json:"kubeProxyVersion,omitempty"`
	KubeletVersion    *string `json:"kubeletVersion,omitempty"`
}

type ImageRecord

type ImageRecord struct {
	Base
	Name    string `json:"name,omitempty"`
	Version string `json:"version,omitempty"`
}

type LinkRecord

type LinkRecord struct {
	Base
	Mode      *string `json:"mode,omitempty"`
	Name      *string `json:"name,omitempty"`
	LinkCost  *uint64 `json:"linkCost,omitempty"`
	Direction *string `json:"direction,omitempty"`
}

type ListenerRecord

type ListenerRecord struct {
	Base
	Name        *string `json:"name,omitempty"`
	DestHost    *string `json:"destHost,omitempty"`
	DestPort    *string `json:"destPort,omitempty"`
	Protocol    *string `json:"protocol,omitempty"`
	Address     *string `json:"address,omitempty"`
	FlowCountL4 *uint64 `json:"flowCountL4,omitempty"`
	FlowRateL4  *uint64 `json:"flowRateL4,omitempty"`
	FlowCountL7 *uint64 `json:"flowCountL7,omitempty"`
	FlowRateL7  *uint64 `json:"flowRateL7,omitempty"`
	AddressId   *string `json:"addressId,omitempty"`
}

type LogEventRecord

type LogEventRecord struct {
	Base
	LogSeverity *uint64 `json:"severity,omitempty"`
	LogText     *string `json:"logText,omitempty"`
	SourceFile  *string `json:"fileName,omitempty"`
	SourceLine  *uint64 `json:"lineNumber,omitempty"`
}

type NetworkStatus

type NetworkStatus struct {
	Addresses []*VanAddressRecord `json:"addresses"`
	Sites     []*SiteStatus       `json:"siteStatus"`
}

type Payload

type Payload struct {
	Results        interface{} `json:"results"`
	Status         string      `json:"status"`
	Count          int         `json:"count"`
	TimeRangeCount int         `json:"timeRangeCount"`
	TotalCount     int         `json:"totalCount"`
	// contains filtered or unexported fields
}

type PolicyEvaluator

type PolicyEvaluator interface {
	Enabled() bool
}

type ProcessGroupRecord

type ProcessGroupRecord struct {
	Base
	Name             *string `json:"name,omitempty"`
	ProcessGroupRole *string `json:"processGroupRole,omitempty"`
	ProcessCount     int     `json:"processCount,omitempty"`
}

type ProcessRecord

type ProcessRecord struct {
	Base
	Name           *string   `json:"name,omitempty"`
	ParentName     *string   `json:"parentName,omitempty"`
	ImageName      *string   `json:"imageName,omitempty"`
	Image          *string   `json:"image,omitempty"`
	GroupName      *string   `json:"groupName,omitempty"`
	GroupIdentity  *string   `json:"groupIdentity,omitempty"`
	HostName       *string   `json:"hostName,omitempty"`
	SourceHost     *string   `json:"sourceHost,omitempty"`
	ProcessRole    *string   `json:"processRole,omitempty"`
	ProcessBinding *string   `json:"processBinding,omitempty"`
	Addresses      []*string `json:"addresses,omitempty"`
	// contains filtered or unexported fields
}

type QueryParams

type QueryParams struct {
	Offset             int                 `json:"offset"`
	Limit              int                 `json:"limit"`
	SortBy             string              `json:"sortBy"`
	Filter             string              `json:"filter"`
	FilterFields       map[string][]string `json:"filterFields"`
	TimeRangeStart     uint64              `json:"timeRangeStart"`
	TimeRangeEnd       uint64              `json:"timeRangeEnd"`
	TimeRangeOperation TimeRangeRelation   `json:"timeRangeOperation"`
	State              RecordState         `json:"state"`
}

type RecordState

type RecordState int

type RouterRecord

type RouterRecord struct {
	Base
	Name         *string `json:"name,omitempty"`
	Namespace    *string `json:"namespace,omitempty"`
	Mode         *string `json:"mode,omitempty"`
	ImageName    *string `json:"imageName,omitempty"`
	ImageVersion *string `json:"imageVersion,omitempty"`
	Hostname     *string `json:"hostname,omitempty"`
	BuildVersion *string `json:"buildVersion,omitempty"`
}

type RouterStatus

type RouterStatus struct {
	Router     *RouterRecord      `json:"router"`
	Links      []*LinkRecord      `json:"links"`
	Listeners  []*ListenerRecord  `json:"listeners"`
	Connectors []*ConnectorRecord `json:"connectors"`
}

type SiteRecord

type SiteRecord struct {
	Base
	Location  *string `json:"location,omitempty"`
	Provider  *string `json:"provider,omitempty"`
	Platform  *string `json:"platform,omitempty"`
	Name      *string `json:"name,omitempty"`
	NameSpace *string `json:"nameSpace,omitempty"`
	Version   *string `json:"siteVersion,omitempty"`
	Policy    *string `json:"policy,omitempty"`
}

type SiteStatus

type SiteStatus struct {
	Site         *SiteRecord    `json:"site"`
	RouterStatus []RouterStatus `json:"routerStatus"`
}

type TimeRangeRelation

type TimeRangeRelation int

type VanAddressRecord

type VanAddressRecord struct {
	Base
	Name           string `json:"name,omitempty"`
	Protocol       string `json:"protocol,omitempty"`
	ListenerCount  int    `json:"listenerCount"`
	ConnectorCount int    `json:"connectorCount"`
	// contains filtered or unexported fields
}

Van Address represents a service that is attached to the application network

Jump to

Keyboard shortcuts

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