Documentation ¶
Index ¶
- Constants
- func ExtractInterfaceNamespace(interfaces []*types100.Interface, interfaceName string) (string, error)
- func ExtractVeth(interfaces []*types100.Interface, netnsID, peerInterfaceIndex int) (string, error)
- func FindExecutable(name string) ([]string, error)
- func FindNetNSID(netnsPath string) (int, error)
- func GetInterfaceIndex(interfaceName string) (int, error)
- func GetNetNSLocation() string
- func RunCommand(c string, parameters ...string) ([]byte, error)
Constants ¶
const ( TypeVeth = "veth" TypeNetwork = "network" NetNSLocation = "/run/netns" )
Variables ¶
This section is empty.
Functions ¶
func ExtractInterfaceNamespace ¶
func ExtractInterfaceNamespace(interfaces []*types100.Interface, interfaceName string) (string, error)
ExtractInterfaceNamespace takes an interface name inside the namespace, e.g. "eth0", and searches the list of provided interfaces for that interface name. On success, it returns the name of the namespace of that interface (the content of the Sandbox field).
func ExtractVeth ¶
ExtractVeth iterates over the list of provided interfaces. For each interface, it checks: * That the interface is in the global namespace. * That the ParentIndex (peer index) of the interface equals the peerInterfaceIndex that we are looking for. * That the NetNsID equals the provided netnsID. If these conditions are met, it will return the name of the matching interface.
func FindExecutable ¶
FindExecutable checks if an executable exists inside the container. If so, it returns that path. Otherwise, it also checks on /host.
func FindNetNSID ¶
FindNetNSID expects a path to a netns and will return the ID of the corresponding netns.
func GetInterfaceIndex ¶
GetInterfaceIndex will return the interface index for the provided interface name.
func GetNetNSLocation ¶
func GetNetNSLocation() string
Types ¶
This section is empty.