network

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2024 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Metric

type Metric struct {
	Enabled    bool     `config:"enabled"`
	Summary    bool     `config:"summary"`
	Sockets    bool     `config:"sockets"`
	Throughput bool     `config:"throughput"`
	Detail     bool     `config:"details"`
	Interfaces []string `config:"interfaces"`
	// contains filtered or unexported fields
}

func New

func New(cfg *config.Config) (*Metric, error)

func (*Metric) Collect

func (m *Metric) Collect() error

type Resolver

type Resolver interface {
	// ResolveHostFS Resolves a path based on a user-set HostFS flag, in cases where a user wants to monitor an alternate filesystem root
	// If no user root has been set, it will return the input string
	ResolveHostFS(string) string
	// IsSet returns true if the user has set an alternate filesystem root
	IsSet() bool
	// Join emulates the behavior of filepath.join
	Join(...string) string
}

Resolver is an interface for HostFS resolvers. This is meant to be generic and (hopefully) future-proof way of dealing with a user-supplied root filesystem path. A resolver-style function serves two ends: 1) if we attempt to stop consumers from merely "saving off" a string, the underlying implementation can update hostfs values and pass the new paths along to consumers 2) This stops different bits of code from making different assumptions about what's in hostfs and otherwise treating the concept differently. It's easy to mix up "hostfs" and "procfs" and "sysfs" as concepts. A single resolver forces this logic to be a little more centralized.

type SocketStats

type SocketStats struct {
	TcpConns       uint `json:"connections,omitempty"`
	TcpListening   uint `json:"listening,omitempty"`
	TcpClosewait   uint `json:"close_wait,omitempty"`
	TcpEstablished uint `json:"established,omitempty"`
	TcpTimewait    uint `json:"time_wait,omitempty"`
	TcpSynsent     uint `json:"sync_sent,omitempty"`
	TcpSynrecv     uint `json:"sync_recv,omitempty"`
	TcpFinwait1    uint `json:"fin_wait1,omitempty"`
	TcpFinwait2    uint `json:"fin_wait2,omitempty"`
	TcpLastack     uint `json:"last_ack,omitempty"`
	TcpClosing     uint `json:"closing,omitempty"`
}

Jump to

Keyboard shortcuts

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