flow

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2017 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Namespace = "Flow"
)

Variables

View Source
var ErrFieldNotFound = errors.New("Flow field not found")
View Source
var ErrFlowProtocol = errors.New("FlowProtocol invalid")
View Source
var LayerTypeInGRE = gopacket.RegisterLayerType(55555, gopacket.LayerTypeMetadata{Name: "LayerTypeInGRE", Decoder: gopacket.DecodeFunc(decodeInGRELayer)})

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

View Source
var LayerTypeInMplsEthOrIp = gopacket.RegisterLayerType(55556, gopacket.LayerTypeMetadata{Name: "LayerTypeInMplsEthOrIp", Decoder: gopacket.DecodeFunc(decodeInMplsEthOrIpLayer)})

Try to find if the next layer is IPv4, or IPv6. If it fails, it considers it is Ethernet.

Functions

func HashFromValues added in v0.4.0

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

Types

type ExpireUpdateFunc added in v0.3.0

type ExpireUpdateFunc func(f []*Flow)

type FlowHandler added in v0.4.0

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

func NewFlowHandler added in v0.4.0

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

type FlowKey

type FlowKey string

func FlowKeyFromGoPacket added in v0.4.0

func FlowKeyFromGoPacket(p *gopacket.Packet, parentUUID string) FlowKey

func (FlowKey) String

func (f FlowKey) String() string

type FlowPacket added in v0.8.0

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

type FlowPackets added in v0.8.0

type FlowPackets []FlowPacket

FlowPackets represents a suite of parent/child FlowPacket

func FlowPacketsFromGoPacket added in v0.8.0

func FlowPacketsFromGoPacket(packet *gopacket.Packet, outerLength int64) FlowPackets

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

func FlowPacketsFromSFlowSample added in v0.8.0

func FlowPacketsFromSFlowSample(sample *layers.SFlowFlowSample) []FlowPackets

FlowPacketsFromSFlowSample returns an array of FlowPackets as a sample contains mutlple records which generate a FlowPackets each.

type GetAttr added in v0.5.0

type GetAttr interface {
	GetAttr(name string) interface{}
}

type InGRELayer added in v0.8.0

type InGRELayer struct {
	StrangeHeader []byte
	// contains filtered or unexported fields
}

func (InGRELayer) LayerContents added in v0.8.0

func (m InGRELayer) LayerContents() []byte

func (InGRELayer) LayerPayload added in v0.8.0

func (m InGRELayer) LayerPayload() []byte

func (InGRELayer) LayerType added in v0.8.0

func (m InGRELayer) LayerType() gopacket.LayerType

type MergeContext added in v0.7.0

type MergeContext struct {
	Sort    bool
	SortBy  string
	Dedup   bool
	DedupBy string
}

type Table added in v0.4.0

type Table struct {
	sync.RWMutex
	PacketsChan chan FlowPackets
	// contains filtered or unexported fields
}

func NewTable added in v0.4.0

func NewTable(updateHandler *FlowHandler, expireHandler *FlowHandler) *Table

func NewTableFromFlows added in v0.4.0

func NewTableFromFlows(flows []*Flow, updateHandler *FlowHandler, expireHandler *FlowHandler) *Table

func (*Table) Expire added in v0.4.0

func (ft *Table) Expire(now time.Time)

func (*Table) FilterLast added in v0.4.0

func (ft *Table) FilterLast(last time.Duration) []*Flow

Return a new flow.Table that contain <last> active flows

func (*Table) FlowPacketToFlow added in v0.8.0

func (ft *Table) FlowPacketToFlow(packet *FlowPacket, parentUUID string) *Flow

func (*Table) FlowPacketsToFlow added in v0.8.0

func (ft *Table) FlowPacketsToFlow(flowPackets FlowPackets)

func (*Table) Flush added in v0.4.0

func (ft *Table) Flush()

func (*Table) GetFlow added in v0.4.0

func (ft *Table) GetFlow(key string) *Flow

func (*Table) GetFlows added in v0.4.0

func (ft *Table) GetFlows(query *FlowSearchQuery) *FlowSet

func (*Table) GetOrCreateFlow added in v0.4.0

func (ft *Table) GetOrCreateFlow(key string) (*Flow, bool)

func (*Table) GetTime added in v0.4.0

func (ft *Table) GetTime() int64

func (*Table) Query added in v0.4.0

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

func (*Table) Run added in v0.7.0

func (ft *Table) Run()

func (*Table) SetNodeTID added in v0.9.0

func (ft *Table) SetNodeTID(tid string)

func (*Table) Start added in v0.4.0

func (ft *Table) Start() chan FlowPackets

func (*Table) Stop added in v0.4.0

func (ft *Table) Stop()

func (*Table) String added in v0.4.0

func (ft *Table) String() string

func (*Table) Update added in v0.4.0

func (ft *Table) Update(flows []*Flow)

func (*Table) Updated added in v0.4.0

func (ft *Table) Updated(now time.Time)

type TableAllocator added in v0.4.0

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

func NewTableAllocator added in v0.4.0

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

func (*TableAllocator) Alloc added in v0.4.0

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

func (*TableAllocator) Flush added in v0.4.0

func (a *TableAllocator) Flush()

func (*TableAllocator) QueryTable added in v0.4.0

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

func (*TableAllocator) Release added in v0.4.0

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

type TableClient added in v0.4.0

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

func NewTableClient added in v0.4.0

func NewTableClient(w *shttp.WSServer) *TableClient

func (*TableClient) LookupFlows added in v0.5.0

func (f *TableClient) LookupFlows(flowSearchQuery FlowSearchQuery) (*FlowSet, error)

func (*TableClient) LookupFlowsByNodes added in v0.4.0

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

func (*TableClient) OnMessage added in v0.4.0

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

type TableQuery added in v0.4.0

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 added in v0.4.0

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 added in v0.4.0

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

func NewServer added in v0.4.0

func NewServer(allocator *TableAllocator, client *shttp.WSAsyncClient) *TableServer

func (*TableServer) OnMessage added in v0.4.0

func (s *TableServer) OnMessage(msg shttp.WSMessage)

func (*TableServer) OnTableQuery added in v0.5.0

func (s *TableServer) OnTableQuery(msg shttp.WSMessage)

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