gonetflow

package
v0.0.0-...-81ce8a9 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2022 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TCP                = 6
	UDP                = 17
	NETFLOW_HEADER_LEN = 24
	NETFLOW_RECORD_LEN = 48
	BUFFER_DEPTH       = 1024
	UDP_BUFFER_DEPTH   = 65536
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Header struct {
	Version   int
	Count     int
	Uptime    uint32
	EpochSec  uint32
	EpochNsec uint32
	Sequence  int32
}

func DecodeHeader

func DecodeHeader(b []byte) *Header

type Mode

type Mode int
const (
	RAW Mode = iota
	ASCII
)

func (Mode) String

func (m Mode) String() string

type Netflow

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

func NewNetflow

func NewNetflow() (*Netflow, int, error)

NewNetflow returns a netflow object listening on port Netflow.Port

func (*Netflow) GetPort

func (nf *Netflow) GetPort() int

func (*Netflow) GetStats

func (nf *Netflow) GetStats() string

func (*Netflow) HasWriter

func (nf *Netflow) HasWriter() bool

HasWriter returns true if we have any writers

func (*Netflow) NewFileWriter

func (nf *Netflow) NewFileWriter(filename string, mode Mode, compress bool) error

func (*Netflow) NewSocketWriter

func (nf *Netflow) NewSocketWriter(network string, server string, mode Mode) error

func (*Netflow) RemoveWriter

func (nf *Netflow) RemoveWriter(path string) error

func (*Netflow) Stop

func (nf *Netflow) Stop()

stop and exit the reader goroutine for this object

type Packet

type Packet struct {
	Header  *Header
	Records []*Record
	Raw     []byte
}

func (Packet) GoString

func (p Packet) GoString() string

type Record

type Record struct {
	Src        net.IP
	Dst        net.IP
	Nexthop    net.IP
	Input      uint
	Output     uint
	NumPackets uint32
	NumOctets  uint32
	First      uint32
	Last       uint32
	SrcPort    int
	DstPort    int
	Protocol   int
	ToS        int
	SrcAS      int
	DstAS      int
}

func DecodeRecord

func DecodeRecord(b []byte) *Record

Jump to

Keyboard shortcuts

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