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) )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Connection ¶
type Connection struct {
Proto ipproto.Proto `json:"proto,omitzero"`
Src netip.AddrPort `json:"src,omitzero"`
Dst netip.AddrPort `json:"dst,omitzero"`
}
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"`
TxBytes uint64 `json:"txBytes,omitzero"`
RxPackets uint64 `json:"rxPkts,omitzero"`
RxBytes uint64 `json:"rxBytes,omitzero"`
}
Counts are statistics about a particular connection.
type CountsByConnection ¶ added in v1.90.0
type CountsByConnection struct {
// contains filtered or unexported fields
}
CountsByConnection is a count of packets and bytes for each connection. All methods are safe for concurrent calls.
func (*CountsByConnection) Add ¶ added in v1.90.0
func (c *CountsByConnection) Add(proto ipproto.Proto, src, dst netip.AddrPort, packets, bytes int, recv bool)
Add adds packets and bytes for the specified connection.
func (*CountsByConnection) Clone ¶ added in v1.90.0
func (c *CountsByConnection) Clone() map[Connection]Counts
Clone deep copies the map.
func (*CountsByConnection) Reset ¶ added in v1.90.0
func (c *CountsByConnection) Reset()
Reset clear the map.
type Message ¶
type Message struct {
NodeID tailcfg.StableNodeID `json:"nodeId"` // e.g., "n123456CNTRL"
Start time.Time `json:"start"` // inclusive
End time.Time `json:"end"` // inclusive
VirtualTraffic []ConnectionCounts `json:"virtualTraffic,omitempty"`
SubnetTraffic []ConnectionCounts `json:"subnetTraffic,omitempty"`
ExitTraffic []ConnectionCounts `json:"exitTraffic,omitempty"`
PhysicalTraffic []ConnectionCounts `json:"physicalTraffic,omitempty"`
}
Message is the log message that captures network traffic.
Click to show internal directories.
Click to hide internal directories.