netif

package
v0.0.0-...-c8d0fdc Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2020 License: Apache-2.0 Imports: 3 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type NetifManager

type NetifManager struct {
	netlink.Handle
	Addrs []*netlink.Addr
}

func NewNetifManager

func NewNetifManager(ips []net.IP) *NetifManager

NewNetifManager returns a new instance of NetifManager with the ip address set to the provided values These ip addresses will be bound to any devices created by this instance.

func (*NetifManager) AddDummyDevice

func (m *NetifManager) AddDummyDevice(name string) error

AddDummyDevice creates a dummy device with the given name. It also binds the ip address of the NetifManager instance to this device. This function returns an error if the device exists or if address binding fails.

func (*NetifManager) EnsureDummyDevice

func (m *NetifManager) EnsureDummyDevice(name string) (bool, error)

EnsureDummyDevice checks for the presence of the given dummy device and creates one if it does not exist. Returns a boolean to indicate if this device was found and error if any.

func (*NetifManager) RemoveDummyDevice

func (m *NetifManager) RemoveDummyDevice(name string) error

RemoveDummyDevice deletes the dummy device with the given name.

Jump to

Keyboard shortcuts

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