netio

package
v1.6.7 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2024 License: MIT Imports: 6 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) SetGetInterfaceValidatonFn

func (netshim *MockNetIO) SetGetInterfaceValidatonFn(fn getInterfaceValidationFn)

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 added in v1.5.30

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

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)
}

Jump to

Keyboard shortcuts

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