common

package
v0.0.0-...-02ab0c4 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2021 License: MIT Imports: 12 Imported by: 0

README

Common directory

This directory contains base types/functionality required by both standard metrics and flow based metrics.

Documentation

Index

Constants

View Source
const DefaultClusterIndex = 0

DefaultClusterIndex is used whenever a metric does not support clustering, or no clustering is used

View Source
const MAXRWIN uint16 = utils.MaxUint16

Maximal distance between two ACK responses. If higher, the packets are most likely out of order

View Source
const MAXWindow uint32 = uint32(MAXRWIN) * 16384 // Max Rwin * Max TCP WINDOW Scale Option (2^14)

Variables

This section is empty.

Functions

This section is empty.

Types

type ExportBivariateClusterFormat

type ExportBivariateClusterFormat struct {
	Clusters map[int]*ExportBivariateFormat
}

type ExportBivariateFormat

type ExportBivariateFormat struct {
	Variable map[int]*ExportUnivariateFormat
}

type ExportUnivariateClusterFormat

type ExportUnivariateClusterFormat struct {
	Clusters map[int]*ExportUnivariateFormat
}

type ExportUnivariateFormat

type ExportUnivariateFormat struct {
	Values [][]int // List of [value, counter] tuples
}

type IntMetric

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

func NewIntMetric

func NewIntMetric() IntMetric

NewIntMetric creates a new Integer Metrics

func (*IntMetric) AddValue

func (im *IntMetric) AddValue(protocol Protocol, values ...int)

AddValue adds one or multiple values to the Metric. It will scale all values to the configured resolution

func (*IntMetric) Export

func (im *IntMetric) Export(protocolKey ProtocolKeyType) int

Export the metrics as (value, count) tuples

func (*IntMetric) GetProtocols

func (im *IntMetric) GetProtocols() []Protocol

Export the Protocols

func (*IntMetric) GetStatistics

func (im *IntMetric) GetStatistics(verbose bool) string

GetStatistics returns a string with the most important informations. Use fmt.Print() to print it

type IntMetricBivariate

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

func NewIntMetricBivariate

func NewIntMetricBivariate(resolution int, logScaling, variableLogScaling bool) IntMetricBivariate

NewIntMetricBivariate creates a new bivariate Integer Metric

func (*IntMetricBivariate) AddValue

func (imb *IntMetricBivariate) AddValue(protocol Protocol, clusterIndex int, values ...[]int)

AddValue adds one or multiple values to the Metric. It will scale all values to the configured resolution It expects that each value is a tuple with [variable, value].

func (*IntMetricBivariate) Export

func (imb *IntMetricBivariate) Export(protocolKey ProtocolKeyType, clusterIndex int) *ExportBivariateFormat

Export the metrics for one cluster

func (*IntMetricBivariate) ExportClusters

func (imb *IntMetricBivariate) ExportClusters(protocolKey ProtocolKeyType) *ExportBivariateClusterFormat

func (*IntMetricBivariate) GetProtocols

func (imb *IntMetricBivariate) GetProtocols() []Protocol

Export the Protocols

func (*IntMetricBivariate) GetStatistics

func (imb *IntMetricBivariate) GetStatistics(verbose bool) string

GetStatistics returns a string with the most important informations. Use fmt.Print() to print it

type IntMetricUnivariate

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

func NewIntMetricUnivariate

func NewIntMetricUnivariate(resolution int, logScaling bool) IntMetricUnivariate

NewIntMetric creates a new Univariate Integer Metrics

func (*IntMetricUnivariate) AddValue

func (imu *IntMetricUnivariate) AddValue(protocol Protocol, clusterIndex int, values ...int)

AddValue adds one or multiple values to the Metric. It will scale all values to the configured resolution

func (*IntMetricUnivariate) Export

func (imu *IntMetricUnivariate) Export(protocolKey ProtocolKeyType, clusterIndex int) *ExportUnivariateFormat

Export the metrics for one cluster

func (*IntMetricUnivariate) ExportClusters

func (imu *IntMetricUnivariate) ExportClusters(protocolKey ProtocolKeyType) *ExportUnivariateClusterFormat

func (*IntMetricUnivariate) GetProtocols

func (imu *IntMetricUnivariate) GetProtocols() []Protocol

Export the Protocols

func (*IntMetricUnivariate) GetStatistics

func (imu *IntMetricUnivariate) GetStatistics(verbose bool) string

GetStatistics returns a string with the most important information. Use fmt.Print() to print it

type MetricReconstructedPacketsSize

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

func NewMetricReconstructedPacketsSize

func NewMetricReconstructedPacketsSize() *MetricReconstructedPacketsSize

func (*MetricReconstructedPacketsSize) Export

Export returns the metric data per Protocol

func (*MetricReconstructedPacketsSize) GetProtocols

func (mrp *MetricReconstructedPacketsSize) GetProtocols() []Protocol

Export the stored protocols

func (*MetricReconstructedPacketsSize) Name

Name of the Metric

func (*MetricReconstructedPacketsSize) PrintStatistic

func (mrp *MetricReconstructedPacketsSize) PrintStatistic(verbose bool)

PrintStatistic prints some statistic to the console

type MetricReconstructedPacketsSpeed

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

func NewMetricReconstructedPacketsSpeed

func NewMetricReconstructedPacketsSpeed() *MetricReconstructedPacketsSpeed

func (*MetricReconstructedPacketsSpeed) Export

Export returns the metric data per Protocol

func (*MetricReconstructedPacketsSpeed) GetProtocols

func (mrp *MetricReconstructedPacketsSpeed) GetProtocols() []Protocol

Export the stored protocols

func (*MetricReconstructedPacketsSpeed) Name

Name of the Metric

func (*MetricReconstructedPacketsSpeed) PrintStatistic

func (mrp *MetricReconstructedPacketsSpeed) PrintStatistic(verbose bool)

PrintStatistic prints some statistic to the console

type Protocol

type Protocol struct {
	Protocol    uint8
	Port        uint16
	ProtocolKey ProtocolKeyType
}

Protocol identifies a network protocol based on its Transport Protocol and Server Port

func GetProtocol

func GetProtocol(flow *flows.Flow) Protocol

func (Protocol) GetProtocolString

func (protocol Protocol) GetProtocolString() string

type ProtocolKeyType

type ProtocolKeyType uint64

ProtocolKeyType is the hashed interpretation of an application protocol (TCP/UDP + Port)

func GetProtocolKey

func GetProtocolKey(protocolString string) ProtocolKeyType

type ReqResIdentifier

type ReqResIdentifier struct {
	DropUnidirectionalFlows bool
	ReconstructTCPResponse  bool
	// contains filtered or unexported fields
}

func NewReqResIdentifier

func NewReqResIdentifier(dropUnidirectionalFlows, reconstructTCPResponse bool,
	statisticReconstructionSpeed *MetricReconstructedPacketsSpeed,
	statisticReconstructionSize *MetricReconstructedPacketsSize) *ReqResIdentifier

func (*ReqResIdentifier) OnTCPFlush

func (rri *ReqResIdentifier) OnTCPFlush(protocol Protocol, flow *flows.TCPFlow) (reqRes []*RequestResponse, dropFlow bool)

onFlush Identifies the request response pairs per flow. If it is a UDP Flow, tcpPacket is nil.

func (*ReqResIdentifier) OnUDPFlush

func (rri *ReqResIdentifier) OnUDPFlush(protocol Protocol, flow *flows.UDPFlow) (reqRes []*RequestResponse, dropFlow bool)

onFlush Identifies the request response pairs per flow. If it is a UDP Flow, tcpPacket is nil.

func (*ReqResIdentifier) PrintStatistic

func (rri *ReqResIdentifier) PrintStatistic(verbose bool)

type RequestResponse

type RequestResponse struct {
	Requests     []flows.Packet
	Responses    []flows.Packet
	ClusterIndex int
}

Jump to

Keyboard shortcuts

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