netns

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2021 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package netns defines and implements basic functions used to create and configure new network namespaces.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateNetns

func CreateNetns(name string) (ns.NetNS, error)

CreateNetns given a name it will check if a namespace exists with the given name and will remove it. Then the namespace will be recreated. To start fresh with a clean network namespace is preferred since we create a veth pair between network namespaces. If the namespace exists it means that our operator has crashed, better clean the namespace, because it's hard to check the existing configuration that spans multiple network namespaces. Returns a handler to the newly created network namespace or an error in case something goes wrong.

func CreateVethPair

func CreateVethPair(originVethName, dstVethName string, originNetns, dstNetns ns.NetNS, linkMTU int) error

CreateVethPair it will create veth pair in originNetns and move one of them in dstNetns. originNetns is the host netns and dstNetns is the gateway netns. Error is returned if something goes wrong.

func DeleteNetns

func DeleteNetns(name string) error

DeleteNetns removes a given network namespace by name. If the namespace does not exist does nothing, in case of error returns it.

Types

This section is empty.

Jump to

Keyboard shortcuts

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