Help us shape the future of Go! Take the 2026 Go Developer Survey

netio

package
v1.8.16 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrMockNetIOFail = errors.New("netio fail")
	HwAddr, _        = net.ParseMAC("ab:cd:ef:12:34:56")
	BadHwAddr, _     = net.ParseMAC("56:34:12:ef:cd:ab")
)

ErrMockNetIOFail - mock netio error

View Source
var ErrInterfaceNil = errors.New("Interface is nil")

ErrInterfaceNil - errors out when interface is nil

View Source
var ErrInterfaceNotFound = errors.New("Inteface not found")

Functions

This section is empty.

Types

type MockNetIO

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

func NewMockNetIO

func NewMockNetIO(fail bool, failAttempt int) *MockNetIO

func (*MockNetIO) GetNetworkInterfaceAddrs

func (netshim *MockNetIO) GetNetworkInterfaceAddrs(iface *net.Interface) ([]net.Addr, error)

func (*MockNetIO) GetNetworkInterfaceByMac

func (netshim *MockNetIO) GetNetworkInterfaceByMac(mac net.HardwareAddr) (*net.Interface, error)

func (*MockNetIO) GetNetworkInterfaceByName

func (netshim *MockNetIO) GetNetworkInterfaceByName(name string) (*net.Interface, error)

func (*MockNetIO) ResolveMasterInterface added in v1.8.12

func (netshim *MockNetIO) ResolveMasterInterface(iface *net.Interface) (*net.Interface, error)

ResolveMasterInterface returns iface unchanged by default. Tests that need to model VF-to-master resolution can override it with SetResolveMasterInterfaceFn.

func (*MockNetIO) SetGetInterfaceValidatonFn

func (netshim *MockNetIO) SetGetInterfaceValidatonFn(fn getInterfaceValidationFn)

func (*MockNetIO) SetResolveMasterInterfaceFn added in v1.8.12

func (netshim *MockNetIO) SetResolveMasterInterfaceFn(fn func(iface *net.Interface) (*net.Interface, error))

type NetIO

type NetIO struct{}

func (*NetIO) GetNetworkInterfaceAddrs

func (ns *NetIO) GetNetworkInterfaceAddrs(iface *net.Interface) ([]net.Addr, error)

func (*NetIO) GetNetworkInterfaceByMac

func (ns *NetIO) GetNetworkInterfaceByMac(mac net.HardwareAddr) (*net.Interface, error)

func (*NetIO) GetNetworkInterfaceByName

func (ns *NetIO) GetNetworkInterfaceByName(name string) (*net.Interface, error)

func (*NetIO) GetNetworkInterfaces

func (ns *NetIO) GetNetworkInterfaces() ([]net.Interface, error)

func (*NetIO) ResolveMasterInterface added in v1.8.12

func (ns *NetIO) ResolveMasterInterface(iface *net.Interface) (*net.Interface, error)

ResolveMasterInterface returns the upper (master) device for iface, routing to the Linux netlink-based resolver.

type NetIOInterface

type NetIOInterface interface {
	GetNetworkInterfaceByName(name string) (*net.Interface, error)
	GetNetworkInterfaceAddrs(iface *net.Interface) ([]net.Addr, error)
	GetNetworkInterfaceByMac(mac net.HardwareAddr) (*net.Interface, error)
	ResolveMasterInterface(iface *net.Interface) (*net.Interface, error)
}

Jump to

Keyboard shortcuts

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