Documentation
¶
Index ¶
- Constants
- Variables
- func HashFromValues(ab interface{}, ba interface{}) []byte
- type ExpireUpdateFunc
- type FlowHandler
- type FlowKey
- type FlowPacket
- type FlowPackets
- type GetAttr
- type InGRELayer
- type MergeContext
- type 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) SetNodeTID(tid 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)
- type TableAllocator
- type TableClient
- type TableQuery
- type TableReply
- type TableServer
Constants ¶
const (
Namespace = "Flow"
)
Variables ¶
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.
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 ¶
Types ¶
type ExpireUpdateFunc ¶
type ExpireUpdateFunc func(f []*Flow)
type FlowHandler ¶
type FlowHandler struct {
// contains filtered or unexported fields
}
func NewFlowHandler ¶
func NewFlowHandler(callback ExpireUpdateFunc, every time.Duration) *FlowHandler
type FlowPacket ¶ added in v0.9.0
type FlowPacket struct {
// contains filtered or unexported fields
}
type FlowPackets ¶ added in v0.9.0
type FlowPackets []FlowPacket
FlowPackets represents a suite of parent/child FlowPacket
func FlowPacketsFromGoPacket ¶ added in v0.9.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.9.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 InGRELayer ¶ added in v0.9.0
type InGRELayer struct {
StrangeHeader []byte
// contains filtered or unexported fields
}
func (InGRELayer) LayerContents ¶ added in v0.9.0
func (m InGRELayer) LayerContents() []byte
func (InGRELayer) LayerPayload ¶ added in v0.9.0
func (m InGRELayer) LayerPayload() []byte
func (InGRELayer) LayerType ¶ added in v0.9.0
func (m InGRELayer) LayerType() gopacket.LayerType
type MergeContext ¶ added in v0.9.0
type Table ¶
type Table struct {
sync.RWMutex
PacketsChan chan FlowPackets
// contains filtered or unexported fields
}
func NewTable ¶
func NewTable(updateHandler *FlowHandler, expireHandler *FlowHandler) *Table
func NewTableFromFlows ¶
func NewTableFromFlows(flows []*Flow, updateHandler *FlowHandler, expireHandler *FlowHandler) *Table
func (*Table) FilterLast ¶
Return a new flow.Table that contain <last> active flows
func (*Table) FlowPacketToFlow ¶ added in v0.9.0
func (ft *Table) FlowPacketToFlow(packet *FlowPacket, parentUUID string) *Flow
func (*Table) FlowPacketsToFlow ¶ added in v0.9.0
func (ft *Table) FlowPacketsToFlow(flowPackets FlowPackets)
func (*Table) Query ¶
func (ft *Table) Query(query *TableQuery) *TableReply
func (*Table) Start ¶
func (ft *Table) Start() chan FlowPackets
type TableAllocator ¶
func NewTableAllocator ¶
func NewTableAllocator(update, expire time.Duration) *TableAllocator
func (*TableAllocator) Alloc ¶
func (a *TableAllocator) Alloc(flowCallBack ExpireUpdateFunc) *Table
func (*TableAllocator) Flush ¶
func (a *TableAllocator) Flush()
func (*TableAllocator) QueryTable ¶
func (a *TableAllocator) QueryTable(query *TableQuery) *TableReply
func (*TableAllocator) Release ¶
func (a *TableAllocator) Release(t *Table)
type TableClient ¶
type TableClient struct {
shttp.DefaultWSServerEventHandler
WSServer *shttp.WSServer
// contains filtered or unexported fields
}
func NewTableClient ¶
func NewTableClient(w *shttp.WSServer) *TableClient
func (*TableClient) LookupFlows ¶
func (f *TableClient) LookupFlows(flowSearchQuery FlowSearchQuery) (*FlowSet, error)
func (*TableClient) LookupFlowsByNodes ¶
func (f *TableClient) LookupFlowsByNodes(hnmap topology.HostNodeTIDMap, flowSearchQuery FlowSearchQuery) (*FlowSet, error)
type TableQuery ¶
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
WSAsyncClient *shttp.WSAsyncClient
TableAllocator *TableAllocator
}
func NewServer ¶
func NewServer(allocator *TableAllocator, client *shttp.WSAsyncClient) *TableServer
func (*TableServer) OnMessage ¶
func (s *TableServer) OnMessage(msg shttp.WSMessage)
func (*TableServer) OnTableQuery ¶
func (s *TableServer) OnTableQuery(msg shttp.WSMessage)
Source Files
¶
- allocator.go
- client.go
- decoder.go
- filters.go
- flow.go
- hash.go
- server.go
- set.go
- table.go