netutils

package
v0.0.0-...-c255293 Latest Latest
Warning

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

Go to latest
Published: May 1, 2017 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateVethPair

func CreateVethPair(name1, name2 string) error

CreateVethPair creates veth interface pairs with specified name

func DeleteVethPair

func DeleteVethPair(name1, name2 string) error

DeleteVethPair deletes veth interface pairs

func GenerateIfaceName

func GenerateIfaceName(nlh *netlink.Handle, prefix string, len int) (string, error)

GenerateIfaceName returns an interface name using the passed in prefix and the length of random bytes. The api ensures that the there are is no interface which exists with that name.

func GenerateMACFromIP

func GenerateMACFromIP(ip net.IP) net.HardwareAddr

GenerateMACFromIP returns a locally administered MAC address where the 4 least significant bytes are derived from the IPv4 address.

func GenerateRandomMAC

func GenerateRandomMAC() net.HardwareAddr

GenerateRandomMAC returns a new 6-byte(48-bit) hardware address (MAC)

func GenerateRandomName

func GenerateRandomName(prefix string, size int) (string, error)

GenerateRandomName returns a new name joined with a prefix. This size specified is used to truncate the randomly generated value

func SetInterfaceIP

func SetInterfaceIP(name string, ipstr string) error

SetInterfaceIP Set IP address of an interface

func SetInterfaceMac

func SetInterfaceMac(name string, macaddr string) error

SetInterfaceMac Set mac address of an interface

func SetLinkUp

func SetLinkUp(name string) error

SetLinkUp sets the link up

Types

This section is empty.

Jump to

Keyboard shortcuts

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