linuxcalls

package
v1.5.1 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2018 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package linuxcalls contains wrappers over Netlink APIs related to Linux VETH interfaces or Linux interfaces in general.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddInterfaceIP

func AddInterfaceIP(ifName string, addr *net.IPNet) error

AddInterfaceIP is a mock implementation of the real AddInterfaceIp from ip_linuxcalls.go, doing absolutely nothing.

func AddVethInterface

func AddVethInterface(ifName, peerIfName string) error

AddVethInterface is a mock implementation of the real AddVethInterface from veth_linuxcalls.go, doing absolutely nothing.

func CompareNamespaces

CompareNamespaces is a mock implementation of the real CompareNamespaces from ns_linuxcalls.go, doing absolutely nothing.

func DelInterfaceIP

func DelInterfaceIP(ifName string, addr *net.IPNet) error

DelInterfaceIP is a mock implementation of the real DelInterfaceIp from ip_linuxcalls.go, doing absolutely nothing.

func DelVethInterface

func DelVethInterface(ifName, peerIfName string) error

DelVethInterface is a mock implementation of the real DelVethInterface from veth_linuxcalls.go, doing absolutely nothing.

func GetDefaultNamespace

func GetDefaultNamespace() *intf.LinuxInterfaces_Interface_Namespace

GetDefaultNamespace is a mock implementation of the real GetDefaultNamespace from ns_linuxcalls.go, doing absolutely nothing.

func GetInterfaceType

func GetInterfaceType(ifName string) (string, error)

GetInterfaceType is a mock implementation of the real GetInterfaceType from link_linuxcalls.go, doing absolutely nothing.

func GetVethPeerName

func GetVethPeerName(ifName string) (string, error)

GetVethPeerName is a mock implementation of the real GetVethPeerName from veth_linuxcalls.go, doing absolutely nothing.

func InterfaceAdminDown

func InterfaceAdminDown(ifName string) error

InterfaceAdminDown is a mock implementation of the real InterfaceAdminDown from admin_linuxcalls.go, doing absolutely nothing.

func InterfaceAdminUp

func InterfaceAdminUp(ifName string) error

InterfaceAdminUp is a mock implementation of the real InterfaceAdminUp from admin_linuxcalls.go, doing absolutely nothing.

func InterfaceExists

func InterfaceExists(ifName string) (bool, error)

InterfaceExists is a mock implementation of the real InterfaceExists from link_linuxcalls.go, doing absolutely nothing.

func NamespaceToStr

func NamespaceToStr(namespace *intf.LinuxInterfaces_Interface_Namespace) string

NamespaceToStr is a mock implementation of the real NamespaceToStr from ns_linuxcalls.go, doing absolutely nothing.

func NewNetLinkHandler

func NewNetLinkHandler(stopwatch *measure.Stopwatch) *netLinkHandler

NewNetLinkHandler creates new instance of netlink handler

func SetInterfaceMTU

func SetInterfaceMTU(ifName string, mtu int) error

SetInterfaceMTU is a mock implementation of the real SetInterfaceMTU from ip_linuxcalls.go, doing absolutely nothing.

func SetInterfaceMac

func SetInterfaceMac(ifName string, macAddress string) error

SetInterfaceMac is a mock implementation of the real SetInterfaceMac from mac_linuxcalls.go, doing absolutely nothing.

func SetInterfaceNamespace

func SetInterfaceNamespace(ctx *NamespaceMgmtCtx, ifName string, namespace *intf.LinuxInterfaces_Interface_Namespace) error

SetInterfaceNamespace is a mock implementation of the real SetInterfaceNamespace from ns_linuxcalls.go, doing absolutely nothing.

func SwitchNamespace

func SwitchNamespace(ctx *NamespaceMgmtCtx, namespace *intf.LinuxInterfaces_Interface_Namespace) (revert func(), err error)

SwitchNamespace is a mock implementation of the real SwitchNamespace from ns_linuxcalls.go, doing absolutely nothing.

Types

type NamespaceMgmtCtx

type NamespaceMgmtCtx struct {
}

NamespaceMgmtCtx is a mock type definition of the real NamespaceMgmtCtx from ns_linuxcalls.go.

func NewNamespaceMgmtCtx

func NewNamespaceMgmtCtx() *NamespaceMgmtCtx

NewNamespaceMgmtCtx is a mock implementation of the real NewNamespaceMgmtCtx from ns_linuxcalls.go, doing absolutely nothing.

type NetlinkAPI

type NetlinkAPI interface {
	// AddVethInterfacePair configures two connected VETH interfaces
	AddVethInterfacePair(ifName, peerIfName string) error
	// DelVethInterfacePair removes VETH pair
	DelVethInterfacePair(ifName, peerIfName string) error
	// SetInterfaceUp sets interface state to 'up'
	SetInterfaceUp(ifName string) error
	// SetInterfaceDown sets interface state to 'down'
	SetInterfaceDown(ifName string) error
	// AddInterfaceIP adds new IP address
	AddInterfaceIP(ifName string, addr *net.IPNet) error
	// DelInterfaceIP removes IP address from linux interface
	DelInterfaceIP(ifName string, addr *net.IPNet) error
	// SetInterfaceMac sets MAC address
	SetInterfaceMac(ifName string, macAddress string) error
	// SetInterfaceMTU set maximum transmission unit for interface
	SetInterfaceMTU(ifName string, mtu int) error
	// RenameInterface changes interface host name
	RenameInterface(ifName string, newName string) error
	// GetLinkByName returns netlink interface type
	GetLinkByName(ifName string) (netlink.Link, error)
	// GetLinkList return all links from namespace
	GetLinkList() ([]netlink.Link, error)
	// GetAddressList reads all IP addresses
	GetAddressList(ifName string) ([]netlink.Addr, error)
	// InterfaceExists verifies interface existence
	InterfaceExists(ifName string) (bool, error)
	// GetInterfaceType returns linux interface type
	GetInterfaceType(ifName string) (string, error)
	// GetVethPeerName returns VETH's peer name
	GetVethPeerName(ifName string) (string, error)
	// GetInterfaceByName returns *net.Interface type from name
	GetInterfaceByName(ifName string) (*net.Interface, error)
}

NetlinkAPI interface covers all methods inside linux calls package needed to manage linux interfaces.

Jump to

Keyboard shortcuts

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