Help us shape the future of Go! Take the 2026 Go Developer Survey

vz

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2026 License: MIT Imports: 26 Imported by: 0

Documentation

Rendered for darwin/amd64

Overview

Package vz implements the hypervisor.Hypervisor interface for Apple's Virtualization.framework on macOS via the vz-shim subprocess.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewVsockDialer

func NewVsockDialer(vsockSocket string, vsockCID int64) hypervisor.VsockDialer

NewVsockDialer creates a new VsockDialer for vz. vsockSocket is the path to the vz.vsock Unix socket proxy. vsockCID is unused because the vz proxy is per-VM (unlike QEMU which uses kernel AF_VSOCK with CID routing).

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client implements hypervisor.Hypervisor via HTTP to the vz-shim process.

func NewClient

func NewClient(socketPath string) (*Client, error)

NewClient creates a new vz shim client.

func (*Client) Capabilities

func (c *Client) Capabilities() hypervisor.Capabilities

func (*Client) DeleteVM

func (c *Client) DeleteVM(ctx context.Context) error

func (*Client) GetTargetGuestMemoryBytes added in v0.1.0

func (c *Client) GetTargetGuestMemoryBytes(ctx context.Context) (int64, error)

func (*Client) GetVMInfo

func (c *Client) GetVMInfo(ctx context.Context) (*hypervisor.VMInfo, error)

func (*Client) Pause

func (c *Client) Pause(ctx context.Context) error

func (*Client) ResizeMemory

func (c *Client) ResizeMemory(ctx context.Context, bytes int64) error

func (*Client) ResizeMemoryAndWait

func (c *Client) ResizeMemoryAndWait(ctx context.Context, bytes int64, timeout time.Duration) error

func (*Client) Resume

func (c *Client) Resume(ctx context.Context) error

func (*Client) SetTargetGuestMemoryBytes added in v0.1.0

func (c *Client) SetTargetGuestMemoryBytes(ctx context.Context, targetBytes int64) error

func (*Client) Shutdown

func (c *Client) Shutdown(ctx context.Context) error

func (*Client) Snapshot

func (c *Client) Snapshot(ctx context.Context, destPath string, _ hypervisor.SnapshotOptions) error

type Starter

type Starter struct{}

Starter implements hypervisor.VMStarter for Virtualization.framework.

func NewStarter

func NewStarter() *Starter

NewStarter creates a new vz starter.

func (*Starter) GetBinaryPath

func (s *Starter) GetBinaryPath(p *paths.Paths, version string) (string, error)

GetBinaryPath extracts the embedded vz-shim and returns its path.

func (*Starter) GetVersion

func (s *Starter) GetVersion(p *paths.Paths) (string, error)

GetVersion returns "vz-shim".

func (*Starter) PrepareFork added in v0.0.7

PrepareFork prepares VZ snapshot state for forked instances. For stopped forks (no snapshot), this is a no-op.

func (*Starter) RestoreVM

func (s *Starter) RestoreVM(ctx context.Context, p *paths.Paths, version string, socketPath string, snapshotPath string, _ hypervisor.RestoreOptions) (int, hypervisor.Hypervisor, error)

RestoreVM starts a vz-shim process and restores VM state from a snapshot. The VM is in paused state after restore; caller should call Resume().

func (*Starter) SocketName

func (s *Starter) SocketName() string

func (*Starter) StartVM

func (s *Starter) StartVM(ctx context.Context, p *paths.Paths, version string, socketPath string, config hypervisor.VMConfig) (int, hypervisor.Hypervisor, error)

StartVM spawns a vz-shim subprocess to host the VM.

type VsockDialer

type VsockDialer struct {
	// contains filtered or unexported fields
}

VsockDialer implements hypervisor.VsockDialer for vz via the shim's Unix socket proxy. Uses the same protocol as Cloud Hypervisor: CONNECT {port}\n -> OK {port}\n

func (*VsockDialer) DialVsock

func (d *VsockDialer) DialVsock(ctx context.Context, port int) (net.Conn, error)

DialVsock connects to the guest on the specified port via the shim's vsock proxy.

func (*VsockDialer) Key

func (d *VsockDialer) Key() string

Key returns a unique identifier for this dialer, used for connection pooling.

Directories

Path Synopsis
Package shimconfig defines the configuration types shared between the hypeman API server and the vz-shim subprocess.
Package shimconfig defines the configuration types shared between the hypeman API server and the vz-shim subprocess.

Jump to

Keyboard shortcuts

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