linuxutil

package
v0.0.23 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2025 License: MIT Imports: 23 Imported by: 0

Documentation

Overview

Copyright (c) Microsoft Corporation. Licensed under the MIT license.

Package linuxutil contains the Retina linuxutil plugin. It gathers TCP/UDP statistics and network interface statistics from the netstats and ethtool node utilities (respectively).

Package linuxutil is a generated GoMock package.

Copyright (c) Microsoft Corporation. Licensed under the MIT license.

Copyright (c) Microsoft Corporation. Licensed under the MIT license.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(cfg *kcfg.Config) registry.Plugin

New creates a linuxutil plugin.

Types

type CachedEthtool added in v0.0.16

type CachedEthtool struct {
	EthtoolInterface
	// contains filtered or unexported fields
}

func NewCachedEthtool added in v0.0.16

func NewCachedEthtool(ethHandle EthtoolInterface, opts *EthtoolOpts) *CachedEthtool

func (*CachedEthtool) Stats added in v0.0.16

func (ce *CachedEthtool) Stats(intf string) (map[string]uint64, error)

type ConnectionStats

type ConnectionStats struct {
	// https://github.com/ecki/net-tools/blob/master/statistics.c#L206
	TcpExt   map[string]uint64 `json:"tcp_ext"`
	IpExt    map[string]uint64 `json:"ip_ext"`
	MPTcpExt map[string]uint64 `json:"mptcp_ext"`
	// Socket stats
	UdpSockets SocketStats `json:"udp_sockets"`
	TcpSockets SocketStats `json:"tcp_sockets"`
}

type EthtoolInterface

type EthtoolInterface interface {
	Stats(intf string) (map[string]uint64, error)
	Close()
}

type EthtoolOpts

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

type EthtoolReader

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

func NewEthtoolReader

func NewEthtoolReader(opts *EthtoolOpts, ethHandle EthtoolInterface) *EthtoolReader

type EthtoolStats

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

type IfaceStats

type IfaceStats struct {
	Name string
	// Inbound stats
	RxBytes      uint64
	RxPackets    uint64
	RxErrs       uint64
	RxDrop       uint64
	RxFIFO       uint64
	RxFrame      uint64
	RxCompressed uint64
	RxMulticast  uint64
	// Outbound stats
	TxBytes      uint64
	TxPackets    uint64
	TxErrs       uint64
	TxDrop       uint64
	TxFIFO       uint64
	TxColls      uint64
	TxCarrier    uint64
	TxCompressed uint64
}

type MockEthtoolInterface

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

MockEthtoolInterface is a mock of EthtoolInterface interface.

func NewMockEthtoolInterface

func NewMockEthtoolInterface(ctrl *gomock.Controller) *MockEthtoolInterface

NewMockEthtoolInterface creates a new mock instance.

func (*MockEthtoolInterface) Close

func (m *MockEthtoolInterface) Close()

Close mocks base method.

func (*MockEthtoolInterface) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockEthtoolInterface) Stats

func (m *MockEthtoolInterface) Stats(intf string) (map[string]uint64, error)

Stats mocks base method.

type MockEthtoolInterfaceMockRecorder

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

MockEthtoolInterfaceMockRecorder is the mock recorder for MockEthtoolInterface.

func (*MockEthtoolInterfaceMockRecorder) Close

Close indicates an expected call of Close.

func (*MockEthtoolInterfaceMockRecorder) Stats

Stats indicates an expected call of Stats.

type MockNetstatInterface

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

MockNetstatInterface is a mock of NetstatInterface interface.

func NewMockNetstatInterface

func NewMockNetstatInterface(ctrl *gomock.Controller) *MockNetstatInterface

NewMockNetstatInterface creates a new mock instance.

func (*MockNetstatInterface) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockNetstatInterface) TCPSocks

TCPSocks mocks base method.

func (*MockNetstatInterface) UDPSocks

UDPSocks mocks base method.

type MockNetstatInterfaceMockRecorder

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

MockNetstatInterfaceMockRecorder is the mock recorder for MockNetstatInterface.

func (*MockNetstatInterfaceMockRecorder) TCPSocks

func (mr *MockNetstatInterfaceMockRecorder) TCPSocks(accept any) *gomock.Call

TCPSocks indicates an expected call of TCPSocks.

func (*MockNetstatInterfaceMockRecorder) UDPSocks

func (mr *MockNetstatInterfaceMockRecorder) UDPSocks(accept any) *gomock.Call

UDPSocks indicates an expected call of UDPSocks.

type Netstat

type Netstat struct{}

func (*Netstat) TCPSocks

func (n *Netstat) TCPSocks(accept netstat.AcceptFn) ([]netstat.SockTabEntry, error)

func (*Netstat) UDPSocks

func (n *Netstat) UDPSocks(accept netstat.AcceptFn) ([]netstat.SockTabEntry, error)

type NetstatInterface

type NetstatInterface interface {
	UDPSocks(accept netstat.AcceptFn) ([]netstat.SockTabEntry, error)
	TCPSocks(accept netstat.AcceptFn) ([]netstat.SockTabEntry, error)
}

type NetstatOpts

type NetstatOpts struct {
	// when true only includes curated list of keys
	CuratedKeys bool

	// when true will include all keys with value 0
	AddZeroVal bool

	// get only listening sockets
	ListenSock bool

	// previous TCP socket stats
	PrevTCPSockStats *SocketStats
}

type NetstatReader

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

func NewNetstatReader

func NewNetstatReader(opts *NetstatOpts, ns NetstatInterface) *NetstatReader

type SocketStats

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

Jump to

Keyboard shortcuts

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