Documentation
¶
Index ¶
- Constants
- Variables
- func BPFFilterToRaw(linkType layers.LinkType, captureLength uint32, filter string) ([]bpf.RawInstruction, error)
- func HashFromValues(ab interface{}, ba interface{}) []byte
- func NewFilterForFlowSet(flowset *FlowSet) *filters.Filter
- func NewFilterForNodeTIDs(uuids []string) *filters.Filter
- func NewFilterForNodes(nodes []*graph.Node) *filters.Filter
- type BPF
- type ExpireUpdateFunc
- type FlowEnhancer
- type FlowEnhancerPipeline
- type FlowHandler
- type FlowKey
- type FlowPacket
- type FlowPackets
- type GetAttr
- type InGRELayer
- type MergeContext
- type PcapWriter
- type Table
- type TableAllocator
- type TableClient
- type TableQuery
- type TableReply
- type TableServer
Constants ¶
const (
CaptureLength uint32 = 256
)
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 ¶
func BPFFilterToRaw ¶ added in v0.10.0
func NewFilterForFlowSet ¶ added in v0.10.0
func NewFilterForNodeTIDs ¶ added in v0.10.0
Types ¶
type BPF ¶ added in v0.10.0
type BPF struct {
// contains filtered or unexported fields
}
func NewBPF ¶ added in v0.10.0
type ExpireUpdateFunc ¶ added in v0.3.0
type ExpireUpdateFunc func(f []*Flow)
type FlowEnhancer ¶ added in v0.10.0
type FlowEnhancer interface {
Enhance(flow *Flow)
}
type FlowEnhancerPipeline ¶ added in v0.10.0
type FlowEnhancerPipeline struct {
Enhancers []FlowEnhancer
}
func NewFlowEnhancerPipeline ¶ added in v0.10.0
func NewFlowEnhancerPipeline(enhancers ...FlowEnhancer) *FlowEnhancerPipeline
func (*FlowEnhancerPipeline) AddEnhancer ¶ added in v0.10.0
func (fe *FlowEnhancerPipeline) AddEnhancer(e FlowEnhancer)
func (*FlowEnhancerPipeline) Enhance ¶ added in v0.10.0
func (fe *FlowEnhancerPipeline) Enhance(flows []*Flow)
func (*FlowEnhancerPipeline) EnhanceFlow ¶ added in v0.10.0
func (fe *FlowEnhancerPipeline) EnhanceFlow(flow *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 struct {
Packets []FlowPacket
Timestamp int64
}
FlowPackets represents a suite of parent/child FlowPacket
func FlowPacketsFromGoPacket ¶ added in v0.8.0
func FlowPacketsFromGoPacket(packet *gopacket.Packet, outerLength int64, t int64, bpf *BPF) *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, t int64, bpf *BPF) []*FlowPackets
FlowPacketsFromSFlowSample returns an array of FlowPackets as a sample contains mutlple records which generate a FlowPackets each.
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 PcapWriter ¶ added in v0.10.0
func NewPcapWriter ¶ added in v0.10.0
func NewPcapWriter(r io.ReadCloser, packetsChan chan *FlowPackets, replay bool, bpfFilter string) (*PcapWriter, error)
func (*PcapWriter) FeedFlowTable ¶ added in v0.10.0
func (p *PcapWriter) FeedFlowTable()
func (*PcapWriter) Start ¶ added in v0.10.0
func (p *PcapWriter) Start()
func (*PcapWriter) Stop ¶ added in v0.10.0
func (p *PcapWriter) Stop()
type Table ¶ added in v0.4.0
type Table struct {
PacketsChan chan *FlowPackets
// contains filtered or unexported fields
}
func NewTable ¶ added in v0.4.0
func NewTable(updateHandler *FlowHandler, expireHandler *FlowHandler, pipeline *FlowEnhancerPipeline) *Table
func (*Table) Query ¶ added in v0.4.0
func (ft *Table) Query(query *TableQuery) *TableReply
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, pipeline *FlowEnhancerPipeline) *TableAllocator
func (*TableAllocator) Alloc ¶ added in v0.4.0
func (a *TableAllocator) Alloc(flowCallBack ExpireUpdateFunc) *Table
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 filters.SearchQuery) (*FlowSet, error)
func (*TableClient) LookupFlowsByNodes ¶ added in v0.4.0
func (f *TableClient) LookupFlowsByNodes(hnmap topology.HostNodeTIDMap, flowSearchQuery filters.SearchQuery) (*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
WSAsyncClientPool *shttp.WSAsyncClientPool
TableAllocator *TableAllocator
}
func NewServer ¶ added in v0.4.0
func NewServer(allocator *TableAllocator, wspool *shttp.WSAsyncClientPool) *TableServer
func (*TableServer) OnMessage ¶ added in v0.4.0
func (s *TableServer) OnMessage(c *shttp.WSAsyncClient, msg shttp.WSMessage)
func (*TableServer) OnTableQuery ¶ added in v0.5.0
func (s *TableServer) OnTableQuery(c *shttp.WSAsyncClient, msg shttp.WSMessage)
Source Files
¶
- allocator.go
- bpf.go
- client.go
- decoder.go
- filters.go
- flow.go
- hash.go
- metrics.go
- pcap.go
- pipeline.go
- server.go
- set.go
- table.go