Documentation ¶
Overview ¶
Package linuxcalls contains wrappers over Netlink APIs related to Linux VETH interfaces or Linux interfaces in general.
Index ¶
- func AddInterfaceIP(ifName string, addr *net.IPNet) error
- func AddVethInterface(ifName, peerIfName string) error
- func CompareNamespaces(ns1 *intf.LinuxInterfaces_Interface_Namespace, ...) int
- func DelInterfaceIP(ifName string, addr *net.IPNet) error
- func DelVethInterface(ifName, peerIfName string) error
- func GetDefaultNamespace() *intf.LinuxInterfaces_Interface_Namespace
- func GetInterfaceType(ifName string) (string, error)
- func GetVethPeerName(ifName string) (string, error)
- func InterfaceAdminDown(ifName string) error
- func InterfaceAdminUp(ifName string) error
- func InterfaceExists(ifName string) (bool, error)
- func NamespaceToStr(namespace *intf.LinuxInterfaces_Interface_Namespace) string
- func NewNetLinkHandler(stopwatch *measure.Stopwatch) *netLinkHandler
- func SetInterfaceMTU(ifName string, mtu int) error
- func SetInterfaceMac(ifName string, macAddress string) error
- func SetInterfaceNamespace(ctx *NamespaceMgmtCtx, ifName string, ...) error
- func SwitchNamespace(ctx *NamespaceMgmtCtx, namespace *intf.LinuxInterfaces_Interface_Namespace) (revert func(), err error)
- type NamespaceMgmtCtx
- type NetlinkAPI
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddInterfaceIP ¶
AddInterfaceIP is a mock implementation of the real AddInterfaceIp from ip_linuxcalls.go, doing absolutely nothing.
func AddVethInterface ¶
AddVethInterface is a mock implementation of the real AddVethInterface from veth_linuxcalls.go, doing absolutely nothing.
func CompareNamespaces ¶
func CompareNamespaces(ns1 *intf.LinuxInterfaces_Interface_Namespace, ns2 *intf.LinuxInterfaces_Interface_Namespace) int
CompareNamespaces is a mock implementation of the real CompareNamespaces from ns_linuxcalls.go, doing absolutely nothing.
func DelInterfaceIP ¶
DelInterfaceIP is a mock implementation of the real DelInterfaceIp from ip_linuxcalls.go, doing absolutely nothing.
func DelVethInterface ¶
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 ¶
GetInterfaceType is a mock implementation of the real GetInterfaceType from link_linuxcalls.go, doing absolutely nothing.
func GetVethPeerName ¶
GetVethPeerName is a mock implementation of the real GetVethPeerName from veth_linuxcalls.go, doing absolutely nothing.
func InterfaceAdminDown ¶
InterfaceAdminDown is a mock implementation of the real InterfaceAdminDown from admin_linuxcalls.go, doing absolutely nothing.
func InterfaceAdminUp ¶
InterfaceAdminUp is a mock implementation of the real InterfaceAdminUp from admin_linuxcalls.go, doing absolutely nothing.
func InterfaceExists ¶
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 ¶
NewNetLinkHandler creates new instance of netlink handler
func SetInterfaceMTU ¶
SetInterfaceMTU is a mock implementation of the real SetInterfaceMTU from ip_linuxcalls.go, doing absolutely nothing.
func SetInterfaceMac ¶
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.