virt

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2024 License: GPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	REGISTERED state = iota
	STARTED
	STOPPED
	KILLED
)
View Source
const GUESTINTERFACE = "eth0"
View Source
const HOST_INTERFACE = "ens4"
View Source
const OUTPUTPATH = "/celestial/out"
View Source
const ROOTPATH = "/celestial"

Variables

View Source
var (
	IPTABLES_BIN string
	IP_BIN       string
	SYSCTL_BIN   string
	DD_BIN       string
	MKFS_BIN     string
)

Functions

This section is empty.

Types

type NetworkEmulationBackend

type NetworkEmulationBackend interface {
	Register(id orchestrator.MachineID, tap string) error
	SetBandwidth(source orchestrator.MachineID, target net.IPNet, bandwidth uint64) error
	SetLatency(source orchestrator.MachineID, target net.IPNet, latency uint32) error
	UnblockLink(source orchestrator.MachineID, target net.IPNet) error
	BlockLink(source orchestrator.MachineID, target net.IPNet) error
	Stop() error
}

NetworkEmulationBackend is the interface for the network emulation backend.

type PeeringBackend

type PeeringBackend interface {
	GetHostID() (uint8, error)
	Route(network net.IPNet, host orchestrator.Host) error
	Stop() error
}

PeeringBackend is the interface for the peering backend.

type Virt

type Virt struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

Virt provides virtualization functionality using firecracker.

func New

func New(hostInterface string, initDelay uint64, pb PeeringBackend, neb NetworkEmulationBackend) (*Virt, error)

New creates a new virt backend.

func (v *Virt) BlockLink(source orchestrator.MachineID, target orchestrator.MachineID) error

BlockLink blocks the link between two machines using the network emulation backend.

func (*Virt) GetIPAddress

func (v *Virt) GetIPAddress(id orchestrator.MachineID) (net.IPNet, error)

func (*Virt) RegisterMachine

func (v *Virt) RegisterMachine(id orchestrator.MachineID, name string, host orchestrator.Host, config orchestrator.MachineConfig) error

RegisterMachine registers a machine with the virt backend. If the machine is on a remote host, it will be routed there.

func (*Virt) ResolveIPAddress

func (v *Virt) ResolveIPAddress(ip net.IP) (orchestrator.MachineID, error)

func (*Virt) SetBandwidth

func (v *Virt) SetBandwidth(source orchestrator.MachineID, target orchestrator.MachineID, bandwidth uint64) error

SetBandwidth sets the bandwidth between two machines using the network emulation backend.

func (*Virt) SetLatency

func (v *Virt) SetLatency(source orchestrator.MachineID, target orchestrator.MachineID, latency uint32) error

SetLatency sets the latency between two machines using the network emulation backend.

func (*Virt) StartMachine

func (v *Virt) StartMachine(machine orchestrator.MachineID) error

func (*Virt) Stop

func (v *Virt) Stop() error

func (*Virt) StopMachine

func (v *Virt) StopMachine(machine orchestrator.MachineID) error
func (v *Virt) UnblockLink(source orchestrator.MachineID, target orchestrator.MachineID) error

UnblockLink unblocks the link between two machines using the network emulation backend.

Jump to

Keyboard shortcuts

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