network

package
v0.0.0-...-ba0f412 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2021 License: ISC Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateBridge

func CreateBridge(bridgeName string) (*netlink.Bridge, error)

CreateBridge creates and returns a netklink.Bridge

func CreateMacvtapInterfaceDocker

func CreateMacvtapInterfaceDocker(master string) (
	net.IP, net.IP, net.IPMask, string, string, error)

CreateMacvtapInterfaceDocker creates a Macvtap interface associated with master (usually "eth0"). Returns the assigned IP/mask and gateway IP (previously owned by master) and the MAC of the Macvtap interface that has to be used by the unikernel's NIC.

Got the idea of using macvtap's and the fix for the inability to get the right index in a network namespace from the Kata containers repository: https://github.com/kata-containers/runtime/blob/593bd44f207aa7b21e561184ca1b3fb79da47eb6/virtcontainers/network.go

func CreateTapInterface

func CreateTapInterface(tapName string, ip *net.IP, mask *net.IPMask) error

CreateTapInterface creates a new TAP interface and assignes it ip/mask as the new address. nil pointers to ip/mask indicates not to set ip/mask

func CreateTapInterfaceDocker

func CreateTapInterfaceDocker(tapName string, master string) (
	net.IP, net.IP, net.IPMask, string, error)

CreateTapInterfaceDocker creates a new TAP interface and a bridge, adds both the TAP and the master link (usually eth0) to the bridge, and unsets the IP of the master link to be used by the unikernel NIC. Returns the assigned IP/mask and gateway IP.

func MaskCIDR

func MaskCIDR(mask net.IPMask) int

MaskCIDR returns a mask CIDR (the 16 in 1.1.1.1/16) for a net.IPMask

func RemoveTapDevice

func RemoveTapDevice(tapName string) error

RemoveTapDevices removes the tap device with name tapName

func SetupTunDev

func SetupTunDev() error

SetupTunDev sets up the /dev/net/tun device if it doesn't exists

Types

This section is empty.

Jump to

Keyboard shortcuts

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