flow

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2016 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Package flow is a generated protocol buffer package.

It is generated from these files:

flow/flow.proto

It has these top-level messages:

FlowEndpointStatistics
FlowEndpointsStatistics
FlowStatistics
Flow

Index

Constants

This section is empty.

Variables

View Source
var FlowEndpointLayer_name = map[int32]string{
	0: "LINK",
	1: "NETWORK",
	2: "TRANSPORT",
}
View Source
var FlowEndpointLayer_value = map[string]int32{
	"LINK":      0,
	"NETWORK":   1,
	"TRANSPORT": 2,
}
View Source
var FlowEndpointType_name = map[int32]string{
	0: "ETHERNET",
	1: "IPV4",
	2: "TCPPORT",
	3: "UDPPORT",
	4: "SCTPPORT",
}
View Source
var FlowEndpointType_value = map[string]int32{
	"ETHERNET": 0,
	"IPV4":     1,
	"TCPPORT":  2,
	"UDPPORT":  3,
	"SCTPPORT": 4,
}

Functions

func LayerFlow

func LayerFlow(l gopacket.Layer) gopacket.Flow

func Var8bin

func Var8bin(v []byte) []byte

Types

type ExpireUpdateFunc

type ExpireUpdateFunc func(f []*Flow)

type Flow

type Flow struct {
	UUID       string `protobuf:"bytes,1,opt,name=UUID" json:"UUID,omitempty"`
	LayersPath string `protobuf:"bytes,2,opt,name=LayersPath" json:"LayersPath,omitempty"`
	// Data Flow info
	Statistics *FlowStatistics `protobuf:"bytes,3,opt,name=Statistics" json:"Statistics,omitempty"`
	FlowUUID   string          `protobuf:"bytes,5,opt,name=FlowUUID" json:"FlowUUID,omitempty"`
	// Topology info
	ProbeGraphPath string `protobuf:"bytes,11,opt,name=ProbeGraphPath" json:"ProbeGraphPath,omitempty"`
	IfSrcGraphPath string `protobuf:"bytes,14,opt,name=IfSrcGraphPath" json:"IfSrcGraphPath,omitempty"`
	IfDstGraphPath string `protobuf:"bytes,19,opt,name=IfDstGraphPath" json:"IfDstGraphPath,omitempty"`
}

func FlowFromGoPacket

func FlowFromGoPacket(ft *FlowTable, packet *gopacket.Packet, setter FlowProbePathSetter) *Flow

func FlowsFromSFlowSample

func FlowsFromSFlowSample(ft *FlowTable, sample *layers.SFlowFlowSample, setter FlowProbePathSetter) []*Flow

func FromData

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

func GenerateTestFlows

func GenerateTestFlows(t *testing.T, ft *FlowTable, baseSeed int64, probePath string) []*Flow

func GenerateTestFlowsSymmetric

func GenerateTestFlowsSymmetric(t *testing.T, ft *FlowTable, baseSeed int64, probePath string) []*Flow

func (*Flow) Descriptor

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

func (*Flow) GetData

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

func (*Flow) GetStatistics

func (m *Flow) GetStatistics() *FlowStatistics

func (*Flow) ProtoMessage

func (*Flow) ProtoMessage()

func (*Flow) Reset

func (m *Flow) Reset()

func (*Flow) String

func (m *Flow) String() string

type FlowEndpointLayer

type FlowEndpointLayer int32
const (
	FlowEndpointLayer_LINK      FlowEndpointLayer = 0
	FlowEndpointLayer_NETWORK   FlowEndpointLayer = 1
	FlowEndpointLayer_TRANSPORT FlowEndpointLayer = 2
)

func (FlowEndpointLayer) EnumDescriptor

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

func (FlowEndpointLayer) String

func (x FlowEndpointLayer) String() string

type FlowEndpointStatistics

type FlowEndpointStatistics struct {
	Value   string `protobuf:"bytes,2,opt,name=Value" json:"Value,omitempty"`
	Packets uint64 `protobuf:"varint,5,opt,name=Packets" json:"Packets,omitempty"`
	Bytes   uint64 `protobuf:"varint,6,opt,name=Bytes" json:"Bytes,omitempty"`
}

func (*FlowEndpointStatistics) Descriptor

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

func (*FlowEndpointStatistics) ProtoMessage

func (*FlowEndpointStatistics) ProtoMessage()

func (*FlowEndpointStatistics) Reset

func (m *FlowEndpointStatistics) Reset()

func (*FlowEndpointStatistics) String

func (m *FlowEndpointStatistics) String() string

type FlowEndpointType

type FlowEndpointType int32
const (
	FlowEndpointType_ETHERNET FlowEndpointType = 0
	FlowEndpointType_IPV4     FlowEndpointType = 1
	FlowEndpointType_TCPPORT  FlowEndpointType = 2
	FlowEndpointType_UDPPORT  FlowEndpointType = 3
	FlowEndpointType_SCTPPORT FlowEndpointType = 4
)

func (FlowEndpointType) EnumDescriptor

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

func (FlowEndpointType) String

func (x FlowEndpointType) String() string

func (FlowEndpointType) Value

func (x FlowEndpointType) Value() int32

type FlowEndpointsStatistics

type FlowEndpointsStatistics struct {
	Type FlowEndpointType        `protobuf:"varint,1,opt,name=Type,enum=flow.FlowEndpointType" json:"Type,omitempty"`
	Hash []byte                  `protobuf:"bytes,2,opt,name=Hash,proto3" json:"Hash,omitempty"`
	AB   *FlowEndpointStatistics `protobuf:"bytes,3,opt,name=AB" json:"AB,omitempty"`
	BA   *FlowEndpointStatistics `protobuf:"bytes,4,opt,name=BA" json:"BA,omitempty"`
}

func (*FlowEndpointsStatistics) Descriptor

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

func (*FlowEndpointsStatistics) GetAB

func (*FlowEndpointsStatistics) GetBA

func (*FlowEndpointsStatistics) MarshalJSON

func (s *FlowEndpointsStatistics) MarshalJSON() ([]byte, error)

func (*FlowEndpointsStatistics) ProtoMessage

func (*FlowEndpointsStatistics) ProtoMessage()

func (*FlowEndpointsStatistics) Reset

func (m *FlowEndpointsStatistics) Reset()

func (*FlowEndpointsStatistics) String

func (m *FlowEndpointsStatistics) String() string

func (*FlowEndpointsStatistics) UnmarshalJSON

func (s *FlowEndpointsStatistics) UnmarshalJSON(b []byte) error

type FlowKey

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

func NewFlowKeyFromGoPacket

func NewFlowKeyFromGoPacket(p *gopacket.Packet) *FlowKey

func (FlowKey) String

func (key FlowKey) String() string

type FlowProbePathSetter

type FlowProbePathSetter interface {
	SetProbePath(flow *Flow) bool
}

type FlowStatistics

type FlowStatistics struct {
	Start     int64                      `protobuf:"varint,1,opt,name=Start" json:"Start,omitempty"`
	Last      int64                      `protobuf:"varint,2,opt,name=Last" json:"Last,omitempty"`
	Endpoints []*FlowEndpointsStatistics `protobuf:"bytes,3,rep,name=Endpoints" json:"Endpoints,omitempty"`
}

func NewFlowStatistics

func NewFlowStatistics(packet *gopacket.Packet) *FlowStatistics

func (*FlowStatistics) Descriptor

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

func (*FlowStatistics) DumpInfo

func (fs *FlowStatistics) DumpInfo(layerSeparator ...string) string

func (*FlowStatistics) GetEndpoints

func (m *FlowStatistics) GetEndpoints() []*FlowEndpointsStatistics

func (*FlowStatistics) GetEndpointsType

func (fs *FlowStatistics) GetEndpointsType(eptype FlowEndpointType) *FlowEndpointsStatistics

func (*FlowStatistics) ProtoMessage

func (*FlowStatistics) ProtoMessage()

func (*FlowStatistics) Reset

func (m *FlowStatistics) Reset()

func (*FlowStatistics) String

func (m *FlowStatistics) String() string

func (*FlowStatistics) Update

func (fs *FlowStatistics) Update(packet *gopacket.Packet)

type FlowTable

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

func NewFlowTable

func NewFlowTable() *FlowTable

func NewFlowTableComplex

func NewFlowTableComplex(t *testing.T) *FlowTable

func NewFlowTableFromFlows

func NewFlowTableFromFlows(flows []*Flow) *FlowTable

func NewTestFlowTableSimple

func NewTestFlowTableSimple(t *testing.T) *FlowTable

func (*FlowTable) Expire

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

* Following function are FlowTable manager helpers

func (*FlowTable) ExpireNow

func (ft *FlowTable) ExpireNow()

func (*FlowTable) FilterLast

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

Return a new FlowTable that contain <last> active flows

func (*FlowTable) GetExpireTicker

func (ft *FlowTable) GetExpireTicker() <-chan time.Time

func (*FlowTable) GetFlow

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

func (*FlowTable) GetFlows

func (ft *FlowTable) GetFlows() []*Flow

func (*FlowTable) GetOrCreateFlow

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

func (*FlowTable) GetUpdatedTicker

func (ft *FlowTable) GetUpdatedTicker() <-chan time.Time

func (*FlowTable) LookupFlowsByProbePath

func (ft *FlowTable) LookupFlowsByProbePath(p string) []*Flow

func (*FlowTable) RegisterExpire

func (ft *FlowTable) RegisterExpire(fn ExpireUpdateFunc, every time.Duration)

Asynchrnously Register an expire callback fn with last updated flow 'since', each 'since' tick

func (*FlowTable) RegisterUpdated

func (ft *FlowTable) RegisterUpdated(fn ExpireUpdateFunc, since time.Duration)

Asynchrnously call the callback fn with last updated flow 'since', each 'since' tick

func (*FlowTable) SelectLayer

func (ft *FlowTable) SelectLayer(endpointType FlowEndpointType, list []string) []*Flow

func (*FlowTable) String

func (ft *FlowTable) String() string

func (*FlowTable) UnregisterAll

func (ft *FlowTable) UnregisterAll()

func (*FlowTable) Update

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

func (*FlowTable) Updated

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

type FlowTableManager

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

type FlowTableManagerAsync

type FlowTableManagerAsync struct {
	FlowTableManagerAsyncParam
	// contains filtered or unexported fields
}

func (*FlowTableManagerAsync) Register

func (*FlowTableManagerAsync) Unregister

func (ftma *FlowTableManagerAsync) Unregister()

type FlowTableManagerAsyncFunction

type FlowTableManagerAsyncFunction func(fn ExpireUpdateFunc, updateFrom int64)

type FlowTableManagerAsyncParam

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

type ProtocolType

type ProtocolType int
const (
	ETH ProtocolType = 1 + iota
	IPv4
	IPv6
	TCP
	UDP
)

Source Files

  • flow.go
  • flow.pb.go
  • manager.go
  • statistics.go
  • table.go
  • testhelper.go

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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