flow

package
v0.28.0 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2021 License: Apache-2.0 Imports: 48 Imported by: 74

Documentation

Index

Constants

View Source
const (
	// DefaultCaptureLength : default packet capture length
	DefaultCaptureLength uint32 = 256
	// MaxCaptureLength : maximum capture length accepted
	MaxCaptureLength uint32 = 4096
	// MaxRawPacketLimit : maximum raw packet captured, limitation could be removed once flow over tcp
	MaxRawPacketLimit uint32 = 10
	// DefaultProtobufFlowSize : the default protobuf size without any raw packet for a flow
	DefaultProtobufFlowSize = 500
)
View Source
const (
	// OperationExtFlowType classic flow passed as Operation
	OperationExtFlowType = iota

	// EBPFExtFlowType type of eBPF flow
	EBPFExtFlowType
)
View Source
const HoldTimeoutMilliseconds = int64(time.Duration(15) * time.Second / time.Millisecond)

HoldTimeoutMilliseconds is the number of milliseconds for holding ended flows before they get deleted from the flow table

View Source
const (
	Namespace = "Flow"
)

Namespace "Flow"

Variables

View Source
var (
	// ErrFlowProtocol invalid protocol error
	ErrFlowProtocol = errors.New("FlowProtocol invalid")
	// ErrLayerNotFound layer not present in the packet
	ErrLayerNotFound = errors.New("Layer not found")
)
View Source
var (
	ErrInvalidLengthFlow        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowFlow          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupFlow = fmt.Errorf("proto: unexpected end of group")
)
View Source
var FlowFinishType_name = map[int32]string{
	0: "NOT_FINISHED",
	1: "TIMEOUT",
	2: "TCP_FIN",
	3: "TCP_RST",
}
View Source
var FlowFinishType_value = map[string]int32{
	"NOT_FINISHED": 0,
	"TIMEOUT":      1,
	"TCP_FIN":      2,
	"TCP_RST":      3,
}
View Source
var FlowProtocol_name = map[int32]string{
	0: "ETHERNET",
	1: "IPV4",
	2: "TCP",
	3: "UDP",
	4: "SCTP",
	5: "IPV6",
	6: "ICMPV4",
	7: "ICMPV6",
}
View Source
var FlowProtocol_value = map[string]int32{
	"ETHERNET": 0,
	"IPV4":     1,
	"TCP":      2,
	"UDP":      3,
	"SCTP":     4,
	"IPV6":     5,
	"ICMPV4":   6,
	"ICMPV6":   7,
}
View Source
var ICMPType_name = map[int32]string{
	0:  "UNKNOWN",
	1:  "DESTINATION_UNREACHABLE",
	2:  "ECHO",
	3:  "NEIGHBOR",
	4:  "ADDRESS_MASK",
	5:  "INFO",
	6:  "PARAMETER_PROBLEM",
	7:  "REDIRECT",
	8:  "ROUTER",
	9:  "SOURCE_QUENCH",
	10: "TIME_EXCEEDED",
	11: "TIMESTAMP",
	12: "PACKET_TOO_BIG",
}
View Source
var ICMPType_value = map[string]int32{
	"UNKNOWN":                 0,
	"DESTINATION_UNREACHABLE": 1,
	"ECHO":                    2,
	"NEIGHBOR":                3,
	"ADDRESS_MASK":            4,
	"INFO":                    5,
	"PARAMETER_PROBLEM":       6,
	"REDIRECT":                7,
	"ROUTER":                  8,
	"SOURCE_QUENCH":           9,
	"TIME_EXCEEDED":           10,
	"TIMESTAMP":               11,
	"PACKET_TOO_BIG":          12,
}
View Source
var LayerTypeERSPanII = gopacket.RegisterLayerType(55557, gopacket.LayerTypeMetadata{Name: "LayerTypeERSPanII", Decoder: gopacket.DecodeFunc(decodeERSpanIILayer)})

LayerTypeERSPanII decoder

View Source
var LayerTypeRawIP = gopacket.RegisterLayerType(55555, gopacket.LayerTypeMetadata{Name: "LayerTypeRawIP", Decoder: gopacket.DecodeFunc(decodeInGRELayer)})

LayerTypeRawIP creates a layer type, should be unique and high, so it doesn't conflict, giving it a name and a decoder to use.

Functions

func BPFFilterToRaw added in v0.10.0

func BPFFilterToRaw(linkType layers.LinkType, captureLength uint32, filter string) ([]bpf.RawInstruction, error)

BPFFilterToRaw creates a raw binary filter from a BPF expression

func DefaultLayerKeyModeName added in v0.18.0

func DefaultLayerKeyModeName() string

DefaultLayerKeyModeName returns the default layer key mode

func GetFirstLayerType added in v0.17.0

func GetFirstLayerType(encapType string) (gopacket.LayerType, layers.LinkType)

GetFirstLayerType returns layer type and link type according to the given encapsulation

func LayersPath added in v0.18.0

func LayersPath(ls []gopacket.Layer) (string, string)

LayersPath returns path and the application of all the layers separated by a slash.

func NewFilterForFlowSet added in v0.10.0

func NewFilterForFlowSet(flowset *FlowSet) *filters.Filter

NewFilterForFlowSet creates a new filter based on a set of flows

func NewFilterForNodeTIDs added in v0.10.0

func NewFilterForNodeTIDs(uuids []string) *filters.Filter

NewFilterForNodeTIDs creates a new filter based on flow NodeTID

func NewFilterForNodes added in v0.5.0

func NewFilterForNodes(nodes []*graph.Node) *filters.Filter

NewFilterForNodes creates a new filter based on graph nodes

func SetEBPFKernFlow added in v0.24.0

func SetEBPFKernFlow(ebpfFlow *EBPFFlow, kernFlow unsafe.Pointer)

SetEBPFKernFlow is an helper function that aims to provide a way to set kernFlow from external packages as Go doesn't allow to acces to C struct from different packages.

func UnixMilli added in v0.27.0

func UnixMilli(t time.Time) int64

UnixMilli returns t as a Unix time, the number of milliseconds elapsed since January 1, 1970 UTC.

Types

type ApplicationPortMap added in v0.18.0

type ApplicationPortMap struct {
	UDP map[int]string
	TCP map[int]string
}

ApplicationPortMap maps UDP and TCP port numbers to service names

func NewApplicationPortMapFromConfig added in v0.18.0

func NewApplicationPortMapFromConfig() *ApplicationPortMap

NewApplicationPortMapFromConfig returns a new application port mapper and load it from the configuration file

type BPF added in v0.10.0

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

BPF describes a filter

func NewBPF added in v0.10.0

func NewBPF(linkType layers.LinkType, captureLength uint32, filter string) (*BPF, error)

NewBPF creates a new BPF filter

func (*BPF) Matches added in v0.10.0

func (b *BPF) Matches(data []byte) bool

Matches returns true data match the filter

type EBPFFlow added in v0.24.0

type EBPFFlow struct {
	Start        time.Time
	Last         time.Time
	KernFlow     *C.struct_flow
	StartKTimeNs int64
}

EBPFFlow Wrapper type used for passing flows from probe to main agent routine

type ExtFlow added in v0.26.0

type ExtFlow struct {
	Type ExtFlowType
	Obj  interface{}
}

ExtFlow structure use to send external flow to the flow table

type ExtFlowType added in v0.26.0

type ExtFlowType int

ExtFlowType type of an external flow

type ExtraLayers added in v0.21.0

type ExtraLayers int

ExtraLayers defines extra layer to be pushed in flow

const (
	// VRRPLayer extra layer
	VRRPLayer ExtraLayers = 1
	// DNSLayer extra layer
	DNSLayer ExtraLayers = 2
	// DHCPv4Layer extra layer
	DHCPv4Layer ExtraLayers = 4
	// ALLLayer all extra layers
	ALLLayer ExtraLayers = 255
)

func (ExtraLayers) Extract added in v0.21.0

func (e ExtraLayers) Extract() []string

Extract returns a string list of the ExtraLayers protocol

func (ExtraLayers) MarshalJSON added in v0.21.0

func (e ExtraLayers) MarshalJSON() ([]byte, error)

MarshalJSON serializes the ExtraLayers structure

func (*ExtraLayers) Parse added in v0.21.0

func (e *ExtraLayers) Parse(s ...string) error

Parse set the ExtraLayers struct with the given list of protocol strings

func (ExtraLayers) String added in v0.21.0

func (e ExtraLayers) String() string

String returns a string of the list of the protocols

func (*ExtraLayers) UnmarshalJSON added in v0.21.0

func (e *ExtraLayers) UnmarshalJSON(data []byte) error

UnmarshalJSON deserializes json input to ExtraLayers

type Flow

type Flow struct {
	XXX_state flowState `json:"-"`
	// Flow Universally Unique IDentifier
	//flow.UUID is unique in the universe, as it should be used as a key of an
	//hashtable. By design 2 different flows, their UUID are always different.
	//flow.UUID can be used as Database Index.
	UUID       string `protobuf:"bytes,1,opt,name=UUID,proto3" json:"UUID,omitempty"`
	LayersPath string `protobuf:"bytes,2,opt,name=LayersPath,proto3" json:"LayersPath,omitempty"`
	// Application is the last layer which is not a payload.
	Application string `protobuf:"bytes,3,opt,name=Application,proto3" json:"Application,omitempty"`
	// Data Flow info
	Link      *FlowLayer      `protobuf:"bytes,20,opt,name=Link,proto3" json:"Link,omitempty"`
	Network   *FlowLayer      `protobuf:"bytes,21,opt,name=Network,proto3" json:"Network,omitempty"`
	Transport *TransportLayer `protobuf:"bytes,22,opt,name=Transport,proto3" json:"Transport,omitempty"`
	ICMP      *ICMPLayer      `protobuf:"bytes,23,opt,name=ICMP,proto3" json:"ICMP,omitempty"`
	// extra layers
	DHCPv4 *layers.DHCPv4 `protobuf:"bytes,1000,opt,name=DHCPv4,proto3" json:"DHCPv4,omitempty"`
	DNS    *layers.DNS    `protobuf:"bytes,1001,opt,name=DNS,proto3" json:"DNS,omitempty"`
	VRRPv2 *layers.VRRPv2 `protobuf:"bytes,1002,opt,name=VRRPv2,proto3" json:"VRRPv2,omitempty"`
	// Data Flow Metric info from the 1st layer
	//amount of data between two updates
	LastUpdateMetric *FlowMetric `protobuf:"bytes,31,opt,name=LastUpdateMetric,proto3" json:"LastUpdateMetric,omitempty"`
	// Total amount of data for the whole flow duration
	Metric *FlowMetric `protobuf:"bytes,32,opt,name=Metric,proto3" json:"Metric,omitempty"`
	// Metric specific to the TCP and IPs Protocols and optional
	TCPMetric *TCPMetric `protobuf:"bytes,38,opt,name=TCPMetric,proto3" json:"TCPMetric,omitempty"`
	IPMetric  *IPMetric  `protobuf:"bytes,39,opt,name=IPMetric,proto3" json:"IPMetric,omitempty"`
	Start     int64      `protobuf:"varint,10,opt,name=Start,proto3" json:"Start"`
	Last      int64      `protobuf:"varint,11,opt,name=Last,proto3" json:"Last"`
	// Flow Tracking IDentifier, from 1st packet bytes
	//flow.TrackingID could be used to identify an unique flow whatever it has
	//been captured on the infrastructure. flow.TrackingID is calculated from
	//the bytes of the first packet of his session.
	//flow.TrackingID can be used as a Tag.
	TrackingID   string `protobuf:"bytes,50,opt,name=TrackingID,proto3" json:"TrackingID,omitempty"`
	L3TrackingID string `protobuf:"bytes,51,opt,name=L3TrackingID,proto3" json:"L3TrackingID,omitempty"`
	// Flow Parent UUID is used as reference to the parent flow
	//Flow.ParentUUID is the same value that point to his parent flow.UUID
	ParentUUID string `protobuf:"bytes,6,opt,name=ParentUUID,proto3" json:"ParentUUID"`
	// Topology info
	NodeTID string `protobuf:"bytes,33,opt,name=NodeTID,proto3" json:"NodeTID,omitempty"`
	// Capture info
	CaptureID string `protobuf:"bytes,34,opt,name=CaptureID,proto3" json:"CaptureID,omitempty"`
	// raw packets, will not be exported, see Makefile
	LastRawPackets []*RawPacket `protobuf:"bytes,36,rep,name=LastRawPackets,proto3" json:"-"`
	// number of raw packet captured
	RawPacketsCaptured int64 `protobuf:"varint,37,opt,name=RawPacketsCaptured,proto3" json:"RawPacketsCaptured"`
	// describes the way the flow was ended (e.g. by RST, FIN)
	FinishType FlowFinishType `protobuf:"varint,60,opt,name=FinishType,proto3,enum=flow.FlowFinishType" json:"FinishType,omitempty"`
}

func NewFlow added in v0.26.0

func NewFlow() *Flow

NewFlow creates a new empty flow

func NewFlowFromGoPacket added in v0.26.0

func NewFlowFromGoPacket(p gopacket.Packet, parentUUID string, uuids *UUIDs, opts *Opts) *Flow

NewFlowFromGoPacket creates a new flow from the given gopacket

func (*Flow) Descriptor

func (*Flow) Descriptor() ([]byte, []int)

func (*Flow) GetApplication added in v0.26.0

func (m *Flow) GetApplication() string

func (*Flow) GetCaptureID added in v0.26.0

func (m *Flow) GetCaptureID() string

func (*Flow) GetDHCPv4 added in v0.26.0

func (m *Flow) GetDHCPv4() *layers.DHCPv4

func (*Flow) GetDNS added in v0.26.0

func (m *Flow) GetDNS() *layers.DNS

func (*Flow) GetField added in v0.26.0

func (f *Flow) GetField(field string) (interface{}, error)

GetField returns the value of a field

func (*Flow) GetFieldBool added in v0.26.0

func (f *Flow) GetFieldBool(field string) (bool, error)

GetFieldBool returns the value of a boolean flow field

func (*Flow) GetFieldInt64 added in v0.7.0

func (f *Flow) GetFieldInt64(field string) (_ int64, err error)

GetFieldInt64 returns the value of a Flow field

func (*Flow) GetFieldKeys added in v0.26.0

func (f *Flow) GetFieldKeys() []string

GetFieldKeys returns the list of valid field of a Flow

func (*Flow) GetFieldString added in v0.7.0

func (f *Flow) GetFieldString(field string) (string, error)

GetFieldString returns the value of a Flow field

func (*Flow) GetFinishType added in v0.26.0

func (m *Flow) GetFinishType() FlowFinishType

func (*Flow) GetICMP added in v0.26.0

func (m *Flow) GetICMP() *ICMPLayer

func (*Flow) GetIPMetric added in v0.26.0

func (m *Flow) GetIPMetric() *IPMetric

func (*Flow) GetL3TrackingID added in v0.26.0

func (m *Flow) GetL3TrackingID() string

func (*Flow) GetLast added in v0.26.0

func (m *Flow) GetLast() int64

func (*Flow) GetLastRawPackets added in v0.26.0

func (m *Flow) GetLastRawPackets() []*RawPacket

func (*Flow) GetLastUpdateMetric added in v0.7.0

func (m *Flow) GetLastUpdateMetric() *FlowMetric

func (*Flow) GetLayersPath added in v0.26.0

func (m *Flow) GetLayersPath() string
func (m *Flow) GetLink() *FlowLayer

func (*Flow) GetMetric added in v0.7.0

func (m *Flow) GetMetric() *FlowMetric

func (*Flow) GetNetwork added in v0.7.0

func (m *Flow) GetNetwork() *FlowLayer

func (*Flow) GetNodeTID added in v0.26.0

func (m *Flow) GetNodeTID() string

func (*Flow) GetParentUUID added in v0.26.0

func (m *Flow) GetParentUUID() string

func (*Flow) GetRawPacketsCaptured added in v0.26.0

func (m *Flow) GetRawPacketsCaptured() int64

func (*Flow) GetStart added in v0.26.0

func (m *Flow) GetStart() int64

func (*Flow) GetTCPMetric added in v0.26.0

func (m *Flow) GetTCPMetric() *TCPMetric

func (*Flow) GetTrackingID added in v0.26.0

func (m *Flow) GetTrackingID() string

func (*Flow) GetTransport added in v0.7.0

func (m *Flow) GetTransport() *TransportLayer

func (*Flow) GetUUID added in v0.26.0

func (m *Flow) GetUUID() string

func (*Flow) GetVRRPv2 added in v0.26.0

func (m *Flow) GetVRRPv2() *layers.VRRPv2

func (*Flow) Init added in v0.7.0

func (f *Flow) Init(now int64, parentUUID string, uuids *UUIDs)

Init initializes the flow with the given Timestamp, parentUUID and table uuids

func (*Flow) LinkType added in v0.26.0

func (f *Flow) LinkType() (layers.LinkType, error)

LinkType returns the Link type of the flow according the its first available layer.

func (*Flow) Marshal added in v0.26.0

func (m *Flow) Marshal() (dAtA []byte, err error)

func (Flow) MarshalEasyJSON added in v0.26.0

func (v Flow) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (Flow) MarshalJSON added in v0.26.0

func (v Flow) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*Flow) MarshalTo added in v0.26.0

func (m *Flow) MarshalTo(dAtA []byte) (int, error)

func (*Flow) MarshalToSizedBuffer added in v0.26.0

func (m *Flow) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Flow) MatchBool added in v0.26.0

func (f *Flow) MatchBool(key string, predicate getter.BoolPredicate) bool

MatchBool implements the Getter interface

func (*Flow) MatchInt64 added in v0.26.0

func (f *Flow) MatchInt64(key string, predicate getter.Int64Predicate) bool

MatchInt64 implements the Getter interface

func (*Flow) MatchString added in v0.26.0

func (f *Flow) MatchString(key string, predicate getter.StringPredicate) bool

MatchString implements the Getter interface

func (*Flow) ProtoMessage

func (*Flow) ProtoMessage()

func (*Flow) ProtoSize added in v0.26.0

func (m *Flow) ProtoSize() (n int)

func (*Flow) Reset

func (m *Flow) Reset()

func (*Flow) SetUUIDs added in v0.26.0

func (f *Flow) SetUUIDs(key uint64, opts Opts) (uint64, uint64)

SetUUIDs updates the UUIDs using the flow layers and returns l2/l3 keys

func (*Flow) String

func (m *Flow) String() string

func (*Flow) Unmarshal added in v0.26.0

func (m *Flow) Unmarshal(dAtA []byte) error

func (*Flow) UnmarshalEasyJSON added in v0.26.0

func (v *Flow) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*Flow) UnmarshalJSON added in v0.26.0

func (v *Flow) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

func (*Flow) Update added in v0.7.0

func (f *Flow) Update(packet *Packet, opts *Opts)

Update a flow metrics and latency

func (*Flow) XXX_DiscardUnknown added in v0.26.0

func (m *Flow) XXX_DiscardUnknown()

func (*Flow) XXX_Marshal added in v0.26.0

func (m *Flow) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Flow) XXX_Merge added in v0.26.0

func (m *Flow) XXX_Merge(src proto.Message)

func (*Flow) XXX_Size added in v0.26.0

func (m *Flow) XXX_Size() int

func (*Flow) XXX_Unmarshal added in v0.26.0

func (m *Flow) XXX_Unmarshal(b []byte) error

type FlowFinishType added in v0.26.0

type FlowFinishType int32
const (
	FlowFinishType_NOT_FINISHED FlowFinishType = 0
	FlowFinishType_TIMEOUT      FlowFinishType = 1
	FlowFinishType_TCP_FIN      FlowFinishType = 2
	FlowFinishType_TCP_RST      FlowFinishType = 3
)

func (FlowFinishType) EnumDescriptor added in v0.26.0

func (FlowFinishType) EnumDescriptor() ([]byte, []int)

func (FlowFinishType) String added in v0.26.0

func (x FlowFinishType) String() string

type FlowLayer added in v0.7.0

type FlowLayer struct {
	Protocol FlowProtocol `protobuf:"varint,1,opt,name=Protocol,proto3,enum=flow.FlowProtocol" json:"Protocol"`
	A        string       `protobuf:"bytes,3,opt,name=A,proto3" json:"A,omitempty"`
	B        string       `protobuf:"bytes,4,opt,name=B,proto3" json:"B,omitempty"`
	ID       int64        `protobuf:"varint,5,opt,name=ID,proto3" json:"ID"`
}

gendecoder

func (*FlowLayer) Descriptor added in v0.7.0

func (*FlowLayer) Descriptor() ([]byte, []int)

func (*FlowLayer) GetA added in v0.26.0

func (m *FlowLayer) GetA() string

func (*FlowLayer) GetB added in v0.26.0

func (m *FlowLayer) GetB() string

func (*FlowLayer) GetField added in v0.7.0

func (obj *FlowLayer) GetField(key string) (interface{}, error)

func (*FlowLayer) GetFieldBool added in v0.26.0

func (obj *FlowLayer) GetFieldBool(key string) (bool, error)

func (*FlowLayer) GetFieldInt64 added in v0.26.0

func (obj *FlowLayer) GetFieldInt64(key string) (int64, error)

func (*FlowLayer) GetFieldKeys added in v0.26.0

func (obj *FlowLayer) GetFieldKeys() []string

func (*FlowLayer) GetFieldString added in v0.26.0

func (obj *FlowLayer) GetFieldString(key string) (string, error)

func (*FlowLayer) GetID added in v0.26.0

func (m *FlowLayer) GetID() int64

func (*FlowLayer) GetProtocol added in v0.26.0

func (m *FlowLayer) GetProtocol() FlowProtocol

func (*FlowLayer) Hash added in v0.7.0

func (fl *FlowLayer) Hash(hasher hash.Hash, swap bool)

Hash calculates a unique symetric flow layer hash

func (*FlowLayer) Marshal added in v0.26.0

func (m *FlowLayer) Marshal() (dAtA []byte, err error)

func (FlowLayer) MarshalEasyJSON added in v0.26.0

func (v FlowLayer) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (FlowLayer) MarshalJSON added in v0.7.0

func (v FlowLayer) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*FlowLayer) MarshalTo added in v0.26.0

func (m *FlowLayer) MarshalTo(dAtA []byte) (int, error)

func (*FlowLayer) MarshalToSizedBuffer added in v0.26.0

func (m *FlowLayer) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*FlowLayer) MatchBool added in v0.26.0

func (obj *FlowLayer) MatchBool(key string, predicate getter.BoolPredicate) bool

func (*FlowLayer) MatchInt64 added in v0.26.0

func (obj *FlowLayer) MatchInt64(key string, predicate getter.Int64Predicate) bool

func (*FlowLayer) MatchString added in v0.26.0

func (obj *FlowLayer) MatchString(key string, predicate getter.StringPredicate) bool

func (*FlowLayer) ProtoMessage added in v0.7.0

func (*FlowLayer) ProtoMessage()

func (*FlowLayer) ProtoSize added in v0.26.0

func (m *FlowLayer) ProtoSize() (n int)

func (*FlowLayer) Reset added in v0.7.0

func (m *FlowLayer) Reset()

func (*FlowLayer) String added in v0.7.0

func (m *FlowLayer) String() string

func (*FlowLayer) Unmarshal added in v0.26.0

func (m *FlowLayer) Unmarshal(dAtA []byte) error

func (*FlowLayer) UnmarshalEasyJSON added in v0.26.0

func (v *FlowLayer) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*FlowLayer) UnmarshalJSON added in v0.7.0

func (v *FlowLayer) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

func (*FlowLayer) XXX_DiscardUnknown added in v0.26.0

func (m *FlowLayer) XXX_DiscardUnknown()

func (*FlowLayer) XXX_Marshal added in v0.26.0

func (m *FlowLayer) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*FlowLayer) XXX_Merge added in v0.26.0

func (m *FlowLayer) XXX_Merge(src proto.Message)

func (*FlowLayer) XXX_Size added in v0.26.0

func (m *FlowLayer) XXX_Size() int

func (*FlowLayer) XXX_Unmarshal added in v0.26.0

func (m *FlowLayer) XXX_Unmarshal(b []byte) error

type FlowMetric added in v0.7.0

type FlowMetric struct {
	ABPackets int64 `protobuf:"varint,2,opt,name=ABPackets,proto3" json:"ABPackets"`
	ABBytes   int64 `protobuf:"varint,3,opt,name=ABBytes,proto3" json:"ABBytes"`
	BAPackets int64 `protobuf:"varint,4,opt,name=BAPackets,proto3" json:"BAPackets"`
	BABytes   int64 `protobuf:"varint,5,opt,name=BABytes,proto3" json:"BABytes"`
	Start     int64 `protobuf:"varint,6,opt,name=Start,proto3" json:"Start"`
	Last      int64 `protobuf:"varint,7,opt,name=Last,proto3" json:"Last"`
	RTT       int64 `protobuf:"varint,8,opt,name=RTT,proto3" json:"RTT,omitempty"`
}

gendecoder

func (*FlowMetric) Add added in v0.26.0

func (fm *FlowMetric) Add(m common.Metric) common.Metric

Add sum flow metrics

func (*FlowMetric) Descriptor added in v0.7.0

func (*FlowMetric) Descriptor() ([]byte, []int)

func (*FlowMetric) GetABBytes added in v0.26.0

func (m *FlowMetric) GetABBytes() int64

func (*FlowMetric) GetABPackets added in v0.26.0

func (m *FlowMetric) GetABPackets() int64

func (*FlowMetric) GetBABytes added in v0.26.0

func (m *FlowMetric) GetBABytes() int64

func (*FlowMetric) GetBAPackets added in v0.26.0

func (m *FlowMetric) GetBAPackets() int64

func (*FlowMetric) GetField added in v0.7.0

func (obj *FlowMetric) GetField(key string) (interface{}, error)

func (*FlowMetric) GetFieldBool added in v0.26.0

func (obj *FlowMetric) GetFieldBool(key string) (bool, error)

func (*FlowMetric) GetFieldInt64 added in v0.26.0

func (obj *FlowMetric) GetFieldInt64(key string) (int64, error)

func (*FlowMetric) GetFieldKeys added in v0.26.0

func (obj *FlowMetric) GetFieldKeys() []string

func (*FlowMetric) GetFieldString added in v0.26.0

func (obj *FlowMetric) GetFieldString(key string) (string, error)

func (*FlowMetric) GetLast added in v0.26.0

func (m *FlowMetric) GetLast() int64

func (*FlowMetric) GetRTT added in v0.26.0

func (m *FlowMetric) GetRTT() int64

func (*FlowMetric) GetStart added in v0.26.0

func (m *FlowMetric) GetStart() int64

func (*FlowMetric) IsZero added in v0.26.0

func (fm *FlowMetric) IsZero() bool

IsZero returns true if all the values are equal to zero

func (*FlowMetric) Marshal added in v0.26.0

func (m *FlowMetric) Marshal() (dAtA []byte, err error)

func (FlowMetric) MarshalEasyJSON added in v0.26.0

func (v FlowMetric) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (FlowMetric) MarshalJSON added in v0.26.0

func (v FlowMetric) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*FlowMetric) MarshalTo added in v0.26.0

func (m *FlowMetric) MarshalTo(dAtA []byte) (int, error)

func (*FlowMetric) MarshalToSizedBuffer added in v0.26.0

func (m *FlowMetric) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*FlowMetric) MatchBool added in v0.26.0

func (obj *FlowMetric) MatchBool(key string, predicate getter.BoolPredicate) bool

func (*FlowMetric) MatchInt64 added in v0.26.0

func (obj *FlowMetric) MatchInt64(key string, predicate getter.Int64Predicate) bool

func (*FlowMetric) MatchString added in v0.26.0

func (obj *FlowMetric) MatchString(key string, predicate getter.StringPredicate) bool

func (*FlowMetric) ProtoMessage added in v0.7.0

func (*FlowMetric) ProtoMessage()

func (*FlowMetric) ProtoSize added in v0.26.0

func (m *FlowMetric) ProtoSize() (n int)

func (*FlowMetric) Reset added in v0.7.0

func (m *FlowMetric) Reset()

func (*FlowMetric) SetLast added in v0.26.0

func (fm *FlowMetric) SetLast(last int64)

SetLast set Last field

func (*FlowMetric) SetStart added in v0.26.0

func (fm *FlowMetric) SetStart(start int64)

SetStart set Start field

func (*FlowMetric) Split added in v0.26.0

func (fm *FlowMetric) Split(cut int64) (common.Metric, common.Metric)

Split a metric into two parts

func (*FlowMetric) String added in v0.7.0

func (m *FlowMetric) String() string

func (*FlowMetric) Sub added in v0.26.0

func (fm *FlowMetric) Sub(m common.Metric) common.Metric

Sub subtracts flow metrics

func (*FlowMetric) Unmarshal added in v0.26.0

func (m *FlowMetric) Unmarshal(dAtA []byte) error

func (*FlowMetric) UnmarshalEasyJSON added in v0.26.0

func (v *FlowMetric) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*FlowMetric) UnmarshalJSON added in v0.26.0

func (v *FlowMetric) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

func (*FlowMetric) XXX_DiscardUnknown added in v0.26.0

func (m *FlowMetric) XXX_DiscardUnknown()

func (*FlowMetric) XXX_Marshal added in v0.26.0

func (m *FlowMetric) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*FlowMetric) XXX_Merge added in v0.26.0

func (m *FlowMetric) XXX_Merge(src proto.Message)

func (*FlowMetric) XXX_Size added in v0.26.0

func (m *FlowMetric) XXX_Size() int

func (*FlowMetric) XXX_Unmarshal added in v0.26.0

func (m *FlowMetric) XXX_Unmarshal(b []byte) error

type FlowProtocol added in v0.7.0

type FlowProtocol int32
const (
	FlowProtocol_ETHERNET FlowProtocol = 0
	FlowProtocol_IPV4     FlowProtocol = 1
	FlowProtocol_TCP      FlowProtocol = 2
	FlowProtocol_UDP      FlowProtocol = 3
	FlowProtocol_SCTP     FlowProtocol = 4
	FlowProtocol_IPV6     FlowProtocol = 5
	FlowProtocol_ICMPV4   FlowProtocol = 6
	FlowProtocol_ICMPV6   FlowProtocol = 7
)

func (FlowProtocol) EnumDescriptor added in v0.7.0

func (FlowProtocol) EnumDescriptor() ([]byte, []int)

func (FlowProtocol) MarshalJSON added in v0.26.0

func (p FlowProtocol) MarshalJSON() ([]byte, error)

MarshalJSON serialize a FlowProtocol in JSON

func (FlowProtocol) String added in v0.7.0

func (x FlowProtocol) String() string

func (*FlowProtocol) UnmarshalJSON added in v0.26.0

func (p *FlowProtocol) UnmarshalJSON(b []byte) error

UnmarshalJSON serialize a FlowProtocol in JSON

func (FlowProtocol) Value added in v0.7.0

func (p FlowProtocol) Value() int32

Value returns int32 value of a FlowProtocol

type FlowSearchReply added in v0.4.0

type FlowSearchReply struct {
	FlowSet *FlowSet `protobuf:"bytes,1,opt,name=FlowSet,proto3" json:"FlowSet,omitempty"`
}

func (*FlowSearchReply) Descriptor added in v0.5.0

func (*FlowSearchReply) Descriptor() ([]byte, []int)

func (*FlowSearchReply) GetFlowSet added in v0.5.0

func (m *FlowSearchReply) GetFlowSet() *FlowSet

func (*FlowSearchReply) Marshal added in v0.26.0

func (m *FlowSearchReply) Marshal() (dAtA []byte, err error)

func (FlowSearchReply) MarshalEasyJSON added in v0.26.0

func (v FlowSearchReply) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (FlowSearchReply) MarshalJSON added in v0.26.0

func (v FlowSearchReply) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*FlowSearchReply) MarshalTo added in v0.26.0

func (m *FlowSearchReply) MarshalTo(dAtA []byte) (int, error)

func (*FlowSearchReply) MarshalToSizedBuffer added in v0.26.0

func (m *FlowSearchReply) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*FlowSearchReply) ProtoMessage added in v0.5.0

func (*FlowSearchReply) ProtoMessage()

func (*FlowSearchReply) ProtoSize added in v0.26.0

func (m *FlowSearchReply) ProtoSize() (n int)

func (*FlowSearchReply) Reset added in v0.5.0

func (m *FlowSearchReply) Reset()

func (*FlowSearchReply) String added in v0.5.0

func (m *FlowSearchReply) String() string

func (*FlowSearchReply) Unmarshal added in v0.26.0

func (m *FlowSearchReply) Unmarshal(dAtA []byte) error

func (*FlowSearchReply) UnmarshalEasyJSON added in v0.26.0

func (v *FlowSearchReply) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*FlowSearchReply) UnmarshalJSON added in v0.26.0

func (v *FlowSearchReply) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

func (*FlowSearchReply) XXX_DiscardUnknown added in v0.26.0

func (m *FlowSearchReply) XXX_DiscardUnknown()

func (*FlowSearchReply) XXX_Marshal added in v0.26.0

func (m *FlowSearchReply) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*FlowSearchReply) XXX_Merge added in v0.26.0

func (m *FlowSearchReply) XXX_Merge(src proto.Message)

func (*FlowSearchReply) XXX_Size added in v0.26.0

func (m *FlowSearchReply) XXX_Size() int

func (*FlowSearchReply) XXX_Unmarshal added in v0.26.0

func (m *FlowSearchReply) XXX_Unmarshal(b []byte) error

type FlowSet added in v0.4.0

type FlowSet struct {
	Flows []*Flow `protobuf:"bytes,1,rep,name=Flows,proto3" json:"Flows,omitempty"`
	Start int64   `protobuf:"varint,2,opt,name=Start,proto3" json:"Start"`
	End   int64   `protobuf:"varint,3,opt,name=End,proto3" json:"End"`
}

func NewFlowSet added in v0.4.0

func NewFlowSet() *FlowSet

NewFlowSet creates a new empty FlowSet

func (*FlowSet) Dedup added in v0.7.0

func (fs *FlowSet) Dedup(field string) error

Dedup deduplicate a flows in a FlowSet

func (*FlowSet) Descriptor added in v0.5.0

func (*FlowSet) Descriptor() ([]byte, []int)

func (*FlowSet) Filter added in v0.5.0

func (fs *FlowSet) Filter(filter *filters.Filter) *FlowSet

Filter flows in a FlowSet

func (*FlowSet) GetEnd added in v0.26.0

func (m *FlowSet) GetEnd() int64

func (*FlowSet) GetFlows added in v0.5.0

func (m *FlowSet) GetFlows() []*Flow

func (*FlowSet) GetStart added in v0.26.0

func (m *FlowSet) GetStart() int64

func (*FlowSet) Marshal added in v0.26.0

func (m *FlowSet) Marshal() (dAtA []byte, err error)

func (FlowSet) MarshalEasyJSON added in v0.26.0

func (v FlowSet) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (FlowSet) MarshalJSON added in v0.26.0

func (v FlowSet) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*FlowSet) MarshalTo added in v0.26.0

func (m *FlowSet) MarshalTo(dAtA []byte) (int, error)

func (*FlowSet) MarshalToSizedBuffer added in v0.26.0

func (m *FlowSet) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*FlowSet) Merge added in v0.4.0

func (fs *FlowSet) Merge(ofs *FlowSet, context MergeContext) error

Merge merges two FlowSet. If Sorted both of the FlowSet have to be sorted first. If Dedup both of the FlowSet have to be dedup first too.

func (*FlowSet) ProtoMessage added in v0.5.0

func (*FlowSet) ProtoMessage()

func (*FlowSet) ProtoSize added in v0.26.0

func (m *FlowSet) ProtoSize() (n int)

func (*FlowSet) Reset added in v0.5.0

func (m *FlowSet) Reset()

func (*FlowSet) Slice added in v0.7.0

func (fs *FlowSet) Slice(from, to int)

Slice returns a slice of a FlowSet

func (*FlowSet) Sort added in v0.7.0

func (fs *FlowSet) Sort(order filters.SortOrder, orderBy string)

Sort flows in a FlowSet

func (*FlowSet) String added in v0.5.0

func (m *FlowSet) String() string

func (*FlowSet) Unmarshal added in v0.26.0

func (m *FlowSet) Unmarshal(dAtA []byte) error

func (*FlowSet) UnmarshalEasyJSON added in v0.26.0

func (v *FlowSet) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*FlowSet) UnmarshalJSON added in v0.26.0

func (v *FlowSet) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

func (*FlowSet) XXX_DiscardUnknown added in v0.26.0

func (m *FlowSet) XXX_DiscardUnknown()

func (*FlowSet) XXX_Marshal added in v0.26.0

func (m *FlowSet) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*FlowSet) XXX_Merge added in v0.26.0

func (m *FlowSet) XXX_Merge(src proto.Message)

func (*FlowSet) XXX_Size added in v0.26.0

func (m *FlowSet) XXX_Size() int

func (*FlowSet) XXX_Unmarshal added in v0.26.0

func (m *FlowSet) XXX_Unmarshal(b []byte) error

type ICMPLayer added in v0.26.0

type ICMPLayer struct {
	Type ICMPType `protobuf:"varint,1,opt,name=Type,proto3,enum=flow.ICMPType" json:"Type"`
	Code uint32   `protobuf:"varint,2,opt,name=Code,proto3" json:"Code,omitempty"`
	ID   uint32   `protobuf:"varint,3,opt,name=ID,proto3" json:"ID,omitempty"`
}

gendecoder

func (*ICMPLayer) Descriptor added in v0.26.0

func (*ICMPLayer) Descriptor() ([]byte, []int)

func (*ICMPLayer) GetCode added in v0.26.0

func (m *ICMPLayer) GetCode() uint32

func (*ICMPLayer) GetField added in v0.26.0

func (obj *ICMPLayer) GetField(key string) (interface{}, error)

func (*ICMPLayer) GetFieldBool added in v0.26.0

func (obj *ICMPLayer) GetFieldBool(key string) (bool, error)

func (*ICMPLayer) GetFieldInt64 added in v0.26.0

func (obj *ICMPLayer) GetFieldInt64(key string) (int64, error)

func (*ICMPLayer) GetFieldKeys added in v0.26.0

func (obj *ICMPLayer) GetFieldKeys() []string

func (*ICMPLayer) GetFieldString added in v0.26.0

func (obj *ICMPLayer) GetFieldString(key string) (string, error)

func (*ICMPLayer) GetID added in v0.26.0

func (m *ICMPLayer) GetID() uint32

func (*ICMPLayer) GetType added in v0.26.0

func (m *ICMPLayer) GetType() ICMPType

func (*ICMPLayer) Hash added in v0.26.0

func (fl *ICMPLayer) Hash(hasher hash.Hash)

Hash computes the hash of a ICMP layer

func (*ICMPLayer) Marshal added in v0.26.0

func (m *ICMPLayer) Marshal() (dAtA []byte, err error)

func (ICMPLayer) MarshalEasyJSON added in v0.26.0

func (v ICMPLayer) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (ICMPLayer) MarshalJSON added in v0.26.0

func (v ICMPLayer) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*ICMPLayer) MarshalTo added in v0.26.0

func (m *ICMPLayer) MarshalTo(dAtA []byte) (int, error)

func (*ICMPLayer) MarshalToSizedBuffer added in v0.26.0

func (m *ICMPLayer) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*ICMPLayer) MatchBool added in v0.26.0

func (obj *ICMPLayer) MatchBool(key string, predicate getter.BoolPredicate) bool

func (*ICMPLayer) MatchInt64 added in v0.26.0

func (obj *ICMPLayer) MatchInt64(key string, predicate getter.Int64Predicate) bool

func (*ICMPLayer) MatchString added in v0.26.0

func (obj *ICMPLayer) MatchString(key string, predicate getter.StringPredicate) bool

func (*ICMPLayer) ProtoMessage added in v0.26.0

func (*ICMPLayer) ProtoMessage()

func (*ICMPLayer) ProtoSize added in v0.26.0

func (m *ICMPLayer) ProtoSize() (n int)

func (*ICMPLayer) Reset added in v0.26.0

func (m *ICMPLayer) Reset()

func (*ICMPLayer) String added in v0.26.0

func (m *ICMPLayer) String() string

func (*ICMPLayer) Unmarshal added in v0.26.0

func (m *ICMPLayer) Unmarshal(dAtA []byte) error

func (*ICMPLayer) UnmarshalEasyJSON added in v0.26.0

func (v *ICMPLayer) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*ICMPLayer) UnmarshalJSON added in v0.26.0

func (v *ICMPLayer) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

func (*ICMPLayer) XXX_DiscardUnknown added in v0.26.0

func (m *ICMPLayer) XXX_DiscardUnknown()

func (*ICMPLayer) XXX_Marshal added in v0.26.0

func (m *ICMPLayer) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*ICMPLayer) XXX_Merge added in v0.26.0

func (m *ICMPLayer) XXX_Merge(src proto.Message)

func (*ICMPLayer) XXX_Size added in v0.26.0

func (m *ICMPLayer) XXX_Size() int

func (*ICMPLayer) XXX_Unmarshal added in v0.26.0

func (m *ICMPLayer) XXX_Unmarshal(b []byte) error

type ICMPType added in v0.26.0

type ICMPType int32
const (
	ICMPType_UNKNOWN                 ICMPType = 0
	ICMPType_DESTINATION_UNREACHABLE ICMPType = 1
	ICMPType_ECHO                    ICMPType = 2
	ICMPType_NEIGHBOR                ICMPType = 3
	ICMPType_ADDRESS_MASK            ICMPType = 4
	ICMPType_INFO                    ICMPType = 5
	ICMPType_PARAMETER_PROBLEM       ICMPType = 6
	ICMPType_REDIRECT                ICMPType = 7
	ICMPType_ROUTER                  ICMPType = 8
	ICMPType_SOURCE_QUENCH           ICMPType = 9
	ICMPType_TIME_EXCEEDED           ICMPType = 10
	ICMPType_TIMESTAMP               ICMPType = 11
	ICMPType_PACKET_TOO_BIG          ICMPType = 12
)

func ICMPv4TypeToFlowICMPType added in v0.26.0

func ICMPv4TypeToFlowICMPType(kind uint8) ICMPType

ICMPv4TypeToFlowICMPType converts an ICMP type to a Flow ICMPType

func ICMPv6TypeToFlowICMPType added in v0.26.0

func ICMPv6TypeToFlowICMPType(kind uint8) ICMPType

ICMPv6TypeToFlowICMPType converts an ICMP type to a Flow ICMPType

func (ICMPType) EnumDescriptor added in v0.26.0

func (ICMPType) EnumDescriptor() ([]byte, []int)

func (ICMPType) MarshalJSON added in v0.26.0

func (i ICMPType) MarshalJSON() ([]byte, error)

MarshalJSON serialize a FlowProtocol in JSON

func (ICMPType) String added in v0.26.0

func (x ICMPType) String() string

func (*ICMPType) UnmarshalJSON added in v0.26.0

func (i *ICMPType) UnmarshalJSON(b []byte) error

UnmarshalJSON serialize a ICMPType in JSON

type ICMPv4 added in v0.12.0

type ICMPv4 struct {
	layers.ICMPv4
	Type ICMPType
}

ICMPv4 aims to store ICMP metadata and aims to be used for the flow hash key

func (*ICMPv4) Payload added in v0.12.0

func (i *ICMPv4) Payload() []byte

Payload returns the ICMP payload

type ICMPv6 added in v0.12.0

type ICMPv6 struct {
	layers.ICMPv6
	Type ICMPType
	ID   uint16
}

ICMPv6 aims to store ICMP metadata and aims to be used for the flow hash key

func (*ICMPv6) Payload added in v0.12.0

func (i *ICMPv6) Payload() []byte

Payload returns the ICMP payload

type IPDefragger added in v0.18.0

type IPDefragger struct {
	insanelock.RWMutex
	// contains filtered or unexported fields
}

IPDefragger defines an IPv4 defragmenter

func NewIPDefragger added in v0.18.0

func NewIPDefragger() *IPDefragger

NewIPDefragger returns a new IPv4 defragger

func (*IPDefragger) Defrag added in v0.18.0

func (d *IPDefragger) Defrag(packet gopacket.Packet) (*IPMetric, bool)

Defrag tries to defragment

func (*IPDefragger) FlushAll added in v0.18.0

func (d *IPDefragger) FlushAll()

FlushAll frees all the fragment resources

func (*IPDefragger) FlushOlderThan added in v0.18.0

func (d *IPDefragger) FlushOlderThan(t time.Time)

FlushOlderThan frees resources for fragment older than the give time

type IPDefraggerMetric added in v0.18.0

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

IPDefraggerMetric defines the structure keeping metrics of fragments

type IPMetric added in v0.26.0

type IPMetric struct {
	Fragments      int64 `protobuf:"varint,1,opt,name=Fragments,proto3" json:"Fragments"`
	FragmentErrors int64 `protobuf:"varint,2,opt,name=FragmentErrors,proto3" json:"FragmentErrors"`
}

gendecoder

func ProcessGoPacket added in v0.26.0

func ProcessGoPacket(packet gopacket.Packet, bpf *BPF, defragger *IPDefragger) (gopacket.Packet, *IPMetric)

ProcessGoPacket takes a gopacket as input and filter, defrag it.

func (*IPMetric) Descriptor added in v0.26.0

func (*IPMetric) Descriptor() ([]byte, []int)

func (*IPMetric) GetField added in v0.26.0

func (obj *IPMetric) GetField(key string) (interface{}, error)

func (*IPMetric) GetFieldBool added in v0.26.0

func (obj *IPMetric) GetFieldBool(key string) (bool, error)

func (*IPMetric) GetFieldInt64 added in v0.26.0

func (obj *IPMetric) GetFieldInt64(key string) (int64, error)

func (*IPMetric) GetFieldKeys added in v0.26.0

func (obj *IPMetric) GetFieldKeys() []string

func (*IPMetric) GetFieldString added in v0.26.0

func (obj *IPMetric) GetFieldString(key string) (string, error)

func (*IPMetric) GetFragmentErrors added in v0.26.0

func (m *IPMetric) GetFragmentErrors() int64

func (*IPMetric) GetFragments added in v0.26.0

func (m *IPMetric) GetFragments() int64

func (*IPMetric) Marshal added in v0.26.0

func (m *IPMetric) Marshal() (dAtA []byte, err error)

func (IPMetric) MarshalEasyJSON added in v0.26.0

func (v IPMetric) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (IPMetric) MarshalJSON added in v0.26.0

func (v IPMetric) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*IPMetric) MarshalTo added in v0.26.0

func (m *IPMetric) MarshalTo(dAtA []byte) (int, error)

func (*IPMetric) MarshalToSizedBuffer added in v0.26.0

func (m *IPMetric) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*IPMetric) MatchBool added in v0.26.0

func (obj *IPMetric) MatchBool(key string, predicate getter.BoolPredicate) bool

func (*IPMetric) MatchInt64 added in v0.26.0

func (obj *IPMetric) MatchInt64(key string, predicate getter.Int64Predicate) bool

func (*IPMetric) MatchString added in v0.26.0

func (obj *IPMetric) MatchString(key string, predicate getter.StringPredicate) bool

func (*IPMetric) ProtoMessage added in v0.26.0

func (*IPMetric) ProtoMessage()

func (*IPMetric) ProtoSize added in v0.26.0

func (m *IPMetric) ProtoSize() (n int)

func (*IPMetric) Reset added in v0.26.0

func (m *IPMetric) Reset()

func (*IPMetric) String added in v0.26.0

func (m *IPMetric) String() string

func (*IPMetric) Unmarshal added in v0.26.0

func (m *IPMetric) Unmarshal(dAtA []byte) error

func (*IPMetric) UnmarshalEasyJSON added in v0.26.0

func (v *IPMetric) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*IPMetric) UnmarshalJSON added in v0.26.0

func (v *IPMetric) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

func (*IPMetric) XXX_DiscardUnknown added in v0.26.0

func (m *IPMetric) XXX_DiscardUnknown()

func (*IPMetric) XXX_Marshal added in v0.26.0

func (m *IPMetric) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*IPMetric) XXX_Merge added in v0.26.0

func (m *IPMetric) XXX_Merge(src proto.Message)

func (*IPMetric) XXX_Size added in v0.26.0

func (m *IPMetric) XXX_Size() int

func (*IPMetric) XXX_Unmarshal added in v0.26.0

func (m *IPMetric) XXX_Unmarshal(b []byte) error

type LayerKeyMode added in v0.18.0

type LayerKeyMode int

LayerKeyMode defines what are the layers used for the flow key calculation

const (
	DefaultLayerKeyMode              = L2KeyMode // default mode
	L2KeyMode           LayerKeyMode = 0         // uses Layer2 and Layer3 for hash computation, default mode
	L3PreferredKeyMode  LayerKeyMode = 1         // uses Layer3 only and layer2 if no Layer3
)

Flow key calculation modes

func LayerKeyModeByName added in v0.18.0

func LayerKeyModeByName(name string) (LayerKeyMode, error)

LayerKeyModeByName converts a string to a layer key mode

func (LayerKeyMode) String added in v0.18.0

func (l LayerKeyMode) String() string

type MergeContext added in v0.7.0

type MergeContext struct {
	Sort      bool
	SortBy    string
	SortOrder filters.SortOrder
	Dedup     bool
	DedupBy   string
}

MergeContext describes a mechanism to merge flow sets

type Message added in v0.26.0

type Message struct {
	Flows []*Flow `protobuf:"bytes,1,rep,name=Flows,proto3" json:"Flows,omitempty"`
	Stats *Stats  `protobuf:"bytes,2,opt,name=Stats,proto3" json:"Stats,omitempty"`
}

func (*Message) Descriptor added in v0.26.0

func (*Message) Descriptor() ([]byte, []int)

func (*Message) GetFlows added in v0.26.0

func (m *Message) GetFlows() []*Flow

func (*Message) GetStats added in v0.26.0

func (m *Message) GetStats() *Stats

func (*Message) Marshal added in v0.26.0

func (m *Message) Marshal() (dAtA []byte, err error)

func (Message) MarshalEasyJSON added in v0.26.0

func (v Message) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (Message) MarshalJSON added in v0.26.0

func (v Message) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*Message) MarshalTo added in v0.26.0

func (m *Message) MarshalTo(dAtA []byte) (int, error)

func (*Message) MarshalToSizedBuffer added in v0.26.0

func (m *Message) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Message) ProtoMessage added in v0.26.0

func (*Message) ProtoMessage()

func (*Message) ProtoSize added in v0.26.0

func (m *Message) ProtoSize() (n int)

func (*Message) Reset added in v0.26.0

func (m *Message) Reset()

func (*Message) String added in v0.26.0

func (m *Message) String() string

func (*Message) Unmarshal added in v0.26.0

func (m *Message) Unmarshal(dAtA []byte) error

func (*Message) UnmarshalEasyJSON added in v0.26.0

func (v *Message) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*Message) UnmarshalJSON added in v0.26.0

func (v *Message) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

func (*Message) XXX_DiscardUnknown added in v0.26.0

func (m *Message) XXX_DiscardUnknown()

func (*Message) XXX_Marshal added in v0.26.0

func (m *Message) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Message) XXX_Merge added in v0.26.0

func (m *Message) XXX_Merge(src proto.Message)

func (*Message) XXX_Size added in v0.26.0

func (m *Message) XXX_Size() int

func (*Message) XXX_Unmarshal added in v0.26.0

func (m *Message) XXX_Unmarshal(b []byte) error

type Operation added in v0.22.0

type Operation struct {
	Key  uint64
	Flow *Flow
	Type OperationType
}

Operation describes a flow operation

type OperationType added in v0.22.0

type OperationType int

OperationType operation type of a Flow in a flow table

const (
	// ReplaceOperation replace the flow
	ReplaceOperation OperationType = iota
	// UpdateOperation update the flow
	UpdateOperation
)

type Opts added in v0.21.0

type Opts struct {
	TCPMetric    bool
	IPDefrag     bool
	LayerKeyMode LayerKeyMode
	AppPortMap   *ApplicationPortMap
	ExtraLayers  ExtraLayers
}

Opts describes options that can be used to process flows

type Packet added in v0.12.0

type Packet struct {
	GoPacket gopacket.Packet // orignal gopacket

	Layers   []gopacket.Layer // layer of the sub packet
	Data     []byte           // byte of the sub packet
	Length   int64            // length of the original packet meaning layers + payload
	IPMetric *IPMetric
	// contains filtered or unexported fields
}

Packet describes one packet

func (*Packet) ApplicationFlow added in v0.18.0

func (p *Packet) ApplicationFlow() (gopacket.Flow, error)

ApplicationFlow returns first application flow

func (*Packet) Keys added in v0.24.0

func (p *Packet) Keys(parentUUID string, uuids *UUIDs, opts *Opts) (uint64, uint64, uint64)

Keys returns keys of the packet

func (*Packet) Layer added in v0.18.0

func (p *Packet) Layer(t gopacket.LayerType) gopacket.Layer

Layer returns the given layer type

func (*Packet) LinkLayer added in v0.18.0

func (p *Packet) LinkLayer() gopacket.LinkLayer

LinkLayer returns first link layer

func (*Packet) NetworkLayer added in v0.18.0

func (p *Packet) NetworkLayer() gopacket.NetworkLayer

NetworkLayer return first network layer

func (*Packet) TransportFlow added in v0.18.0

func (p *Packet) TransportFlow(swap bool) (gopacket.Flow, error)

TransportFlow returns first transport flow

func (*Packet) TransportLayer added in v0.18.0

func (p *Packet) TransportLayer() gopacket.TransportLayer

TransportLayer returns first transport layer

type PacketSequence added in v0.15.0

type PacketSequence struct {
	Packets []*Packet
}

PacketSequence represents a suite of parent/child Packet

func PacketSeqFromGoPacket added in v0.15.0

func PacketSeqFromGoPacket(packet gopacket.Packet, outerLength int64, bpf *BPF, defragger *IPDefragger) *PacketSequence

PacketSeqFromGoPacket split original packet into multiple packets in case of encapsulation like GRE, VXLAN, etc.

func PacketSeqFromSFlowSample added in v0.15.0

func PacketSeqFromSFlowSample(sample *layers.SFlowFlowSample, bpf *BPF, defragger *IPDefragger) []*PacketSequence

PacketSeqFromSFlowSample returns an array of Packets as a sample contains multiple records which generate a Packets each.

type PcapTableFeeder added in v0.12.0

type PcapTableFeeder struct {
	sync.WaitGroup
	// contains filtered or unexported fields
}

PcapTableFeeder replaies a pcap file

func NewPcapTableFeeder added in v0.12.0

func NewPcapTableFeeder(r io.ReadCloser, packetsChan chan *PacketSequence, replay bool, bpfFilter string) (*PcapTableFeeder, error)

NewPcapTableFeeder reads a pcap from a file reader and inject it in a flow table

func (*PcapTableFeeder) Start added in v0.12.0

func (p *PcapTableFeeder) Start()

Start a pcap injector

func (*PcapTableFeeder) Stop added in v0.12.0

func (p *PcapTableFeeder) Stop()

Stop a pcap injector

type PcapWriter added in v0.10.0

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

PcapWriter provides helpers on top of gopacket pcap to write pcap files.

func NewPcapWriter added in v0.10.0

func NewPcapWriter(w io.Writer) *PcapWriter

NewPcapWriter returns a new PcapWriter based on the given io.Writer. Due to the current limitation of the gopacket pcap implementation only RawPacket with Ethernet link type are supported.

func (*PcapWriter) WriteRawPacket added in v0.12.0

func (p *PcapWriter) WriteRawPacket(r *RawPacket) error

WriteRawPacket writes a RawPacket

func (*PcapWriter) WriteRawPackets added in v0.12.0

func (p *PcapWriter) WriteRawPackets(fr []*RawPacket) error

WriteRawPackets writes a RawPackets iterating over the RawPackets and using WriteRawPacket for each.

type RawPacket added in v0.26.0

type RawPacket struct {
	Timestamp int64                                      `protobuf:"varint,1,opt,name=Timestamp,proto3" json:"Timestamp"`
	Index     int64                                      `protobuf:"varint,2,opt,name=Index,proto3" json:"Index"`
	Data      []byte                                     `protobuf:"bytes,3,opt,name=Data,proto3" json:"Data,omitempty"`
	LinkType  github_com_google_gopacket_layers.LinkType `protobuf:"varint,4,opt,name=LinkType,proto3,casttype=github.com/google/gopacket/layers.LinkType" json:"LinkType,omitempty"`
}

func (*RawPacket) Descriptor added in v0.26.0

func (*RawPacket) Descriptor() ([]byte, []int)

func (*RawPacket) GetData added in v0.26.0

func (m *RawPacket) GetData() []byte

func (*RawPacket) GetIndex added in v0.26.0

func (m *RawPacket) GetIndex() int64

func (*RawPacket) GetLinkType added in v0.26.0

func (*RawPacket) GetTimestamp added in v0.26.0

func (m *RawPacket) GetTimestamp() int64

func (*RawPacket) Marshal added in v0.26.0

func (m *RawPacket) Marshal() (dAtA []byte, err error)

func (RawPacket) MarshalEasyJSON added in v0.26.0

func (v RawPacket) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (RawPacket) MarshalJSON added in v0.26.0

func (v RawPacket) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*RawPacket) MarshalTo added in v0.26.0

func (m *RawPacket) MarshalTo(dAtA []byte) (int, error)

func (*RawPacket) MarshalToSizedBuffer added in v0.26.0

func (m *RawPacket) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*RawPacket) ProtoMessage added in v0.26.0

func (*RawPacket) ProtoMessage()

func (*RawPacket) ProtoSize added in v0.26.0

func (m *RawPacket) ProtoSize() (n int)

func (*RawPacket) Reset added in v0.26.0

func (m *RawPacket) Reset()

func (*RawPacket) String added in v0.26.0

func (m *RawPacket) String() string

func (*RawPacket) Unmarshal added in v0.26.0

func (m *RawPacket) Unmarshal(dAtA []byte) error

func (*RawPacket) UnmarshalEasyJSON added in v0.26.0

func (v *RawPacket) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*RawPacket) UnmarshalJSON added in v0.26.0

func (v *RawPacket) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

func (*RawPacket) XXX_DiscardUnknown added in v0.26.0

func (m *RawPacket) XXX_DiscardUnknown()

func (*RawPacket) XXX_Marshal added in v0.26.0

func (m *RawPacket) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*RawPacket) XXX_Merge added in v0.26.0

func (m *RawPacket) XXX_Merge(src proto.Message)

func (*RawPacket) XXX_Size added in v0.26.0

func (m *RawPacket) XXX_Size() int

func (*RawPacket) XXX_Unmarshal added in v0.26.0

func (m *RawPacket) XXX_Unmarshal(b []byte) error

type Sender added in v0.24.0

type Sender interface {
	SendFlows(flows []*Flow)
	SendStats(stats Stats)
}

Sender defines a flows sender interface

type Stats added in v0.26.0

type Stats struct {
	CaptureID         string `protobuf:"bytes,1,opt,name=CaptureID,proto3" json:"CaptureID,omitempty"`
	FlowCount         int64  `protobuf:"varint,2,opt,name=FlowCount,proto3" json:"FlowCount"`
	FlowDropped       int64  `protobuf:"varint,3,opt,name=FlowDropped,proto3" json:"FlowDropped"`
	KernelFlowDropped int64  `protobuf:"varint,4,opt,name=KernelFlowDropped,proto3" json:"KernelFlowDropped"`
	PacketsDropped    int64  `protobuf:"varint,5,opt,name=PacketsDropped,proto3" json:"PacketsDropped"`
	PacketsReceived   int64  `protobuf:"varint,6,opt,name=PacketsReceived,proto3" json:"PacketsReceived"`
}

func (*Stats) Descriptor added in v0.26.0

func (*Stats) Descriptor() ([]byte, []int)

func (*Stats) GetCaptureID added in v0.26.0

func (m *Stats) GetCaptureID() string

func (*Stats) GetFlowCount added in v0.26.0

func (m *Stats) GetFlowCount() int64

func (*Stats) GetFlowDropped added in v0.26.0

func (m *Stats) GetFlowDropped() int64

func (*Stats) GetKernelFlowDropped added in v0.26.0

func (m *Stats) GetKernelFlowDropped() int64

func (*Stats) GetPacketsDropped added in v0.26.0

func (m *Stats) GetPacketsDropped() int64

func (*Stats) GetPacketsReceived added in v0.26.0

func (m *Stats) GetPacketsReceived() int64

func (*Stats) Marshal added in v0.26.0

func (m *Stats) Marshal() (dAtA []byte, err error)

func (Stats) MarshalEasyJSON added in v0.26.0

func (v Stats) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (Stats) MarshalJSON added in v0.26.0

func (v Stats) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*Stats) MarshalTo added in v0.26.0

func (m *Stats) MarshalTo(dAtA []byte) (int, error)

func (*Stats) MarshalToSizedBuffer added in v0.26.0

func (m *Stats) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Stats) ProtoMessage added in v0.26.0

func (*Stats) ProtoMessage()

func (*Stats) ProtoSize added in v0.26.0

func (m *Stats) ProtoSize() (n int)

func (*Stats) Reset added in v0.26.0

func (m *Stats) Reset()

func (*Stats) String added in v0.26.0

func (m *Stats) String() string

func (*Stats) Unmarshal added in v0.26.0

func (m *Stats) Unmarshal(dAtA []byte) error

func (*Stats) UnmarshalEasyJSON added in v0.26.0

func (v *Stats) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*Stats) UnmarshalJSON added in v0.26.0

func (v *Stats) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

func (*Stats) XXX_DiscardUnknown added in v0.26.0

func (m *Stats) XXX_DiscardUnknown()

func (*Stats) XXX_Marshal added in v0.26.0

func (m *Stats) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Stats) XXX_Merge added in v0.26.0

func (m *Stats) XXX_Merge(src proto.Message)

func (*Stats) XXX_Size added in v0.26.0

func (m *Stats) XXX_Size() int

func (*Stats) XXX_Unmarshal added in v0.26.0

func (m *Stats) XXX_Unmarshal(b []byte) error

type TCPAssembler added in v0.18.0

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

TCPAssembler defines a tcp reassembler

func NewTCPAssembler added in v0.18.0

func NewTCPAssembler() *TCPAssembler

NewTCPAssembler returns a new TCPAssembler

func (*TCPAssembler) Assemble added in v0.18.0

func (t *TCPAssembler) Assemble(packet gopacket.Packet)

Assemble add a new packet to be reassembled

func (*TCPAssembler) FlushAll added in v0.18.0

func (t *TCPAssembler) FlushAll()

FlushAll frees all the resources

func (*TCPAssembler) FlushOlderThan added in v0.18.0

func (t *TCPAssembler) FlushOlderThan(tm time.Time)

FlushOlderThan frees the resources older than the given time

func (*TCPAssembler) New added in v0.18.0

func (t *TCPAssembler) New(network, transport gopacket.Flow) tcpassembly.Stream

New creates a new stream. It's called whenever the assembler sees a stream it isn't currently following.

func (*TCPAssembler) RegisterFlow added in v0.18.0

func (t *TCPAssembler) RegisterFlow(flow *Flow, packet gopacket.Packet)

RegisterFlow registers a new flow to be tracked

type TCPAssemblerStream added in v0.18.0

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

TCPAssemblerStream will handle the actual tcp stream decoding

func (*TCPAssemblerStream) Reassembled added in v0.18.0

func (s *TCPAssemblerStream) Reassembled(reassemblies []tcpassembly.Reassembly)

Reassembled is called whenever new packet data is available for reading. Reassembly objects contain stream data in received order.

func (*TCPAssemblerStream) ReassemblyComplete added in v0.18.0

func (s *TCPAssemblerStream) ReassemblyComplete()

ReassemblyComplete is called when the TCP assembler believes a stream has finished.

type TCPMetric added in v0.26.0

type TCPMetric struct {
	ABSynStart            int64  `protobuf:"varint,1,opt,name=ABSynStart,proto3" json:"ABSynStart"`
	BASynStart            int64  `protobuf:"varint,2,opt,name=BASynStart,proto3" json:"BASynStart"`
	ABSynTTL              uint32 `protobuf:"varint,3,opt,name=ABSynTTL,proto3" json:"ABSynTTL,omitempty"`
	BASynTTL              uint32 `protobuf:"varint,4,opt,name=BASynTTL,proto3" json:"BASynTTL,omitempty"`
	ABFinStart            int64  `protobuf:"varint,5,opt,name=ABFinStart,proto3" json:"ABFinStart"`
	BAFinStart            int64  `protobuf:"varint,6,opt,name=BAFinStart,proto3" json:"BAFinStart"`
	ABRstStart            int64  `protobuf:"varint,7,opt,name=ABRstStart,proto3" json:"ABRstStart"`
	BARstStart            int64  `protobuf:"varint,8,opt,name=BARstStart,proto3" json:"BARstStart"`
	ABSegmentOutOfOrder   int64  `protobuf:"varint,9,opt,name=ABSegmentOutOfOrder,proto3" json:"ABSegmentOutOfOrder"`
	ABSegmentSkipped      int64  `protobuf:"varint,10,opt,name=ABSegmentSkipped,proto3" json:"ABSegmentSkipped"`
	ABSegmentSkippedBytes int64  `protobuf:"varint,11,opt,name=ABSegmentSkippedBytes,proto3" json:"ABSegmentSkippedBytes"`
	ABPackets             int64  `protobuf:"varint,12,opt,name=ABPackets,proto3" json:"ABPackets"`
	ABBytes               int64  `protobuf:"varint,13,opt,name=ABBytes,proto3" json:"ABBytes"`
	ABSawStart            int64  `protobuf:"varint,14,opt,name=ABSawStart,proto3" json:"ABSawStart"`
	ABSawEnd              int64  `protobuf:"varint,15,opt,name=ABSawEnd,proto3" json:"ABSawEnd"`
	BASegmentOutOfOrder   int64  `protobuf:"varint,16,opt,name=BASegmentOutOfOrder,proto3" json:"BASegmentOutOfOrder"`
	BASegmentSkipped      int64  `protobuf:"varint,17,opt,name=BASegmentSkipped,proto3" json:"BASegmentSkipped"`
	BASegmentSkippedBytes int64  `protobuf:"varint,18,opt,name=BASegmentSkippedBytes,proto3" json:"BASegmentSkippedBytes"`
	BAPackets             int64  `protobuf:"varint,19,opt,name=BAPackets,proto3" json:"BAPackets"`
	BABytes               int64  `protobuf:"varint,20,opt,name=BABytes,proto3" json:"BABytes"`
	BASawStart            int64  `protobuf:"varint,21,opt,name=BASawStart,proto3" json:"BASawStart"`
	BASawEnd              int64  `protobuf:"varint,22,opt,name=BASawEnd,proto3" json:"BASawEnd"`
}

gendecoder

func (*TCPMetric) Descriptor added in v0.26.0

func (*TCPMetric) Descriptor() ([]byte, []int)

func (*TCPMetric) GetABBytes added in v0.26.0

func (m *TCPMetric) GetABBytes() int64

func (*TCPMetric) GetABFinStart added in v0.26.0

func (m *TCPMetric) GetABFinStart() int64

func (*TCPMetric) GetABPackets added in v0.26.0

func (m *TCPMetric) GetABPackets() int64

func (*TCPMetric) GetABRstStart added in v0.26.0

func (m *TCPMetric) GetABRstStart() int64

func (*TCPMetric) GetABSawEnd added in v0.26.0

func (m *TCPMetric) GetABSawEnd() int64

func (*TCPMetric) GetABSawStart added in v0.26.0

func (m *TCPMetric) GetABSawStart() int64

func (*TCPMetric) GetABSegmentOutOfOrder added in v0.26.0

func (m *TCPMetric) GetABSegmentOutOfOrder() int64

func (*TCPMetric) GetABSegmentSkipped added in v0.26.0

func (m *TCPMetric) GetABSegmentSkipped() int64

func (*TCPMetric) GetABSegmentSkippedBytes added in v0.26.0

func (m *TCPMetric) GetABSegmentSkippedBytes() int64

func (*TCPMetric) GetABSynStart added in v0.26.0

func (m *TCPMetric) GetABSynStart() int64

func (*TCPMetric) GetABSynTTL added in v0.26.0

func (m *TCPMetric) GetABSynTTL() uint32

func (*TCPMetric) GetBABytes added in v0.26.0

func (m *TCPMetric) GetBABytes() int64

func (*TCPMetric) GetBAFinStart added in v0.26.0

func (m *TCPMetric) GetBAFinStart() int64

func (*TCPMetric) GetBAPackets added in v0.26.0

func (m *TCPMetric) GetBAPackets() int64

func (*TCPMetric) GetBARstStart added in v0.26.0

func (m *TCPMetric) GetBARstStart() int64

func (*TCPMetric) GetBASawEnd added in v0.26.0

func (m *TCPMetric) GetBASawEnd() int64

func (*TCPMetric) GetBASawStart added in v0.26.0

func (m *TCPMetric) GetBASawStart() int64

func (*TCPMetric) GetBASegmentOutOfOrder added in v0.26.0

func (m *TCPMetric) GetBASegmentOutOfOrder() int64

func (*TCPMetric) GetBASegmentSkipped added in v0.26.0

func (m *TCPMetric) GetBASegmentSkipped() int64

func (*TCPMetric) GetBASegmentSkippedBytes added in v0.26.0

func (m *TCPMetric) GetBASegmentSkippedBytes() int64

func (*TCPMetric) GetBASynStart added in v0.26.0

func (m *TCPMetric) GetBASynStart() int64

func (*TCPMetric) GetBASynTTL added in v0.26.0

func (m *TCPMetric) GetBASynTTL() uint32

func (*TCPMetric) GetField added in v0.26.0

func (obj *TCPMetric) GetField(key string) (interface{}, error)

func (*TCPMetric) GetFieldBool added in v0.26.0

func (obj *TCPMetric) GetFieldBool(key string) (bool, error)

func (*TCPMetric) GetFieldInt64 added in v0.26.0

func (obj *TCPMetric) GetFieldInt64(key string) (int64, error)

func (*TCPMetric) GetFieldKeys added in v0.26.0

func (obj *TCPMetric) GetFieldKeys() []string

func (*TCPMetric) GetFieldString added in v0.26.0

func (obj *TCPMetric) GetFieldString(key string) (string, error)

func (*TCPMetric) Marshal added in v0.26.0

func (m *TCPMetric) Marshal() (dAtA []byte, err error)

func (TCPMetric) MarshalEasyJSON added in v0.26.0

func (v TCPMetric) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (TCPMetric) MarshalJSON added in v0.26.0

func (v TCPMetric) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*TCPMetric) MarshalTo added in v0.26.0

func (m *TCPMetric) MarshalTo(dAtA []byte) (int, error)

func (*TCPMetric) MarshalToSizedBuffer added in v0.26.0

func (m *TCPMetric) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*TCPMetric) MatchBool added in v0.26.0

func (obj *TCPMetric) MatchBool(key string, predicate getter.BoolPredicate) bool

func (*TCPMetric) MatchInt64 added in v0.26.0

func (obj *TCPMetric) MatchInt64(key string, predicate getter.Int64Predicate) bool

func (*TCPMetric) MatchString added in v0.26.0

func (obj *TCPMetric) MatchString(key string, predicate getter.StringPredicate) bool

func (*TCPMetric) ProtoMessage added in v0.26.0

func (*TCPMetric) ProtoMessage()

func (*TCPMetric) ProtoSize added in v0.26.0

func (m *TCPMetric) ProtoSize() (n int)

func (*TCPMetric) Reset added in v0.26.0

func (m *TCPMetric) Reset()

func (*TCPMetric) String added in v0.26.0

func (m *TCPMetric) String() string

func (*TCPMetric) Unmarshal added in v0.26.0

func (m *TCPMetric) Unmarshal(dAtA []byte) error

func (*TCPMetric) UnmarshalEasyJSON added in v0.26.0

func (v *TCPMetric) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*TCPMetric) UnmarshalJSON added in v0.26.0

func (v *TCPMetric) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

func (*TCPMetric) XXX_DiscardUnknown added in v0.26.0

func (m *TCPMetric) XXX_DiscardUnknown()

func (*TCPMetric) XXX_Marshal added in v0.26.0

func (m *TCPMetric) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*TCPMetric) XXX_Merge added in v0.26.0

func (m *TCPMetric) XXX_Merge(src proto.Message)

func (*TCPMetric) XXX_Size added in v0.26.0

func (m *TCPMetric) XXX_Size() int

func (*TCPMetric) XXX_Unmarshal added in v0.26.0

func (m *TCPMetric) XXX_Unmarshal(b []byte) error

type Table added in v0.4.0

type Table struct {
	Opts TableOpts
	// contains filtered or unexported fields
}

Table store the flow table and related metrics mechanism

func NewTable added in v0.4.0

func NewTable(updateEvery, expireAfter time.Duration, sender Sender, uuids UUIDs, opts ...TableOpts) *Table

NewTable creates a new flow table

func (*Table) FeedWithGoPacket added in v0.18.0

func (ft *Table) FeedWithGoPacket(packet gopacket.Packet, bpf *BPF)

FeedWithGoPacket feeds the table with a gopacket

func (*Table) FeedWithSFlowSample added in v0.18.0

func (ft *Table) FeedWithSFlowSample(sample *layers.SFlowFlowSample, bpf *BPF)

FeedWithSFlowSample feeds the table with sflow samples

func (*Table) IPDefragger added in v0.18.0

func (ft *Table) IPDefragger() *IPDefragger

IPDefragger returns the ipDefragger if enabled

func (*Table) Query added in v0.4.0

func (ft *Table) Query(query *TableQuery) []byte

Query a flow table

func (*Table) Run added in v0.7.0

func (ft *Table) Run()

Run background jobs, like update/expire entries event

func (*Table) Start added in v0.4.0

func (ft *Table) Start(extFlowExp chan interface{}) (chan *PacketSequence, chan *ExtFlow, chan Stats)

Start the flow table

func (*Table) State added in v0.20.0

func (ft *Table) State() service.State

State returns the state of the flow table, stopped, running...

func (*Table) Stop added in v0.4.0

func (ft *Table) Stop()

Stop the flow table

type TableAllocator added in v0.4.0

type TableAllocator struct {
	insanelock.RWMutex
	// contains filtered or unexported fields
}

TableAllocator aims to create/allocate a new flow table

func NewTableAllocator added in v0.4.0

func NewTableAllocator(updateEvery, expireAfter time.Duration, sender Sender) *TableAllocator

NewTableAllocator creates a new flow table

func (*TableAllocator) Alloc added in v0.4.0

func (a *TableAllocator) Alloc(uuids UUIDs, opts TableOpts) *Table

Alloc instantiate/allocate a new table

func (*TableAllocator) ExpireAfter added in v0.24.0

func (a *TableAllocator) ExpireAfter() time.Duration

ExpireAfter returns the expiration duration

func (*TableAllocator) QueryTable added in v0.4.0

func (a *TableAllocator) QueryTable(tq *TableQuery) *TableReply

QueryTable search/query within the flow table

func (*TableAllocator) Release added in v0.4.0

func (a *TableAllocator) Release(t *Table)

Release release/destroy a flow table

type TableClient added in v0.4.0

type TableClient interface {
	LookupFlows(flowSearchQuery filters.SearchQuery) (*FlowSet, error)
	LookupFlowsByNodes(hnmap topology.HostNodeTIDMap, flowSearchQuery filters.SearchQuery) (*FlowSet, error)
}

TableClient describes a mechanism to query a flow table

type TableOpts added in v0.12.0

type TableOpts struct {
	RawPacketLimit int64
	ExtraTCPMetric bool
	IPDefrag       bool
	ReassembleTCP  bool
	LayerKeyMode   LayerKeyMode
	ExtraLayers    ExtraLayers
}

TableOpts defines flow table options

type TableQuery added in v0.4.0

type TableQuery struct {
	Type  string               `protobuf:"bytes,1,opt,name=Type,proto3" json:"Type,omitempty"`
	Query *filters.SearchQuery `protobuf:"bytes,2,opt,name=query,proto3" json:"query,omitempty"`
}

func (*TableQuery) Descriptor added in v0.26.0

func (*TableQuery) Descriptor() ([]byte, []int)

func (*TableQuery) GetQuery added in v0.26.0

func (m *TableQuery) GetQuery() *filters.SearchQuery

func (*TableQuery) GetType added in v0.26.0

func (m *TableQuery) GetType() string

func (*TableQuery) Marshal added in v0.26.0

func (m *TableQuery) Marshal() (dAtA []byte, err error)

func (TableQuery) MarshalEasyJSON added in v0.26.0

func (v TableQuery) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (TableQuery) MarshalJSON added in v0.26.0

func (v TableQuery) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*TableQuery) MarshalTo added in v0.26.0

func (m *TableQuery) MarshalTo(dAtA []byte) (int, error)

func (*TableQuery) MarshalToSizedBuffer added in v0.26.0

func (m *TableQuery) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*TableQuery) ProtoMessage added in v0.26.0

func (*TableQuery) ProtoMessage()

func (*TableQuery) ProtoSize added in v0.26.0

func (m *TableQuery) ProtoSize() (n int)

func (*TableQuery) Reset added in v0.26.0

func (m *TableQuery) Reset()

func (*TableQuery) String added in v0.26.0

func (m *TableQuery) String() string

func (*TableQuery) Unmarshal added in v0.26.0

func (m *TableQuery) Unmarshal(dAtA []byte) error

func (*TableQuery) UnmarshalEasyJSON added in v0.26.0

func (v *TableQuery) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*TableQuery) UnmarshalJSON added in v0.26.0

func (v *TableQuery) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

func (*TableQuery) XXX_DiscardUnknown added in v0.26.0

func (m *TableQuery) XXX_DiscardUnknown()

func (*TableQuery) XXX_Marshal added in v0.26.0

func (m *TableQuery) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*TableQuery) XXX_Merge added in v0.26.0

func (m *TableQuery) XXX_Merge(src proto.Message)

func (*TableQuery) XXX_Size added in v0.26.0

func (m *TableQuery) XXX_Size() int

func (*TableQuery) XXX_Unmarshal added in v0.26.0

func (m *TableQuery) XXX_Unmarshal(b []byte) error

type TableReply added in v0.4.0

type TableReply struct {
	Status       int32    `protobuf:"varint,1,opt,name=Status,proto3" json:"Status,omitempty"`
	FlowSetBytes [][]byte `protobuf:"bytes,2,rep,name=FlowSetBytes,proto3" json:"FlowSetBytes,omitempty"`
}

func (*TableReply) Descriptor added in v0.26.0

func (*TableReply) Descriptor() ([]byte, []int)

func (*TableReply) GetFlowSetBytes added in v0.26.0

func (m *TableReply) GetFlowSetBytes() [][]byte

func (*TableReply) GetStatus added in v0.26.0

func (m *TableReply) GetStatus() int32

func (*TableReply) Marshal added in v0.26.0

func (m *TableReply) Marshal() (dAtA []byte, err error)

func (TableReply) MarshalEasyJSON added in v0.26.0

func (v TableReply) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (TableReply) MarshalJSON added in v0.26.0

func (v TableReply) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*TableReply) MarshalTo added in v0.26.0

func (m *TableReply) MarshalTo(dAtA []byte) (int, error)

func (*TableReply) MarshalToSizedBuffer added in v0.26.0

func (m *TableReply) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*TableReply) ProtoMessage added in v0.26.0

func (*TableReply) ProtoMessage()

func (*TableReply) ProtoSize added in v0.26.0

func (m *TableReply) ProtoSize() (n int)

func (*TableReply) Reset added in v0.26.0

func (m *TableReply) Reset()

func (*TableReply) String added in v0.26.0

func (m *TableReply) String() string

func (*TableReply) Unmarshal added in v0.26.0

func (m *TableReply) Unmarshal(dAtA []byte) error

func (*TableReply) UnmarshalEasyJSON added in v0.26.0

func (v *TableReply) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*TableReply) UnmarshalJSON added in v0.26.0

func (v *TableReply) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

func (*TableReply) XXX_DiscardUnknown added in v0.26.0

func (m *TableReply) XXX_DiscardUnknown()

func (*TableReply) XXX_Marshal added in v0.26.0

func (m *TableReply) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*TableReply) XXX_Merge added in v0.26.0

func (m *TableReply) XXX_Merge(src proto.Message)

func (*TableReply) XXX_Size added in v0.26.0

func (m *TableReply) XXX_Size() int

func (*TableReply) XXX_Unmarshal added in v0.26.0

func (m *TableReply) XXX_Unmarshal(b []byte) error

type TransportLayer added in v0.26.0

type TransportLayer struct {
	Protocol FlowProtocol `protobuf:"varint,1,opt,name=Protocol,proto3,enum=flow.FlowProtocol" json:"Protocol"`
	A        int64        `protobuf:"varint,2,opt,name=A,proto3" json:"A"`
	B        int64        `protobuf:"varint,3,opt,name=B,proto3" json:"B"`
	ID       int64        `protobuf:"varint,4,opt,name=ID,proto3" json:"ID"`
}

gendecoder

func (*TransportLayer) Descriptor added in v0.26.0

func (*TransportLayer) Descriptor() ([]byte, []int)

func (*TransportLayer) GetA added in v0.26.0

func (m *TransportLayer) GetA() int64

func (*TransportLayer) GetB added in v0.26.0

func (m *TransportLayer) GetB() int64

func (*TransportLayer) GetField added in v0.26.0

func (obj *TransportLayer) GetField(key string) (interface{}, error)

func (*TransportLayer) GetFieldBool added in v0.26.0

func (obj *TransportLayer) GetFieldBool(key string) (bool, error)

func (*TransportLayer) GetFieldInt64 added in v0.26.0

func (obj *TransportLayer) GetFieldInt64(key string) (int64, error)

func (*TransportLayer) GetFieldKeys added in v0.26.0

func (obj *TransportLayer) GetFieldKeys() []string

func (*TransportLayer) GetFieldString added in v0.26.0

func (obj *TransportLayer) GetFieldString(key string) (string, error)

func (*TransportLayer) GetID added in v0.26.0

func (m *TransportLayer) GetID() int64

func (*TransportLayer) GetProtocol added in v0.26.0

func (m *TransportLayer) GetProtocol() FlowProtocol

func (*TransportLayer) Hash added in v0.26.0

func (tl *TransportLayer) Hash(hasher hash.Hash, swap bool)

Hash computes the hash of a transport layer

func (*TransportLayer) Marshal added in v0.26.0

func (m *TransportLayer) Marshal() (dAtA []byte, err error)

func (TransportLayer) MarshalEasyJSON added in v0.26.0

func (v TransportLayer) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (TransportLayer) MarshalJSON added in v0.26.0

func (v TransportLayer) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*TransportLayer) MarshalTo added in v0.26.0

func (m *TransportLayer) MarshalTo(dAtA []byte) (int, error)

func (*TransportLayer) MarshalToSizedBuffer added in v0.26.0

func (m *TransportLayer) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*TransportLayer) MatchBool added in v0.26.0

func (obj *TransportLayer) MatchBool(key string, predicate getter.BoolPredicate) bool

func (*TransportLayer) MatchInt64 added in v0.26.0

func (obj *TransportLayer) MatchInt64(key string, predicate getter.Int64Predicate) bool

func (*TransportLayer) MatchString added in v0.26.0

func (obj *TransportLayer) MatchString(key string, predicate getter.StringPredicate) bool

func (*TransportLayer) ProtoMessage added in v0.26.0

func (*TransportLayer) ProtoMessage()

func (*TransportLayer) ProtoSize added in v0.26.0

func (m *TransportLayer) ProtoSize() (n int)

func (*TransportLayer) Reset added in v0.26.0

func (m *TransportLayer) Reset()

func (*TransportLayer) String added in v0.26.0

func (m *TransportLayer) String() string

func (*TransportLayer) Unmarshal added in v0.26.0

func (m *TransportLayer) Unmarshal(dAtA []byte) error

func (*TransportLayer) UnmarshalEasyJSON added in v0.26.0

func (v *TransportLayer) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*TransportLayer) UnmarshalJSON added in v0.26.0

func (v *TransportLayer) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

func (*TransportLayer) XXX_DiscardUnknown added in v0.26.0

func (m *TransportLayer) XXX_DiscardUnknown()

func (*TransportLayer) XXX_Marshal added in v0.26.0

func (m *TransportLayer) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*TransportLayer) XXX_Merge added in v0.26.0

func (m *TransportLayer) XXX_Merge(src proto.Message)

func (*TransportLayer) XXX_Size added in v0.26.0

func (m *TransportLayer) XXX_Size() int

func (*TransportLayer) XXX_Unmarshal added in v0.26.0

func (m *TransportLayer) XXX_Unmarshal(b []byte) error

type UUIDs added in v0.21.0

type UUIDs struct {
	NodeTID   string
	CaptureID string
}

UUIDs describes UUIDs that can be applied to flows table wise

type WSTableClient added in v0.20.0

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

WSTableClient implements a flow table client using WebSocket

func NewWSTableClient added in v0.20.0

func NewWSTableClient(w *ws.StructServer) *WSTableClient

NewWSTableClient creates a new table client based on websocket

func (*WSTableClient) LookupFlows added in v0.20.0

func (f *WSTableClient) LookupFlows(flowSearchQuery filters.SearchQuery) (*FlowSet, error)

LookupFlows query flow table based on a filter search query

func (*WSTableClient) LookupFlowsByNodes added in v0.20.0

func (f *WSTableClient) LookupFlowsByNodes(hnmap topology.HostNodeTIDMap, flowSearchQuery filters.SearchQuery) (*FlowSet, error)

LookupFlowsByNodes query flow table based on multiple nodes

type WSTableServer added in v0.20.0

type WSTableServer struct {
	TableAllocator *TableAllocator
}

WSTableServer describes a mechanism to Query a flow table via Websocket

func NewWSTableServer added in v0.20.0

func NewWSTableServer(allocator *TableAllocator, pool ws.StructSpeakerPool) *WSTableServer

NewWSTableServer creates a new flow table query server based on websocket

func (*WSTableServer) OnStructMessage added in v0.20.0

func (s *WSTableServer) OnStructMessage(c ws.Speaker, msg *ws.StructMessage)

OnStructMessage TableQuery

func (*WSTableServer) OnTableQuery added in v0.20.0

func (s *WSTableServer) OnTableQuery(c ws.Speaker, msg *ws.StructMessage)

OnTableQuery event

Jump to

Keyboard shortcuts

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