netlogtype

package
v1.75.0-pre Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2024 License: BSD-3-Clause Imports: 4 Imported by: 18

Documentation

Overview

Package netlogtype defines types for network logging.

Index

Constants

View Source
const (

	// MaxMessageJSONSize is the overhead size of Message when it is
	// serialized as JSON assuming that each traffic map is populated.
	MaxMessageJSONSize = len(messageJSON)

	// MaxConnectionCountsJSONSize is the maximum size of a ConnectionCounts
	// when it is serialized as JSON, assuming no superfluous whitespace.
	// It does not include the trailing comma that often appears when
	// this object is nested within an array.
	// It assumes that netip.Addr never has IPv6 zones.
	MaxConnectionCountsJSONSize = len(maxJSONConnCounts)

	// MaxConnectionCountsCBORSize is the maximum size of a ConnectionCounts
	// when it is serialized as CBOR.
	// It assumes that netip.Addr never has IPv6 zones.
	MaxConnectionCountsCBORSize = len(maxCBORConnCounts)
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Connection

type Connection struct {
	Proto ipproto.Proto  `json:"proto,omitzero,omitempty" cbor:"0,keyasint,omitempty"`
	Src   netip.AddrPort `json:"src,omitzero,omitempty"   cbor:"1,keyasint,omitempty"`
	Dst   netip.AddrPort `json:"dst,omitzero,omitempty"   cbor:"2,keyasint,omitempty"`
}

Connection is a 5-tuple of proto, source and destination IP and port.

func (Connection) IsZero

func (c Connection) IsZero() bool

type ConnectionCounts

type ConnectionCounts struct {
	Connection
	Counts
}

ConnectionCounts is a flattened struct of both a connection and counts.

type Counts

type Counts struct {
	TxPackets uint64 `json:"txPkts,omitzero,omitempty"  cbor:"12,keyasint,omitempty"`
	TxBytes   uint64 `json:"txBytes,omitzero,omitempty" cbor:"13,keyasint,omitempty"`
	RxPackets uint64 `json:"rxPkts,omitzero,omitempty"  cbor:"14,keyasint,omitempty"`
	RxBytes   uint64 `json:"rxBytes,omitzero,omitempty" cbor:"15,keyasint,omitempty"`
}

Counts are statistics about a particular connection.

func (Counts) Add

func (c1 Counts) Add(c2 Counts) Counts

Add adds the counts from both c1 and c2.

func (Counts) IsZero

func (c Counts) IsZero() bool

type Message

type Message struct {
	NodeID tailcfg.StableNodeID `json:"nodeId" cbor:"0,keyasint"` // e.g., "n123456CNTRL"

	Start time.Time `json:"start" cbor:"12,keyasint"` // inclusive
	End   time.Time `json:"end"   cbor:"13,keyasint"` // inclusive

	VirtualTraffic  []ConnectionCounts `json:"virtualTraffic,omitempty"  cbor:"14,keyasint,omitempty"`
	SubnetTraffic   []ConnectionCounts `json:"subnetTraffic,omitempty"   cbor:"15,keyasint,omitempty"`
	ExitTraffic     []ConnectionCounts `json:"exitTraffic,omitempty"     cbor:"16,keyasint,omitempty"`
	PhysicalTraffic []ConnectionCounts `json:"physicalTraffic,omitempty" cbor:"17,keyasint,omitempty"`
}

Message is the log message that captures network traffic.

Jump to

Keyboard shortcuts

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