vxcap

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2019 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultAwsS3FlushCount is limit of data buffer for S3 emitter.
	DefaultAwsS3FlushCount = 4096
	// DefaultAwsS3FlushInterval is seconds of interval to flush data for S3 emitter
	DefaultAwsS3FlushInterval = 300

	// DefaultAwsFirehoseFlushSize is threshold of flush to firehose.
	DefaultAwsFirehoseFlushSize = 2 * 1024 * 1024 // 2MB
	// DefaultAwsFIrehoseFlushInterval is seconds of interval to flush data for Firehose emitter
	DefaultAwsFIrehoseFlushInterval = 300
)
View Source
const (
	// DefaultReceiverQueueSize is default queue size of channel from UDP server to packet processor.
	DefaultReceiverQueueSize = 1024
	// DefaultVxlanPort is port number of UDP server to receive VXLAN datagram.
	DefaultVxlanPort = 4789
)

Variables

View Source
var Logger = logrus.New()

Logger is logging interface of the pacakge. Basically It's disabled by default. But it can be enabled by changing log level via SetLevel() for debugging.

Functions

This section is empty.

Types

type DumperArguments

type DumperArguments struct {
	Format string
	Target string // packet or session

	EnableJSONTextPayload bool
	EnableJSONRawPayload  bool
}

DumperArguments is arguments for constructor of dumper.

type EmitterArguments

type EmitterArguments struct {
	Name string

	// For fsEmitter
	FsFileName   string
	FsDirPath    string
	FsRotateSize int

	// For aws service
	AwsRegion string

	// For s3Emitter
	AwsS3Bucket        string
	AwsS3Prefix        string
	AwsS3AddTimeKey    bool
	AwsS3FlushCount    int
	AwsS3FlushInterval int

	// For firehoseEmitter
	AwsFirehoseName          string
	AwsFirehoseFlushSize     int
	AwsFirehoseFlushInterval int
	// contains filtered or unexported fields
}

EmitterArguments is for construction of emitter

type PacketProcessor

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

PacketProcessor controls both of dumper (log enconder) and emitter (log forwarder). And it works as interface of log processing by Put() function.

func NewPacketProcessor

func NewPacketProcessor(args PacketProcessorArgument) (*PacketProcessor, error)

NewPacketProcessor is constructor of PacketProcessor. Not only creating instance but also setting up emitter and dumper.

func (*PacketProcessor) Put

func (x *PacketProcessor) Put(pkt *packetData) error

Put method input a packet to emitter.

func (*PacketProcessor) Setup

func (x *PacketProcessor) Setup() error

Setup must be invoked before calling Put()

func (*PacketProcessor) Shutdown

func (x *PacketProcessor) Shutdown() error

Shutdown starts closing process of emitter.

func (*PacketProcessor) Tick

func (x *PacketProcessor) Tick(now time.Time) error

Tick involves timer handler to manage timeout process.

type PacketProcessorArgument

type PacketProcessorArgument struct {
	DumperArgs  DumperArguments
	EmitterArgs EmitterArguments
}

PacketProcessorArgument is argument to construct new PacketProcessor

type Processor

type Processor interface {
	Setup() error
	Put(pkt *packetData) error
	Tick(now time.Time) error
	Shutdown() error
}

Processor is interface of packet processing main feature.

type VXCap

type VXCap struct {
	RecvPort  int
	QueueSize int
}

VXCap is one of main components of the package

func New

func New() *VXCap

New is constructor of VXCap

func (*VXCap) Start

func (x *VXCap) Start(proc Processor) error

Start invokes UDP listener for VXLAN and forward captured packets to processor.

Jump to

Keyboard shortcuts

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