tracker

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2020 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaxConnBuffer = 256
)

Variables

View Source
var (
	DefaultTracker = Tracker{
		Tick: 1 * time.Second,
		Config: &ebpf.Config{
			CollectTCPConns:              true,
			CollectUDPConns:              true,
			CollectIPv6Conns:             true,
			CollectLocalDNS:              false,
			DNSInspection:                false,
			UDPConnTimeout:               30 * time.Second,
			TCPConnTimeout:               2 * time.Minute,
			MaxTrackedConnections:        65536,
			ConntrackMaxStateSize:        65536,
			ProcRoot:                     "/proc",
			BPFDebug:                     false,
			EnableConntrack:              true,
			MaxClosedConnectionsBuffered: 50000,
			MaxConnectionsStateBuffered:  75000,
			ClientStateExpiry:            2 * time.Minute,
			ClosedChannelSize:            500,
		},

		NodeUpdateChan: make(chan NodeUpdate, MaxConnBuffer),
		ConnUpdateChan: make(chan ConnUpdate, MaxConnBuffer),
		// contains filtered or unexported fields
	}
)

Functions

func FormatCID

func FormatCID(cid ConnectionID) string

func IPPort

func IPPort(ip string, port uint16) string

Types

type ConnUpdate

type ConnUpdate struct {
	Connection ConnectionID
	Data       ExportData
}

Type to be piped through chan to collector for updates

type ConnectionID

type ConnectionID struct {
	DAddr string
	DPort uint16
	SAddr string
	SPort uint16
}

type ExportData

type ExportData struct {
	BytesSent          uint64
	BytesRecv          uint64
	BytesSentPerSecond uint64
	BytesRecvPerSecond uint64
	LastUpdated        time.Time
}

type NodeUpdate

type NodeUpdate struct {
	BytesSent          uint64
	BytesRecv          uint64
	BytesSentPerSecond uint64
	BytesRecvPerSecond uint64
	LastUpdated        time.Time

	NumConnections uint16
}

type Tracker

type Tracker struct {
	Tick time.Duration
	// time idle before considering connection inactive
	Timeout time.Duration
	Config  *ebpf.Config

	NodeUpdateChan chan NodeUpdate
	ConnUpdateChan chan ConnUpdate
	// contains filtered or unexported fields
}

func NewTracker

func NewTracker() *Tracker

func (*Tracker) GetBytesRecv

func (t *Tracker) GetBytesRecv() uint64

func (*Tracker) GetBytesRecvPerSecond

func (t *Tracker) GetBytesRecvPerSecond() uint64

func (*Tracker) GetBytesSent

func (t *Tracker) GetBytesSent() uint64

func (*Tracker) GetBytesSentPerSecond

func (t *Tracker) GetBytesSentPerSecond() uint64

func (*Tracker) GetConnectionData

func (t *Tracker) GetConnectionData() map[ConnectionID]ExportData

func (*Tracker) GetNumConnections

func (t *Tracker) GetNumConnections() uint16

func (*Tracker) GetTotalBytesRecv

func (t *Tracker) GetTotalBytesRecv() uint64

func (*Tracker) GetTotalBytesSent

func (t *Tracker) GetTotalBytesSent() uint64

func (*Tracker) ResetStats

func (t *Tracker) ResetStats() error

Clears the current internal tracking data.

func (*Tracker) StartTracker

func (t *Tracker) StartTracker()

func (*Tracker) Stop

func (t *Tracker) Stop()

Jump to

Keyboard shortcuts

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