vmm

package
v0.2.7 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2025 License: Apache-2.0 Imports: 55 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInterrupt = errors.New("Interrupt")
View Source
var ErrRestart = errors.New("Restart")
View Source
var SSH_CSS = html.Style(`
#terminal {
	min-height: 300px;
	max-height: 50vh;
}
div.fillScreen {
	position: fixed;
	top: 0;
	left: 0;
	max-height: 100vh !important;
	z-index: 100;
}

button.fillScreen {
	position: fixed;
	bottom: 20px;
	right: 20px;
	z-index: 101;
}`)
View Source
var SSH_JS = html.JavaScript(sshJsRaw)

Functions

func Entry

func Entry(
	prepare func(vmm Driver) (PrepareResult, error),
	create func(vmm Driver) (VirtualMachineMonitor, error),
)

Types

type BlockDevice

type BlockDevice interface {
	io.ReaderAt
	io.WriterAt
	Size() int64
}

type Driver

type Driver interface {
	// FindExecutable finds the executable with the given name.
	// It looks beside the current executable first then searches the PATH.
	FindExecutable(name string) (string, error)

	// HostOperatingSystem returns the host operating system.
	HostOperatingSystem() string

	// GuestArchitecture returns the guest architecture. This is the architecture of the kernel and init.
	GuestArchitecture() config.CPUArchitecture

	// RootArchitecture returns the architecture of executables on the guest filesystem so emulation can be installed.
	RootArchitecture() config.CPUArchitecture

	// Accelerated returns true if the driver supports hardware acceleration.
	Accelerated() bool

	// CPUCount returns the number of CPU cores.
	CPUCores() int

	// MemorySize returns the memory size in MiB.
	MemoryMB() int

	// DiskImages returns a list of attached disk images.
	DiskImages() []File

	// InitRamFs returns the initial ramdisk filesystem or nil.
	InitRamFs() File

	// Verbose returns true if the driver is in verbose mode.
	Verbose() bool

	// Experimental returns the experimental flags.
	Experimental() []string

	// Interaction returns the interaction mode.
	Interaction() config.InteractionKind

	// NetworkInterface returns the network interface or nil.
	NetworkInterface() NetworkInterface

	// Kernel returns the kernel image.
	Kernel() File

	// EnsureFile ensures the file with the given name exists and has the given contents.
	EnsureFile(contents []byte) (File, error)
}

type FdReader

type FdReader interface {
	io.Reader
	Fd() uintptr
}

FdReader is an io.Reader with an Fd function

type File

type File interface {
	// GetNBDServer returns the NBD server address and the export name.
	// If unix is true, it returns a Unix domain socket path.
	// Otherwise, it returns a TCP address.
	GetNBDServer(unix bool) (net.Addr, string, error)

	// HostFilename writes the file to a temporary file and returns the path.
	HostFilename() (string, error)
}

type Filesystem

type Filesystem interface {
	// EnsurePath ensures the path exists.
	EnsurePath(path string) error

	// WriteFile writes a file to the filesystem.
	WriteFile(path string, contents []byte) error
}

type NetworkInterface

type NetworkInterface interface {
	// MACAddress returns the MAC address.
	MACAddress() net.HardwareAddr

	// GetUDPSocketPair returns a pair of UDP sockets one for sending L2 and one for receiving L2 packets.
	GetUDPSocketPair() (net.Addr, net.Addr, error)

	// AttachFile attaches a file to the network interface.
	AttachFile(file *os.File) error
}

type PrepareResult

type PrepareResult struct {
}

type SecureSSHConfig

type SecureSSHConfig struct {
	HostKey   string `json:"ssh_host_key"`
	PublicKey string `json:"ssh_public_key"`
	Password  string `json:"ssh_password"`
}

type VirtualMachineMonitor

type VirtualMachineMonitor interface {
	// Run starts the virtual machine.
	// If bindOutput is true, the output is bound to the current process.
	Run(bindOutput bool) error

	// Shutdown stops the virtual machine.
	Shutdown() error
}

func NewExecutable

func NewExecutable(name string, args []string) VirtualMachineMonitor

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳