snapshot

package
v1.9.0 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2023 License: Apache-2.0 Imports: 11 Imported by: 2

Documentation

Overview

Package snapshot contains code to generate Snapshots from ArchiveRecords, and utilities to load them from files.

Index

Constants

This section is empty.

Variables

View Source
var ErrEmptyRecord = errors.New("Message should contain Metadata or RawIDM")

ErrEmptyRecord is returned if an ArchivalRecord is empty.

Functions

This section is empty.

Types

type ConnectionLog

type ConnectionLog struct {
	Metadata  netlink.Metadata
	Snapshots []Snapshot
}

ConnectionLog contains a Metadata and slice of Snapshots.

type Reader

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

Reader wraps an ArchiveReader to provide a Snapshot reader.

func NewReader

func NewReader(ar netlink.ArchiveReader) *Reader

NewReader wraps an ArchiveReader and provides Next()

func (Reader) Next

func (rdr Reader) Next() (*netlink.Metadata, *Snapshot, error)

Next reads, parses and returns the next Snapshot

type RouteAttrValue

type RouteAttrValue []byte

RouteAttrValue is the type of RouteAttr.Value

func (RouteAttrValue) CongestionAlgorithm

func (raw RouteAttrValue) CongestionAlgorithm() (string, bool)

CongestionAlgorithm returns the congestion algorithm string INET_DIAG_CONG

type Snapshot

type Snapshot struct {
	// Timestamp of batch of messages containing this message.
	Timestamp time.Time

	// Bit field indicating whether each message type was observed.
	Observed uint32

	// Bit field indicating whether any message type was NOT fully parsed.
	// TODO - populate this field if any message is ignored, or not fully parsed.
	NotFullyParsed uint32 `csv:",omitempty"`

	// Info from struct inet_diag_msg, including socket_id;
	InetDiagMsg *inetdiag.InetDiagMsg `csv:"-"`

	// From INET_DIAG_CONG message.
	CongestionAlgorithm string `csv:",omitempty"`

	// See https://tools.ietf.org/html/rfc3168
	// TODO Do we need to record whether these are present and zero, vs absent?
	TOS     uint8 `csv:",omitempty"`
	TClass  uint8 `csv:",omitempty"`
	ClassID uint8 `csv:",omitempty"`

	// TODO Do we need to record present and zero, vs absent?
	Shutdown uint8 `csv:",omitempty"`

	// From INET_DIAG_PROTOCOL message.
	// TODO Do we need to record present and zero, vs absent?
	Protocol inetdiag.Protocol `csv:",omitempty"`

	Mark uint32 `csv:",omitempty"`

	// TCPInfo contains data from struct tcp_info.
	TCPInfo *tcp.LinuxTCPInfo `csv:"-"`

	// Data obtained from INET_DIAG_MEMINFO.
	MemInfo *inetdiag.MemInfo `csv:"-"`

	// Data obtained from INET_DIAG_SKMEMINFO.
	SocketMem *inetdiag.SocketMemInfo `csv:"-"`

	VegasInfo *inetdiag.VegasInfo `csv:"-"`
	DCTCPInfo *inetdiag.DCTCPInfo `csv:"-"`
	BBRInfo   *inetdiag.BBRInfo   `csv:"-"`
}

Snapshot contains all info gathered through netlink library.

func Decode

Decode decodes a netlink.ArchivalRecord into a single Snapshot Initial ArchivalRecord may have just a Snapshot, just Metadata, or both.

func LoadAll

func LoadAll(ar netlink.ArchiveReader) (*netlink.Metadata, []*Snapshot, error)

LoadAll loads all snapshots from an ArchiveReader, and returns the metadata and slice of snapshots. Metadata may be nil, or the last non-nil metadata record.

Jump to

Keyboard shortcuts

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