util

package
v0.8.2 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2020 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConfigureLinkAddress added in v0.7.0

func ConfigureLinkAddress(idx int, gwIPNet *net.IPNet) error

func DialLocalSocket added in v0.7.0

func DialLocalSocket(address string) (net.Conn, error)

DialLocalSocket connects to a Unix domain socket.

func GenerateContainerInterfaceKey added in v0.3.0

func GenerateContainerInterfaceKey(containerID string) string

GenerateContainerInterfaceKey generates a unique string for a Pod's interface as: container/<Container-ID>. We must use ContainerID instead of PodNamespace + PodName because there could be more than one container associated with the same Pod at some point. For example, when deleting a StatefulSet Pod with 0 second grace period, the Pod will be removed from the Kubernetes API very quickly and a new Pod will be created immediately, and kubelet may process the deletion of the previous Pod and the addition of the new Pod simultaneously.

func GenerateContainerInterfaceName

func GenerateContainerInterfaceName(podName, podNamespace, containerID string) string

GenerateContainerInterfaceName generates a unique interface name using the Pod's namespace, name and containerID. The output should be deterministic (so that multiple calls to GenerateContainerInterfaceName with the same parameters return the same value). The output has the length of interfaceNameLength(15). The probability of collision should be neglectable.

func GenerateNodeTunnelInterfaceKey added in v0.3.0

func GenerateNodeTunnelInterfaceKey(nodeName string) string

GenerateNodeTunnelInterfaceKey generates a unique string for a Node's tunnel interface as: node/<Node-name>.

func GenerateNodeTunnelInterfaceName added in v0.3.0

func GenerateNodeTunnelInterfaceName(nodeName string) string

GenerateNodeTunnelInterfaceName generates a unique interface name for the tunnel to the Node, using the Node's name.

func GetIPNetDeviceFromIP added in v0.4.0

func GetIPNetDeviceFromIP(localIP net.IP) (*net.IPNet, netlink.Link, error)

GetIPNetDeviceFromIP returns a local IP/mask and associated device from IP.

func GetNSDevInterface added in v0.5.0

func GetNSDevInterface(nsPath, dev string) (*net.Interface, error)

GetNSDevInterface returns interface of dev in namespace nsPath.

func GetNSPath added in v0.7.0

func GetNSPath(netnsName string) (string, error)

GetNSPath returns the path of the specified netns.

func GetNSPeerDevBridge added in v0.5.0

func GetNSPeerDevBridge(nsPath, dev string) (*net.Interface, string, error)

GetPeerLinkBridge returns peer device and its attached bridge (if applicable) for device dev in network space indicated by nsPath

func GetNetLink(dev string) netlink.Link

GetNetLink returns dev link from name.

func ListenLocalSocket added in v0.7.0

func ListenLocalSocket(address string) (net.Listener, error)

ListenLocalSocket creates a listener on a Unix domain socket.

func SetLinkUp added in v0.7.0

func SetLinkUp(name string) (net.HardwareAddr, int, error)

Types

type LinkNotFound added in v0.7.0

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

Directories

Path Synopsis
Package ethtool provides Go wrappers for ioctl ethtool system calls on Linux
Package ethtool provides Go wrappers for ioctl ethtool system calls on Linux

Jump to

Keyboard shortcuts

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