utils

package
v0.0.0-...-32fe5de Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2020 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateRandomIP

func GenerateRandomIP(network net.IP, mask net.IPMask) net.IP

Types

type Flow7Tuple

type Flow7Tuple struct {
	SrcAddr, DstAddr                           net.IP
	SrcPort, DstPort                           uint16
	Protocol                                   uint8
	FlowStartMilliseconds, FlowEndMilliseconds uint64
	OctetCount, PacketCount                    uint64
}

type FlowExporter

type FlowExporter struct {
	FlowRecordsSent uint64
	// contains filtered or unexported fields
}

func NewFlowExporter

func NewFlowExporter(collectorIp net.IP, collectorPort int) *FlowExporter

func (*FlowExporter) CloseExporter

func (f *FlowExporter) CloseExporter()

func (*FlowExporter) GenerateFlowMessage

func (f *FlowExporter) GenerateFlowMessage(flow Flow7Tuple)

func (*FlowExporter) GetCurrentMessageSize

func (f *FlowExporter) GetCurrentMessageSize() int

func (*FlowExporter) SendDataSet

func (f *FlowExporter) SendDataSet()

type FlowProcessor

type FlowProcessor struct {
	FlowExporters []*FlowExporter
	Channel       chan Flow7Tuple
	Quit          chan bool
	EndWG         sync.WaitGroup
	BufferSize    int
}

func NewFlowProcessor

func NewFlowProcessor(generators []*FlowExporter, bufferSize int) *FlowProcessor

func (*FlowProcessor) PutFlow

func (fp *FlowProcessor) PutFlow(flow Flow7Tuple)

func (*FlowProcessor) Start

func (fp *FlowProcessor) Start()

func (*FlowProcessor) Stop

func (fp *FlowProcessor) Stop()

type FlowSimulator

type FlowSimulator struct {
	FlowProcessor              *FlowProcessor
	Ticker                     *time.Ticker
	Quit                       chan bool
	TickIntervalMilliseconds   int
	FlowsPerTick               int
	SampleFlow                 Flow7Tuple
	FlowRecordsCreated         uint64
	LatencyDistribution        distuv.Rander // probability distribution for how many milliseconds set the latency between request and response flows
	FlowDurationDistribution   distuv.Rander // probability distribution for how many milliseconds long the flows should be
	FlowTimeJitterDistribution distuv.Rander // probability distribution for how many milliseconds to jitter the flow by
}

func NewFlowSimulator

func NewFlowSimulator(flowProcessor *FlowProcessor, tickIntervalMilliseconds int, flowsPerTick int) *FlowSimulator

func (*FlowSimulator) CreateFlow

func (fs *FlowSimulator) CreateFlow() (Flow7Tuple, Flow7Tuple)

func (*FlowSimulator) Start

func (fs *FlowSimulator) Start()

func (*FlowSimulator) Stop

func (fs *FlowSimulator) Stop()

Jump to

Keyboard shortcuts

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