network

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2025 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultInterface = "eth0" // FIXME: Discover the veth endpoint name instead of using default "eth0". See: https://github.com/urunc-dev/urunc/issues/14
	DefaultTap       = "tapX_urunc"
)

Variables

View Source
var StaticIPAddr = fmt.Sprintf("%s/24", constants.StaticNetworkTapIP)

Functions

func Cleanup

func Cleanup(tapDevice string) error

Types

type DynamicNetwork

type DynamicNetwork struct {
}

func (DynamicNetwork) NetworkSetup

func (n DynamicNetwork) NetworkSetup(uid uint32, gid uint32) (*UnikernelNetworkInfo, error)

NetworkSetup checks if any tap device is available in the current netns. If it is, it assumes a running unikernel is present in the current netns and returns an error, because network functionality for more than one unikernels is not yet implemented. If no TAP devices are available in the current netns, it creates a new tap device and sets TC rules between the veth interface and the tap device inside the namespace.

FIXME: CUrrently only one tap device per netns can provide functional networking. We need to find a proper way to handle networking for multiple unikernels in the same pod/network namespace. See: https://github.com/urunc-dev/urunc/issues/13

type Interface

type Interface struct {
	IP             string
	DefaultGateway string
	Mask           string
	Interface      string
	MAC            string
}

type Manager

type Manager interface {
	NetworkSetup(uid uint32, gid uint32) (*UnikernelNetworkInfo, error)
}

func NewNetworkManager

func NewNetworkManager(networkType string) (Manager, error)

type StaticNetwork

type StaticNetwork struct {
}

func (StaticNetwork) NetworkSetup

func (n StaticNetwork) NetworkSetup(uid uint32, gid uint32) (*UnikernelNetworkInfo, error)

type UnikernelNetworkInfo

type UnikernelNetworkInfo struct {
	TapDevice string
	EthDevice Interface
}

Jump to

Keyboard shortcuts

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