Documentation ¶
Overview ¶
Package ethtool allows control of the Linux ethtool generic netlink interface. For more information, see: https://www.kernel.org/doc/html/latest/networking/ethtool-netlink.html.
Index ¶
- type AdvertisedLinkMode
- type Client
- func (c *Client) Close() error
- func (c *Client) FEC(ifi Interface) (*FEC, error)
- func (c *Client) LinkInfo(ifi Interface) (*LinkInfo, error)
- func (c *Client) LinkInfos() ([]*LinkInfo, error)
- func (c *Client) LinkMode(ifi Interface) (*LinkMode, error)
- func (c *Client) LinkModes() ([]*LinkMode, error)
- func (c *Client) LinkState(ifi Interface) (*LinkState, error)
- func (c *Client) LinkStates() ([]*LinkState, error)
- func (c *Client) SetFEC(fec FEC) error
- func (c *Client) SetWakeOnLAN(wol WakeOnLAN) error
- func (c *Client) WakeOnLAN(ifi Interface) (*WakeOnLAN, error)
- func (c *Client) WakeOnLANs() ([]*WakeOnLAN, error)
- type Duplex
- type Error
- type FEC
- type FECMode
- type FECModes
- type Interface
- type LinkInfo
- type LinkMode
- type LinkState
- type Port
- type WOLMode
- type WakeOnLAN
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AdvertisedLinkMode ¶
An AdvertisedLinkMode is a link mode that an interface advertises it is capable of using.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
A Client can manipulate the ethtool netlink interface.
func (*Client) FEC ¶
FEC fetches the forward error correction (FEC) setting for the specified Interface.
func (*Client) LinkInfo ¶
LinkInfo fetches LinkInfo for the specified Interface.
If the requested device does not exist or is not supported by the ethtool interface, an error compatible with errors.Is(err, os.ErrNotExist) will be returned.
func (*Client) LinkInfos ¶
LinkInfos fetches LinkInfo structures for each ethtool-supported interface on this system.
func (*Client) LinkMode ¶
LinkMode fetches LinkMode data for the specified Interface.
If the requested device does not exist or is not supported by the ethtool interface, an error compatible with errors.Is(err, os.ErrNotExist) will be returned.
func (*Client) LinkModes ¶
LinkModes fetches LinkMode structures for each ethtool-supported interface on this system.
func (*Client) LinkState ¶
LinkState fetches LinkState data for the specified Interface.
If the requested device does not exist or is not supported by the ethtool interface, an error compatible with errors.Is(err, os.ErrNotExist) will be returned.
func (*Client) LinkStates ¶
LinkStates fetches LinkState structures for each ethtool-supported interface on this system.
func (*Client) SetFEC ¶
SetFEC sets the forward error correction (FEC) parameters for the Interface in fec.
Setting FEC parameters requires elevated privileges and if the caller does not have permission, an error compatible with errors.Is(err, os.ErrPermission) will be returned.
If the requested device does not exist or is not supported by the ethtool interface, an error compatible with errors.Is(err, os.ErrNotExist) will be returned.
func (*Client) SetWakeOnLAN ¶
SetWakeOnLAN sets the WakeOnLAN parameters for the Interface in wol.
Setting Wake-on-LAN parameters requires elevated privileges and if the caller does not have permission, an error compatible with errors.Is(err, os.ErrPermission) will be returned.
If the requested device does not exist or is not supported by the ethtool interface, an error compatible with errors.Is(err, os.ErrNotExist) will be returned.
func (*Client) WakeOnLAN ¶
WakeOnLAN fetches WakeOnLAN parameters for the specified Interface.
Fetching Wake-on-LAN information requires elevated privileges and if the caller does not have permission, an error compatible with errors.Is(err, os.ErrPermission) will be returned.
If the requested device does not exist or is not supported by the ethtool interface, an error compatible with errors.Is(err, os.ErrNotExist) will be returned.
func (*Client) WakeOnLANs ¶
WakeOnLANs fetches WakeOnLAN information for each ethtool-supported interface on this system.
type Error ¶
An Error is an error value produced by the kernel due to a bad ethtool netlink request. Typically the Err will be of type *netlink.OpError.
type FEC ¶
A FEC contains the forward error correction (FEC) parameters for an interface.
func (*FEC) Supported ¶
Supported returns the supported/configured FEC modes. Some drivers report supported, others configured. See https://kernel.googlesource.com/pub/scm/network/ethtool/ethtool/+/2b3ddcb35357ae34ed0a6ae2bb006dcdaec353a9
type FECMode ¶
type FECMode int
A FECMode is a FEC mode bit value (single element bitmask) specifying the active mode of an interface.
type FECModes ¶
type FECModes FECMode
A FECModes is a FEC mode bitmask of mode(s) supported by an interface.
type Interface ¶
type Interface struct { // Callers may choose to set either Index, Name, or both fields. Note that // if both are set, the kernel will verify that both Index and Name are // associated with the same interface. If they are not, an error will be // returned. Index int Name string }
An Interface is an ethtool netlink Ethernet interface. Interfaces are used to identify an Ethernet interface being queried by its index and/or name.
type LinkMode ¶
type LinkMode struct { Interface Interface SpeedMegabits int Ours, Peer []AdvertisedLinkMode Duplex Duplex }
LinkMode contains link mode information for an Ethernet interface.
type Port ¶
type Port int
A Port is the port type for a LinkInfo structure.
type WOLMode ¶
type WOLMode int
A WOLMode is a Wake-on-LAN mode bitmask of mode(s) supported by an interface.