net

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2024 License: Apache-2.0 Imports: 12 Imported by: 8

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Info

type Info struct {

	// NICs is a slice of pointers to `NIC` structs describing the network
	// interface controllers (NICs) on the host system.
	NICs []*NIC `json:"nics"`
	// contains filtered or unexported fields
}

Info describes all network interface controllers (NICs) in the host system.

func New

func New(opts ...*option.Option) (*Info, error)

New returns a pointer to an Info struct that contains information about the network interface controllers (NICs) on the host system

func (*Info) JSONString

func (i *Info) JSONString(indent bool) string

JSONString returns a string with the net information formatted as JSON under a top-level "net:" key

func (*Info) String

func (i *Info) String() string

String returns a short string with information about the networking on the host system.

func (*Info) YAMLString

func (i *Info) YAMLString() string

YAMLString returns a string with the net information formatted as YAML under a top-level "net:" key

type NIC

type NIC struct {
	// Name is the string identifier the system gave this NIC.
	Name string `json:"name"`
	// MACAddress is the Media Access Control (MAC) address of this NIC.
	MACAddress string `json:"mac_address"`
	// DEPRECATED: Please use MACAddress instead.
	MacAddress string `json:"-"`
	// IsVirtual is true if the NIC is entirely virtual/emulated, false
	// otherwise.
	IsVirtual bool `json:"is_virtual"`
	// Capabilities is a slice of pointers to `NICCapability` structs
	// describing a feature/capability of this NIC.
	Capabilities []*NICCapability `json:"capabilities"`
	// PCIAddress is a pointer to the PCI address for this NIC, or nil if there
	// is no PCI address for this NIC.
	PCIAddress *string `json:"pci_address,omitempty"`
	// Speed is a string describing the link speed of this NIC, e.g. "1000Mb/s"
	Speed string `json:"speed"`
	// Duplex is a string indicating the current duplex setting of this NIC,
	// e.g. "Full"
	Duplex string `json:"duplex"`
	// SupportedLinkModes is a slice of strings containing the supported link
	// modes of this NIC, e.g. "10baseT/Half", "1000baseT/Full", etc.
	SupportedLinkModes []string `json:"supported_link_modes,omitempty"`
	// SupportedPorts is a slice of strings containing the supported physical
	// ports on this NIC, e.g. "Twisted Pair"
	SupportedPorts []string `json:"supported_ports,omitempty"`
	// SupportedFECModes is a slice of strings containing the supported Forward
	// Error Correction (FEC) modes for this NIC.
	SupportedFECModes []string `json:"supported_fec_modes,omitempty"`
	// AdvertiseLinkModes is a slice of strings containing the advertised
	// (during auto-negotiation) link modes of this NIC, e.g. "10baseT/Half",
	// "1000baseT/Full", etc.
	AdvertisedLinkModes []string `json:"advertised_link_modes,omitempty"`
	// AvertisedFECModes is a slice of strings containing the advertised
	// (during auto-negotiation) Forward Error Correction (FEC) modes for this
	// NIC.
	AdvertisedFECModes []string `json:"advertised_fec_modes,omitempty"`
}

NIC contains information about a single Network Interface Controller (NIC).

func (*NIC) String

func (n *NIC) String() string

String returns a short string with information about the NIC.

type NICCapability

type NICCapability struct {
	// Name is the string name for the capability, e.g.
	// "tcp-segmentation-offload"
	Name string `json:"name"`
	// IsEnabled is true if the capability is currently enabled on the NIC,
	// false otherwise.
	IsEnabled bool `json:"is_enabled"`
	// CanEnable is true if the capability can be enabled on the NIC, false
	// otherwise.
	CanEnable bool `json:"can_enable"`
}

NICCapability is a feature/capability of a Network Interface Controller (NIC)

func (*NICCapability) String added in v0.11.0

func (nc *NICCapability) String() string

String returns a short string with information about the NIC capability.

Jump to

Keyboard shortcuts

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