vm

package
v0.1.12 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func KernelDNSParam added in v0.1.7

func KernelDNSParam(dnsServers []string) string

KernelDNSParam returns a comma-separated DNS list for the matchlock.dns= cmdline param.

func KernelIPDNSSuffix added in v0.1.7

func KernelIPDNSSuffix(dnsServers []string) string

KernelIPDNSSuffix returns the DNS portion of the kernel ip= parameter. The ip= format only supports up to 2 DNS servers (`:dns0:dns1`).

Types

type Backend

type Backend interface {
	Create(ctx context.Context, config *VMConfig) (Machine, error)
	Name() string
}

type DiskConfig added in v0.1.6

type DiskConfig struct {
	HostPath   string // Path to the ext4 image on the host
	GuestMount string // Mount point inside the guest (e.g., "/var/lib/buildkit")
	ReadOnly   bool
}

DiskConfig describes an additional block device to attach to the VM.

type InteractiveMachine

type InteractiveMachine interface {
	Machine
	ExecInteractive(ctx context.Context, command string, opts *api.ExecOptions, rows, cols uint16, stdin io.Reader, stdout io.Writer, resizeCh <-chan [2]uint16) (int, error)
}

type Machine

type Machine interface {
	Start(ctx context.Context) error
	Stop(ctx context.Context) error
	Wait(ctx context.Context) error
	Exec(ctx context.Context, command string, opts *api.ExecOptions) (*api.ExecResult, error)
	NetworkFD() (int, error)
	VsockFD() (int, error)
	PID() int
	Close(ctx context.Context) error
	RootfsPath() string // Returns the path to the VM's rootfs (may be a temp copy)
}

type VMConfig

type VMConfig struct {
	ID              string
	KernelPath      string
	InitramfsPath   string // Optional initramfs/initrd path
	RootfsPath      string
	CPUs            int
	MemoryMB        int
	NetworkFD       int
	VsockCID        uint32
	VsockPath       string
	SocketPath      string
	LogPath         string
	KernelArgs      string
	Env             map[string]string
	GatewayIP       string       // Host TAP IP (e.g., 192.168.100.1)
	GuestIP         string       // Guest IP (e.g., 192.168.100.2)
	SubnetCIDR      string       // CIDR notation (e.g., 192.168.100.1/24)
	Workspace       string       // Guest VFS mount point (default: /workspace)
	UseInterception bool         // Use network interception (MITM proxy)
	Privileged      bool         // Skip in-guest security restrictions (seccomp, cap drop, no_new_privs)
	DNSServers      []string     // DNS servers for the guest (default: 8.8.8.8, 8.8.4.4)
	PrebuiltRootfs  string       // Pre-prepared rootfs path (skips internal copy if set)
	ExtraDisks      []DiskConfig // Additional block devices to attach
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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