Documentation ¶
Index ¶
- Constants
- Variables
- func HashFromValues(ab interface{}, ba interface{}) []byte
- type ExpireUpdateFunc
- type FlowHandler
- type FlowKey
- type FlowPacket
- type FlowPackets
- type FlowSetBandwidth
- type GetAttr
- type InGRELayer
- type MergeContext
- type ProtocolType
- type Table
- func NewTable(updateHandler *FlowHandler, expireHandler *FlowHandler) *Table
- func NewTableFromFlows(flows []*Flow, updateHandler *FlowHandler, expireHandler *FlowHandler) *Table
- func NewTestFlowTableComplex(t *testing.T, updateHandler *FlowHandler, expireHandler *FlowHandler) *Table
- func NewTestFlowTableSimple(t *testing.T) *Table
- func (ft *Table) Expire(now time.Time)
- func (ft *Table) FilterLast(last time.Duration) []*Flow
- func (ft *Table) FlowPacketToFlow(packet *FlowPacket, parentUUID string) *Flow
- func (ft *Table) FlowPacketsToFlow(flowPackets FlowPackets)
- func (ft *Table) Flush()
- func (ft *Table) GetFlow(key string) *Flow
- func (ft *Table) GetFlows(query *FlowSearchQuery) *FlowSet
- func (ft *Table) GetOrCreateFlow(key string) (*Flow, bool)
- func (ft *Table) GetTime() int64
- func (ft *Table) Query(query *TableQuery) *TableReply
- func (ft *Table) Run()
- func (ft *Table) SetNodeUUID(uuid string)
- func (ft *Table) Start() chan FlowPackets
- func (ft *Table) Stop()
- func (ft *Table) String() string
- func (ft *Table) Update(flows []*Flow)
- func (ft *Table) Updated(now time.Time)
- func (ft *Table) Window(start, end int64) *FlowSet
- type TableAllocator
- type TableClient
- type TableQuery
- type TableReply
- type TableServer
Constants ¶
const (
Namespace = "Flow"
)
Variables ¶
var ErrFieldNotFound = errors.New("Flow field not found")
var ErrFlowProtocol = errors.New("FlowProtocol invalid")
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.
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 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 FlowSetBandwidth ¶ added in v0.4.0
type FlowSetBandwidth struct { ABpackets int64 ABbytes int64 BApackets int64 BAbytes int64 Duration int64 NBFlow uint64 }
func (FlowSetBandwidth) String ¶ added in v0.4.0
func (fsbw FlowSetBandwidth) String() string
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 ProtocolType ¶ added in v0.3.0
type ProtocolType int
const ( ETH ProtocolType = 1 + iota IPv4 IPv6 TCP UDP SCTP UDP_MPLS GRE MPLS )
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 NewTestFlowTableComplex ¶ added in v0.4.0
func NewTestFlowTableComplex(t *testing.T, updateHandler *FlowHandler, expireHandler *FlowHandler) *Table
func NewTestFlowTableSimple ¶ added in v0.3.0
func (*Table) FilterLast ¶ added in v0.4.0
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) GetOrCreateFlow ¶ added in v0.4.0
func (*Table) Query ¶ added in v0.4.0
func (ft *Table) Query(query *TableQuery) *TableReply
func (*Table) SetNodeUUID ¶ added in v0.8.0
func (*Table) Start ¶ added in v0.4.0
func (ft *Table) Start() chan FlowPackets
type TableAllocator ¶ added in v0.4.0
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 graph.HostNodeIDMap, flowSearchQuery FlowSearchQuery) (*FlowSet, error)
type TableQuery ¶ added in v0.4.0
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)