Documentation ¶
Index ¶
- func Delete(name string, netNS ns.NetNS) error
- func Exists(name string, netNS ns.NetNS) bool
- func GetMAC(name string, netNS ns.NetNS) (net.HardwareAddr, error)
- func HardwareAddrFromInputBytes(b []byte) net.HardwareAddr
- func HasDefaultGW(link netlink.Link, family int) (bool, net.IP, error)
- func HostIPV6Iface() (string, error)
- func IPv6SuffixFromInputBytes(b []byte, n int) []byte
- func IPv6SuffixFromInputBytesAsHex(b []byte, n int) string
- func IsPlugged(inf string) bool
- func IsPluggedTimeout(name string, duration time.Duration) bool
- func IsVirtEth(inf string) bool
- func LinkFilter(links []netlink.Link, types []string) []netlink.Link
- func MakeVethPair(name, master string, mtu int) (netlink.Link, error)
- func ParentIface(iface string, netNS ns.NetNS) (netlink.Link, error)
- func RandomName(prefix string) (string, error)
- func SetLoUp() error
- func SetMAC(name string, mac net.HardwareAddr, netNS ns.NetNS) error
- func VethByName(name string) (netlink.Link, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Delete ¶
Delete deletes the named interface if netNS is not nil Exists switch in the network namespace before deleting
func Exists ¶
Exists test check if the named interface exists if netNS is not nil switch in the network namespace before checking
func HardwareAddrFromInputBytes ¶
func HardwareAddrFromInputBytes(b []byte) net.HardwareAddr
HardwareAddrFromInputBytes returns a deterministic hardware address for a given byte slice.
func HasDefaultGW ¶
HasDefaultGW tests if a link as a default gateway configured it return the ip of the gateway if there is one
func HostIPV6Iface ¶
HostIPV6Iface return the first physical interface to have an ipv6 public address
func IPv6SuffixFromInputBytes ¶
IPv6SuffixFromInputBytes returns a deterministic IPv6 suffix for a given byte slice, with n equals the amount of bytes the suffix has. n has to be within the range of [0, 16].
func IPv6SuffixFromInputBytesAsHex ¶
IPv6SuffixFromInputBytesAsHex returns a deterministic IPv6 suffix hex-encoded for a given byte slice, with n equals the amount of bytes the suffix has. n has to be within the range of [0, 16].
func IsPluggedTimeout ¶
IsPluggedTimeout is like IsPlugged but retry for duration time before returning
func LinkFilter ¶
LinkFilter list all the links of a certain type
func MakeVethPair ¶
MakeVethPair creates a veth pair
func ParentIface ¶ added in v0.4.0
ParentIface return the parent interface fof iface if netNS is not nil, switch to the network namespace before checking iface
func RandomName ¶
RandomName generate a random string that can be used for interface or network namespace if prefix is not None, the random name is prefixed with it
Types ¶
This section is empty.