flow

package
v0.0.0-...-5b448de Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2017 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Overview

Package flow is a generated protocol buffer package.

It is generated from these files:

flow/flow.proto
flow/set.proto
flow/request.proto

It has these top-level messages:

FlowLayer
ICMPLayer
FlowMetric
Flow
FlowSet
FlowSearchReply

Index

Constants

View Source
const (
	// CaptureLength : default packet capture length (256 bytes)
	CaptureLength uint32 = 256
)
View Source
const (
	Namespace = "Flow"
)

Namespace "Flow"

Variables

View Source
var ErrFlowProtocol = errors.New("FlowProtocol invalid")

ErrFlowProtocol invalid protocol error

View Source
var FlowProtocol_name = map[int32]string{
	0: "ETHERNET",
	1: "IPV4",
	2: "TCPPORT",
	3: "UDPPORT",
	4: "SCTPPORT",
	5: "IPV6",
	6: "ICMPV4",
	7: "ICMPV6",
}
View Source
var FlowProtocol_value = map[string]int32{
	"ETHERNET": 0,
	"IPV4":     1,
	"TCPPORT":  2,
	"UDPPORT":  3,
	"SCTPPORT": 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 LayerTypeInGRE = gopacket.RegisterLayerType(55555, gopacket.LayerTypeMetadata{Name: "LayerTypeInGRE", Decoder: gopacket.DecodeFunc(decodeInGRELayer)})

LayerTypeInGRE 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

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

BPFFilterToRaw creates a raw binary filter from a BPF expression

func HashFromValues

func HashFromValues(ab interface{}, ba interface{}) []byte

HashFromValues calculates a unique symetric flow layer hash

func NewFilterForFlowSet

func NewFilterForFlowSet(flowset *FlowSet) *filters.Filter

NewFilterForFlowSet creates a new filter based on a set of flows

func NewFilterForNodeTIDs

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

NewFilterForNodeTIDs creates a new filter based on flow NodeTID, ANodeTID, BNodeTID

func NewFilterForNodes

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

NewFilterForNodes creates a new filter based on graph nodes

Types

type BPF

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

BPF describes a filter

func NewBPF

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

NewBPF creates a new BPF filter

func (*BPF) Matches

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

Matches returns true data match the filter

type Enhancer

type Enhancer interface {
	Enhance(flow *Flow)
}

Enhancer should Enhance the flow via this interface

type EnhancerPipeline

type EnhancerPipeline struct {
	Enhancers []Enhancer
}

EnhancerPipeline describes a list of flow enhancer

func NewEnhancerPipeline

func NewEnhancerPipeline(enhancers ...Enhancer) *EnhancerPipeline

NewEnhancerPipeline registers a list of flow Enhancer

func (*EnhancerPipeline) AddEnhancer

func (e *EnhancerPipeline) AddEnhancer(en Enhancer)

AddEnhancer registers a new flow enhancer

func (*EnhancerPipeline) Enhance

func (e *EnhancerPipeline) Enhance(flows []*Flow)

Enhance a list of flows

func (*EnhancerPipeline) EnhanceFlow

func (e *EnhancerPipeline) EnhanceFlow(flow *Flow)

EnhanceFlow enhance a flow from with all registered enhancer

type ExpireUpdateFunc

type ExpireUpdateFunc func(f []*Flow)

ExpireUpdateFunc defines expire and updates callback

type Flow

type Flow struct {
	// 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" json:"UUID,omitempty"`
	LayersPath string `protobuf:"bytes,2,opt,name=LayersPath" json:"LayersPath,omitempty"`
	// Application is the last layer which is not a payload.
	Application string `protobuf:"bytes,3,opt,name=Application" json:"Application,omitempty"`
	// Data Flow info
	Link      *FlowLayer `protobuf:"bytes,20,opt,name=Link" json:"Link,omitempty"`
	Network   *FlowLayer `protobuf:"bytes,21,opt,name=Network" json:"Network,omitempty"`
	Transport *FlowLayer `protobuf:"bytes,22,opt,name=Transport" json:"Transport,omitempty"`
	ICMP      *ICMPLayer `protobuf:"bytes,23,opt,name=ICMP" json:"ICMP,omitempty"`
	// Data Flow Metric info from the 1st layer
	// amount of data between two updates
	LastUpdateMetric *FlowMetric `protobuf:"bytes,31,opt,name=LastUpdateMetric" json:"LastUpdateMetric,omitempty"`
	// Total amount of data for the whole flow duration
	Metric          *FlowMetric `protobuf:"bytes,32,opt,name=Metric" json:"Metric,omitempty"`
	Start           int64       `protobuf:"varint,10,opt,name=Start" json:"Start"`
	Last            int64       `protobuf:"varint,11,opt,name=Last" json:"Last"`
	LastUpdateStart int64       `protobuf:"varint,12,opt,name=LastUpdateStart" json:"LastUpdateStart"`
	LastUpdateLast  int64       `protobuf:"varint,13,opt,name=LastUpdateLast" json:"LastUpdateLast"`
	// 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" json:"TrackingID,omitempty"`
	L3TrackingID string `protobuf:"bytes,51,opt,name=L3TrackingID" 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" json:"ParentUUID"`
	// Topology info
	NodeTID  string `protobuf:"bytes,33,opt,name=NodeTID" json:"NodeTID,omitempty"`
	ANodeTID string `protobuf:"bytes,34,opt,name=ANodeTID" json:"ANodeTID,omitempty"`
	BNodeTID string `protobuf:"bytes,35,opt,name=BNodeTID" json:"BNodeTID,omitempty"`
}

func FromData

func FromData(data []byte) (*Flow, error)

FromData deserialize a protobuf message to a Flow

func NewFlow

func NewFlow() *Flow

NewFlow creates a new empty flow

func (*Flow) Descriptor

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

func (*Flow) GetANodeTID

func (m *Flow) GetANodeTID() string

func (*Flow) GetApplication

func (m *Flow) GetApplication() string

func (*Flow) GetBNodeTID

func (m *Flow) GetBNodeTID() string

func (*Flow) GetData

func (f *Flow) GetData() ([]byte, error)

GetData serialize a Flow to a protobuf

func (*Flow) GetDuration

func (f *Flow) GetDuration() time.Duration

GetDuration of the flow

func (*Flow) GetField

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

GetField returns the value of a field

func (*Flow) GetFieldInt64

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

GetFieldInt64 returns the value of a Flow field

func (*Flow) GetFieldString

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

GetFieldString returns the value of a Flow field

func (*Flow) GetFields

func (f *Flow) GetFields() []interface{}

GetFields returns the list of valid field of a Flow

func (*Flow) GetICMP

func (m *Flow) GetICMP() *ICMPLayer

func (*Flow) GetL3TrackingID

func (m *Flow) GetL3TrackingID() string

func (*Flow) GetLast

func (m *Flow) GetLast() int64

func (*Flow) GetLastTime

func (f *Flow) GetLastTime() time.Time

GetLastTime of the flow

func (*Flow) GetLastUpdateLast

func (m *Flow) GetLastUpdateLast() int64

func (*Flow) GetLastUpdateMetric

func (m *Flow) GetLastUpdateMetric() *FlowMetric

func (*Flow) GetLastUpdateStart

func (m *Flow) GetLastUpdateStart() int64

func (*Flow) GetLayersPath

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

func (*Flow) GetMetric

func (m *Flow) GetMetric() *FlowMetric

func (*Flow) GetNetwork

func (m *Flow) GetNetwork() *FlowLayer

func (*Flow) GetNodeTID

func (m *Flow) GetNodeTID() string

func (*Flow) GetParentUUID

func (m *Flow) GetParentUUID() string

func (*Flow) GetStart

func (m *Flow) GetStart() int64

func (*Flow) GetStartTime

func (f *Flow) GetStartTime() time.Time

GetStartTime of the flow

func (*Flow) GetTrackingID

func (m *Flow) GetTrackingID() string

func (*Flow) GetTransport

func (m *Flow) GetTransport() *FlowLayer

func (*Flow) GetUUID

func (m *Flow) GetUUID() string

func (*Flow) Init

func (f *Flow) Init(key string, now int64, packet *gopacket.Packet, length int64, nodeTID string, parentUUID string, L2ID int64, L3ID int64)

Init a flow based on flow key and gopacket

func (*Flow) ProtoMessage

func (*Flow) ProtoMessage()

func (*Flow) Reset

func (m *Flow) Reset()

func (*Flow) String

func (m *Flow) String() string

func (*Flow) Update

func (f *Flow) Update(now int64, packet *gopacket.Packet, length int64)

Update a flow metrics

func (*Flow) UpdateUUID

func (f *Flow) UpdateUUID(key string, L2ID int64, L3ID int64)

UpdateUUID updates the flow UUID based on protocotols layers path and layers IDs

type FlowLayer

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

func (*FlowLayer) Descriptor

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

func (*FlowLayer) GetA

func (m *FlowLayer) GetA() string

func (*FlowLayer) GetB

func (m *FlowLayer) GetB() string

func (*FlowLayer) GetFieldInt64

func (f *FlowLayer) GetFieldInt64(field string) (int64, error)

GetFieldInt64 returns the value of a flow field

func (*FlowLayer) GetID

func (m *FlowLayer) GetID() int64

func (*FlowLayer) GetProtocol

func (m *FlowLayer) GetProtocol() FlowProtocol

func (*FlowLayer) GetStringField

func (f *FlowLayer) GetStringField(field string) (string, error)

GetStringField returns the value of a flow field

func (*FlowLayer) Hash

func (fl *FlowLayer) Hash() []byte

Hash calculates a unique symetric flow layer hash

func (*FlowLayer) HashStr

func (fl *FlowLayer) HashStr() string

HashStr returns the string (hexadecimal) of the current hash flow layer

func (*FlowLayer) MarshalJSON

func (f *FlowLayer) MarshalJSON() ([]byte, error)

MarshalJSON serialize a FlowLayer in JSON

func (*FlowLayer) ProtoMessage

func (*FlowLayer) ProtoMessage()

func (*FlowLayer) Reset

func (m *FlowLayer) Reset()

func (*FlowLayer) String

func (m *FlowLayer) String() string

func (*FlowLayer) UnmarshalJSON

func (f *FlowLayer) UnmarshalJSON(b []byte) error

UnmarshalJSON deserialize a JSON object in FlowLayer

type FlowMetric

type FlowMetric struct {
	ABPackets int64 `protobuf:"varint,2,opt,name=ABPackets" json:"ABPackets"`
	ABBytes   int64 `protobuf:"varint,3,opt,name=ABBytes" json:"ABBytes"`
	BAPackets int64 `protobuf:"varint,4,opt,name=BAPackets" json:"BAPackets"`
	BABytes   int64 `protobuf:"varint,5,opt,name=BABytes" json:"BABytes"`
}

func (*FlowMetric) Add

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

Add sum flow metrics

func (*FlowMetric) Copy

func (f *FlowMetric) Copy() *FlowMetric

Copy a flow metric

func (*FlowMetric) Descriptor

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

func (*FlowMetric) GetABBytes

func (m *FlowMetric) GetABBytes() int64

func (*FlowMetric) GetABPackets

func (m *FlowMetric) GetABPackets() int64

func (*FlowMetric) GetBABytes

func (m *FlowMetric) GetBABytes() int64

func (*FlowMetric) GetBAPackets

func (m *FlowMetric) GetBAPackets() int64

func (*FlowMetric) GetFieldInt64

func (f *FlowMetric) GetFieldInt64(field string) (int64, error)

GetFieldInt64 returns the field value

func (*FlowMetric) ProtoMessage

func (*FlowMetric) ProtoMessage()

func (*FlowMetric) Reset

func (m *FlowMetric) Reset()

func (*FlowMetric) String

func (m *FlowMetric) String() string

type FlowProtocol

type FlowProtocol int32
const (
	FlowProtocol_ETHERNET FlowProtocol = 0
	FlowProtocol_IPV4     FlowProtocol = 1
	FlowProtocol_TCPPORT  FlowProtocol = 2
	FlowProtocol_UDPPORT  FlowProtocol = 3
	FlowProtocol_SCTPPORT FlowProtocol = 4
	FlowProtocol_IPV6     FlowProtocol = 5
	FlowProtocol_ICMPV4   FlowProtocol = 6
	FlowProtocol_ICMPV6   FlowProtocol = 7
)

func (FlowProtocol) EnumDescriptor

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

func (FlowProtocol) String

func (x FlowProtocol) String() string

func (FlowProtocol) Value

func (x FlowProtocol) Value() int32

Value returns int32 value of a FlowProtocol

type FlowSearchReply

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

func (*FlowSearchReply) Descriptor

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

func (*FlowSearchReply) GetFlowSet

func (m *FlowSearchReply) GetFlowSet() *FlowSet

func (*FlowSearchReply) ProtoMessage

func (*FlowSearchReply) ProtoMessage()

func (*FlowSearchReply) Reset

func (m *FlowSearchReply) Reset()

func (*FlowSearchReply) String

func (m *FlowSearchReply) String() string

type FlowSet

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

func NewFlowSet

func NewFlowSet() *FlowSet

NewFlowSet creates a new empty FlowSet

func (*FlowSet) Dedup

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

Dedup deduplicate a flows in a FlowSet

func (*FlowSet) Descriptor

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

func (*FlowSet) Filter

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

Filter flows in a FlowSet

func (*FlowSet) GetEnd

func (m *FlowSet) GetEnd() int64

func (*FlowSet) GetFlows

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

func (*FlowSet) GetStart

func (m *FlowSet) GetStart() int64

func (*FlowSet) Merge

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

func (*FlowSet) ProtoMessage()

func (*FlowSet) Reset

func (m *FlowSet) Reset()

func (*FlowSet) Slice

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

Slice returns a slice of a FlowSet

func (*FlowSet) Sort

func (fs *FlowSet) Sort(order common.SortOrder, orberBy string)

Sort flows in a FlowSet

func (*FlowSet) String

func (m *FlowSet) String() string

type Handler

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

Handler defines a flow callback called every time

func NewFlowHandler

func NewFlowHandler(callback ExpireUpdateFunc, every time.Duration) *Handler

NewFlowHandler creates a flow callback handler that will be asynchronously called every time

type ICMPLayer

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

func (*ICMPLayer) Descriptor

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

func (*ICMPLayer) GetCode

func (m *ICMPLayer) GetCode() uint32

func (*ICMPLayer) GetFieldInt64

func (i *ICMPLayer) GetFieldInt64(field string) (int64, error)

GetFieldInt64 returns the value of a ICMP field

func (*ICMPLayer) GetID

func (m *ICMPLayer) GetID() uint32

func (*ICMPLayer) GetStringField

func (i *ICMPLayer) GetStringField(field string) (string, error)

GetStringField returns the value of a ICMP field

func (*ICMPLayer) GetType

func (m *ICMPLayer) GetType() ICMPType

func (*ICMPLayer) MarshalJSON

func (i *ICMPLayer) MarshalJSON() ([]byte, error)

MarshalJSON serialize a ICMPLayer in JSON

func (*ICMPLayer) ProtoMessage

func (*ICMPLayer) ProtoMessage()

func (*ICMPLayer) Reset

func (m *ICMPLayer) Reset()

func (*ICMPLayer) String

func (m *ICMPLayer) String() string

func (*ICMPLayer) UnmarshalJSON

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

UnmarshalJSON deserialize a JSON object in ICMPLayer

type ICMPType

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 (ICMPType) EnumDescriptor

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

func (ICMPType) String

func (x ICMPType) String() string

type ICMPv4

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

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

Payload returns the ICMP payload

type ICMPv6

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

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

Payload returns the ICMP payload

type Key

type Key string

Key describes a unique flow Key

func KeyFromGoPacket

func KeyFromGoPacket(p *gopacket.Packet, parentUUID string) Key

KeyFromGoPacket returns the unique flow key The unique key is calculated based on parentUUID, network, transport and applicable layers

func (Key) String

func (f Key) String() string

type MergeContext

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

MergeContext describes a mechanism to merge flow sets

type Packet

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

Packet describes one packet

type Packets

type Packets struct {
	Packets   []Packet
	Timestamp int64
}

Packets represents a suite of parent/child Packet

func PacketsFromGoPacket

func PacketsFromGoPacket(packet *gopacket.Packet, outerLength int64, t int64, bpf *BPF) *Packets

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

func PacketsFromSFlowSample

func PacketsFromSFlowSample(sample *layers.SFlowFlowSample, t int64, bpf *BPF) []*Packets

PacketsFromSFlowSample returns an array of Packets as a sample contains mutlple records which generate a Packets each.

type PcapInject

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

PcapInject replay a pcap file

func NewPcapInject

func NewPcapInject(r io.ReadCloser, packetsChan chan *Packets, replay bool, bpfFilter string) (*PcapInject, error)

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

func (*PcapInject) FeedFlowTable

func (p *PcapInject) FeedFlowTable()

FeedFlowTable mechanism, inject pcap in a flow table

func (*PcapInject) Start

func (p *PcapInject) Start()

Start a pcap injector

func (*PcapInject) Stop

func (p *PcapInject) Stop()

Stop a pcap injector

type Table

type Table struct {
	PacketsChan chan *Packets
	// contains filtered or unexported fields
}

Table store the flow table and related metrics mechanism

func NewTable

func NewTable(updateHandler *Handler, expireHandler *Handler, pipeline *EnhancerPipeline) *Table

NewTable creates a new flow table

func (*Table) Query

func (ft *Table) Query(query *TableQuery) *TableReply

Query a flow table

func (*Table) Run

func (ft *Table) Run()

Run background jobs, like update/expire entries event

func (*Table) SetNodeTID

func (ft *Table) SetNodeTID(tid string)

SetNodeTID set the nodeTID of a flow table

func (*Table) Start

func (ft *Table) Start() chan *Packets

Start the flow table

func (*Table) Stop

func (ft *Table) Stop()

Stop the flow table

type TableAllocator

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

TableAllocator aims to create/allocate a new flow table

func NewTableAllocator

func NewTableAllocator(update, expire time.Duration, pipeline *EnhancerPipeline) *TableAllocator

NewTableAllocator creates a new flow table

func (*TableAllocator) Alloc

func (a *TableAllocator) Alloc(flowCallBack ExpireUpdateFunc) *Table

Alloc instanciate/allocate a new table

func (*TableAllocator) QueryTable

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

QueryTable search/query within the flow table

func (*TableAllocator) Release

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

Release release/destroy a flow table

type TableClient

type TableClient struct {
	shttp.DefaultWSServerEventHandler
	WSServer *shttp.WSServer
	// contains filtered or unexported fields
}

TableClient describes a mechanism to Query a flow table via flowSet in JSON

func NewTableClient

func NewTableClient(w *shttp.WSServer) *TableClient

NewTableClient creates a new table client based on websocket

func (*TableClient) LookupFlows

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

LookupFlows query flow table based on a filter search query

func (*TableClient) LookupFlowsByNodes

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

LookupFlowsByNodes query flow table based on multiple nodes

func (*TableClient) OnMessage

func (f *TableClient) OnMessage(c *shttp.WSClient, m shttp.WSMessage)

OnMessage event

type TableQuery

type TableQuery struct {
	Type string
	Obj  []byte
}

TableQuery contains a type and a query obj as an array of bytes. The query can be encoded in different ways according the type.

type TableReply

type TableReply struct {
	Obj [][]byte
	// contains filtered or unexported fields
}

TableReply is the response to a TableQuery containing a Status and an array of replies that can be encoded in many ways, ex: json, protobuf.

type TableServer

type TableServer struct {
	shttp.DefaultWSClientEventHandler
	WSAsyncClientPool *shttp.WSAsyncClientPool
	TableAllocator    *TableAllocator
}

TableServer describes a mechanism to Query a flow table via Websocket

func NewServer

func NewServer(allocator *TableAllocator, wspool *shttp.WSAsyncClientPool) *TableServer

NewServer creates a new flow table query server based on websocket

func (*TableServer) OnMessage

func (s *TableServer) OnMessage(c *shttp.WSAsyncClient, msg shttp.WSMessage)

OnMessage TableQuery

func (*TableServer) OnTableQuery

func (s *TableServer) OnTableQuery(c *shttp.WSAsyncClient, msg shttp.WSMessage)

OnTableQuery event

Directories

Path Synopsis
afpacket
Package afpacket provides Go bindings for MMap'd AF_PACKET socket reading.
Package afpacket provides Go bindings for MMap'd AF_PACKET socket reading.

Jump to

Keyboard shortcuts

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