Documentation
¶
Overview ¶
Package vzkit provides shared infrastructure for building macOS and Linux virtual machines using Apple's Virtualization framework via purego.
It extracts common VM plumbing — dispatch queues, run loops, completion handlers, vsock, VirtioFS, networking, and VM lifecycle management — so that higher-level tools (vz-macos, vz-container, etc.) can share one tested implementation instead of duplicating it.
The root package is the high-level path for basic virtual machine setup and lifecycle management. More focused domains live in subpackages such as audio, display, network, virtiofs, storage, restore, snapshot, vsock, balloon, vm, and privatevm. Lower-level private-API wrappers such as clipboard, capture, vnc, framebuffer, vminput, storagehotplug, usbpassthrough, debugstub, configcodec, and spice build on the generated bindings from github.com/tmc/apple. Experimental private-API wrappers live under the exp tree.
All Objective-C interop uses purego (cgo-free). The generated bindings from github.com/tmc/apple provide the type-safe wrappers.
Index ¶
- Constants
- Variables
- func AddAudioDevice(vmConfig vz.VZVirtualMachineConfiguration, cfg AudioConfig) error
- func AddMemoryBalloonDevice(config vz.VZVirtualMachineConfiguration)
- func AddRosettaSupport(config vz.VZVirtualMachineConfiguration) error
- func BuildLinuxVMConfig(cfg LinuxVMConfig) (vz.VZVirtualMachineConfiguration, error)
- func BuildMacVMConfig(cfg MacVMConfig) (vz.VZVirtualMachineConfiguration, error)
- func CanPause(queue *Queue, vm vz.VZVirtualMachine) bool
- func CanResume(queue *Queue, vm vz.VZVirtualMachine) bool
- func CanStart(queue *Queue, vm vz.VZVirtualMachine) bool
- func CanStop(queue *Queue, vm vz.VZVirtualMachine) bool
- func CreateAudioDevice(cfg AudioConfig) (vz.VZVirtioSoundDeviceConfiguration, error)
- func CreateBlockDevice(attachment vz.VZDiskImageStorageDeviceAttachment) vz.VZVirtioBlockDeviceConfiguration
- func CreateBridgedAttachment(identifier string, macNAT bool) (vz.VZNetworkDeviceAttachment, error)
- func CreateDirectoryShare(path string, readOnly bool) (vz.VZSingleDirectoryShare, error)
- func CreateDiskAttachment(path string, readOnly bool) (vz.VZDiskImageStorageDeviceAttachment, error)
- func CreateDiskImage(path string, sizeGB uint64) error
- func CreateHostOnlyNetworkAttachment() (vz.VZNetworkDeviceAttachment, error)
- func CreateMacGraphicsConfig(displays []DisplayConfig) (vz.VZMacGraphicsDeviceConfiguration, error)
- func CreateNATAttachment(isolate bool) (vz.VZNetworkDeviceAttachment, error)
- func CreateNetworkAttachment(config NetworkConfig) (vz.VZNetworkDeviceAttachment, error)
- func CreateNetworkDevice(config NetworkConfig) (vz.VZVirtioNetworkDeviceConfiguration, error)
- func CreateRosettaShare() (vz.VZLinuxRosettaDirectoryShare, error)
- func CreateSerialConsole(readFd, writeFd int) (vz.VZVirtioConsoleDeviceSerialPortConfiguration, error)
- func CreateStdioSerialConsole() (vz.VZVirtioConsoleDeviceSerialPortConfiguration, error)
- func CreateVM(config vz.VZVirtualMachineConfiguration, queue *Queue) vz.VZVirtualMachine
- func CreateVhostUserNetworkAttachment(cfg VhostUserNetworkConfig) (vz.VZNetworkDeviceAttachment, error)
- func CreateVirtioFSDevices(mounts []VolumeMount) ([]vz.VZVirtioFileSystemDeviceConfiguration, error)
- func CreateVirtioGraphicsConfig(displays []DisplayConfig) (vz.VZVirtioGraphicsDeviceConfiguration, error)
- func ExtractNSErrorMessage(nsError objc.ID) string
- func FormatNSErrorDetailed(nsError objc.ID) string
- func InstallRosetta(ctx context.Context) error
- func LookupBridgedNetworkInterface(identifier string) (vz.VZBridgedNetworkInterface, error)
- func NSDataFromBytes(data []byte) foundation.NSData
- func NSDataToBytes(data foundation.NSData) []byte
- func PauseVM(queue *Queue, vm vz.VZVirtualMachine, completion func(error))
- func PrintNSErrorDetailed(nsError objc.ID)
- func ResumeVM(queue *Queue, vm vz.VZVirtualMachine, completion func(error))
- func Retain(id interface{ ... })
- func RosettaAvailable() bool
- func RosettaSupported() bool
- func RunRunLoopAggressively()
- func RunRunLoopOnce()
- func RunRunLoopUntilDone(done func() bool, progress func())
- func SaveMacHardwareModel(stateDir string, hwModel vz.VZMacHardwareModel) error
- func SetBalloonTarget(queue *Queue, vm vz.VZVirtualMachine, sizeGB float64) error
- func SetVMCrashContextMessage(queue *Queue, vm vz.VZVirtualMachine, msg string)
- func SetVMName(queue *Queue, vm vz.VZVirtualMachine, name string)
- func SetupMacStateFromRestoreImage(stateDir string, info RestoreImageInfo) error
- func StartVM(queue *Queue, vm vz.VZVirtualMachine, completion func(error))
- func StopVM(queue *Queue, vm vz.VZVirtualMachine, completion func(error))
- func VMCanCreateCore(queue *Queue, vm vz.VZVirtualMachine) (bool, error)
- func VMCrashContextMessage(queue *Queue, vm vz.VZVirtualMachine) string
- func VMName(queue *Queue, vm vz.VZVirtualMachine) string
- func VMServicePID(queue *Queue, vm vz.VZVirtualMachine) (int, error)
- func VMShouldSendHIDReports(queue *Queue, vm vz.VZVirtualMachine) (bool, error)
- func VMState(queue *Queue, vm vz.VZVirtualMachine) vz.VZVirtualMachineState
- func VMStateDescription(queue *Queue, vm vz.VZVirtualMachine) (string, error)
- func ValidateConfig(config vz.VZVirtualMachineConfiguration) error
- type AudioConfig
- type BalloonInfo
- type DisplayConfig
- type DisplaySlice
- type ErrorCompletionHandler
- type LinuxVMConfig
- type MacVMConfig
- type NetworkConfig
- type NetworkMode
- type Queue
- type RestoreImageInfo
- type SnapshotManager
- type SnapshotMeta
- type VhostUserNetworkConfig
- type VolumeMount
- type VsockConn
- type VsockManager
Constants ¶
const ( NetworkModeNAT = networkx.ModeNAT NetworkModeBridged = networkx.ModeBridged NetworkModeHostOnly = networkx.ModeHostOnly NetworkModeVMNet = networkx.ModeVMNet NetworkModeNone = networkx.ModeNone )
const MacOSAutomountTag = virtiofsx.MacOSAutomountTag
MacOSAutomountTag requests the macOS guest automount tag.
Variables ¶
var ( ErrVMNotRunning = privatevmx.ErrVMNotRunning ErrVMNotStopped = privatevmx.ErrVMNotStopped )
Functions ¶
func AddAudioDevice ¶ added in v0.5.0
func AddAudioDevice(vmConfig vz.VZVirtualMachineConfiguration, cfg AudioConfig) error
AddAudioDevice creates an audio device and adds it to the VM configuration.
func AddMemoryBalloonDevice ¶
func AddMemoryBalloonDevice(config vz.VZVirtualMachineConfiguration)
AddMemoryBalloonDevice adds a VirtIO traditional memory balloon device.
func AddRosettaSupport ¶ added in v0.5.0
func AddRosettaSupport(config vz.VZVirtualMachineConfiguration) error
AddRosettaSupport adds a Rosetta directory sharing device to the given VM configuration. The Rosetta share is exposed via VirtioFS with the tag "rosetta". In the Linux guest, mount it with:
mount -t virtiofs rosetta /mnt/rosetta
Returns an error if Rosetta is not available on the host.
func BuildLinuxVMConfig ¶
func BuildLinuxVMConfig(cfg LinuxVMConfig) (vz.VZVirtualMachineConfiguration, error)
BuildLinuxVMConfig creates a VZVirtualMachineConfiguration from a LinuxVMConfig. It sets up platform, boot loader, storage, network, serial console, entropy, memory balloon, and vsock devices.
func BuildMacVMConfig ¶ added in v0.5.0
func BuildMacVMConfig(cfg MacVMConfig) (vz.VZVirtualMachineConfiguration, error)
BuildMacVMConfig creates a VZVirtualMachineConfiguration from a MacVMConfig.
func CanPause ¶ added in v0.5.0
func CanPause(queue *Queue, vm vz.VZVirtualMachine) bool
CanPause reports whether the VM is in a state that allows pausing.
func CanResume ¶ added in v0.5.0
func CanResume(queue *Queue, vm vz.VZVirtualMachine) bool
CanResume reports whether the VM is in a state that allows resuming.
func CanStart ¶
func CanStart(queue *Queue, vm vz.VZVirtualMachine) bool
CanStart reports whether the VM is in a state that allows starting.
func CanStop ¶
func CanStop(queue *Queue, vm vz.VZVirtualMachine) bool
CanStop reports whether the VM is in a state that allows stopping.
func CreateAudioDevice ¶ added in v0.5.0
func CreateAudioDevice(cfg AudioConfig) (vz.VZVirtioSoundDeviceConfiguration, error)
CreateAudioDevice creates a VZVirtioSoundDeviceConfiguration.
func CreateBlockDevice ¶
func CreateBlockDevice(attachment vz.VZDiskImageStorageDeviceAttachment) vz.VZVirtioBlockDeviceConfiguration
CreateBlockDevice creates a VZVirtioBlockDeviceConfiguration from a disk attachment.
func CreateBridgedAttachment ¶ added in v0.5.0
func CreateBridgedAttachment(identifier string, macNAT bool) (vz.VZNetworkDeviceAttachment, error)
CreateBridgedAttachment creates a bridged attachment.
func CreateDirectoryShare ¶
func CreateDirectoryShare(path string, readOnly bool) (vz.VZSingleDirectoryShare, error)
CreateDirectoryShare creates a VZSingleDirectoryShare for VirtioFS.
func CreateDiskAttachment ¶
func CreateDiskAttachment(path string, readOnly bool) (vz.VZDiskImageStorageDeviceAttachment, error)
CreateDiskAttachment creates a VZDiskImageStorageDeviceAttachment from a file path.
func CreateDiskImage ¶
CreateDiskImage creates a sparse disk image of the given size in gigabytes.
func CreateHostOnlyNetworkAttachment ¶ added in v0.5.0
func CreateHostOnlyNetworkAttachment() (vz.VZNetworkDeviceAttachment, error)
CreateHostOnlyNetworkAttachment creates a host-only attachment.
func CreateMacGraphicsConfig ¶
func CreateMacGraphicsConfig(displays []DisplayConfig) (vz.VZMacGraphicsDeviceConfiguration, error)
CreateMacGraphicsConfig creates a macOS graphics device configuration.
func CreateNATAttachment ¶ added in v0.5.0
func CreateNATAttachment(isolate bool) (vz.VZNetworkDeviceAttachment, error)
CreateNATAttachment creates a NAT attachment.
func CreateNetworkAttachment ¶
func CreateNetworkAttachment(config NetworkConfig) (vz.VZNetworkDeviceAttachment, error)
CreateNetworkAttachment creates a network device attachment based on config.
func CreateNetworkDevice ¶
func CreateNetworkDevice(config NetworkConfig) (vz.VZVirtioNetworkDeviceConfiguration, error)
CreateNetworkDevice creates a VZVirtioNetworkDeviceConfiguration with a random MAC.
func CreateRosettaShare ¶ added in v0.5.0
func CreateRosettaShare() (vz.VZLinuxRosettaDirectoryShare, error)
CreateRosettaShare creates a VZLinuxRosettaDirectoryShare for use with Linux virtual machines. Returns an error if Rosetta is not installed.
func CreateSerialConsole ¶
func CreateSerialConsole(readFd, writeFd int) (vz.VZVirtioConsoleDeviceSerialPortConfiguration, error)
CreateSerialConsole creates a VZVirtioConsoleDeviceSerialPortConfiguration.
func CreateStdioSerialConsole ¶
func CreateStdioSerialConsole() (vz.VZVirtioConsoleDeviceSerialPortConfiguration, error)
CreateStdioSerialConsole creates a serial console connected to stdin/stdout.
func CreateVM ¶
func CreateVM(config vz.VZVirtualMachineConfiguration, queue *Queue) vz.VZVirtualMachine
CreateVM creates a VZVirtualMachine bound to the given dispatch queue.
func CreateVhostUserNetworkAttachment ¶ added in v0.5.0
func CreateVhostUserNetworkAttachment(cfg VhostUserNetworkConfig) (vz.VZNetworkDeviceAttachment, error)
CreateVhostUserNetworkAttachment creates a private vhost-user attachment.
func CreateVirtioFSDevices ¶
func CreateVirtioFSDevices(mounts []VolumeMount) ([]vz.VZVirtioFileSystemDeviceConfiguration, error)
CreateVirtioFSDevices creates VirtioFS device configurations for the given mounts.
func CreateVirtioGraphicsConfig ¶
func CreateVirtioGraphicsConfig(displays []DisplayConfig) (vz.VZVirtioGraphicsDeviceConfiguration, error)
CreateVirtioGraphicsConfig creates a Virtio graphics device configuration.
func ExtractNSErrorMessage ¶
ExtractNSErrorMessage extracts the localized error message from an NSError. Returns an empty string if the error ID is zero.
func FormatNSErrorDetailed ¶
FormatNSErrorDetailed returns a multi-line string with full NSError details including domain, code, failure reason, recovery suggestion, user info, and underlying errors.
func InstallRosetta ¶ added in v0.5.0
InstallRosetta installs Rosetta on the host. It blocks until the installation completes or the context is cancelled.
func LookupBridgedNetworkInterface ¶ added in v0.5.0
func LookupBridgedNetworkInterface(identifier string) (vz.VZBridgedNetworkInterface, error)
LookupBridgedNetworkInterface resolves a bridged interface by identifier.
func NSDataFromBytes ¶
func NSDataFromBytes(data []byte) foundation.NSData
NSDataFromBytes creates an NSData object from Go bytes.
func NSDataToBytes ¶
func NSDataToBytes(data foundation.NSData) []byte
NSDataToBytes extracts the bytes from an NSData object into a Go-owned slice.
func PauseVM ¶ added in v0.5.0
func PauseVM(queue *Queue, vm vz.VZVirtualMachine, completion func(error))
PauseVM pauses a running VZVirtualMachine on its queue.
func PrintNSErrorDetailed ¶
PrintNSErrorDetailed prints detailed NSError information to stdout.
func ResumeVM ¶ added in v0.5.0
func ResumeVM(queue *Queue, vm vz.VZVirtualMachine, completion func(error))
ResumeVM resumes a paused VZVirtualMachine on its queue.
func Retain ¶
func Retain(id interface{ Retain() })
Retain retains an Objective-C object to prevent premature deallocation.
func RosettaAvailable ¶ added in v0.5.0
func RosettaAvailable() bool
RosettaAvailable reports whether Rosetta is available for Linux guests. Returns true only if Rosetta is installed on the host.
func RosettaSupported ¶ added in v0.5.0
func RosettaSupported() bool
RosettaSupported reports whether the current host supports Rosetta. Returns false on Intel Macs or other unsupported configurations.
func RunRunLoopAggressively ¶
func RunRunLoopAggressively()
RunRunLoopAggressively pumps both CFRunLoop and NSRunLoop multiple times.
func RunRunLoopOnce ¶
func RunRunLoopOnce()
RunRunLoopOnce runs the main CFRunLoop briefly to process pending callbacks.
func RunRunLoopUntilDone ¶
func RunRunLoopUntilDone(done func() bool, progress func())
RunRunLoopUntilDone runs the main run loop until done returns true.
func SaveMacHardwareModel ¶ added in v0.5.0
func SaveMacHardwareModel(stateDir string, hwModel vz.VZMacHardwareModel) error
SaveMacHardwareModel saves a hardware model's data representation to the state directory for later use by BuildMacVMConfig.
func SetBalloonTarget ¶
func SetBalloonTarget(queue *Queue, vm vz.VZVirtualMachine, sizeGB float64) error
SetBalloonTarget sets the memory balloon target size in gigabytes.
func SetVMCrashContextMessage ¶ added in v0.5.0
func SetVMCrashContextMessage(queue *Queue, vm vz.VZVirtualMachine, msg string)
SetVMCrashContextMessage sets the private _crashContextMessage property.
func SetVMName ¶ added in v0.5.0
func SetVMName(queue *Queue, vm vz.VZVirtualMachine, name string)
SetVMName sets the private _name property of a VZVirtualMachine.
func SetupMacStateFromRestoreImage ¶ added in v0.5.0
func SetupMacStateFromRestoreImage(stateDir string, info RestoreImageInfo) error
SetupMacStateFromRestoreImage extracts the hardware model from a RestoreImageInfo (obtained via FetchLatestRestoreImage or LoadRestoreImage) and initializes the state directory for BuildMacVMConfig. It saves the hardware model, creates a machine identifier, and creates the auxiliary storage.
Call this once before the first BuildMacVMConfig for a new VM. On subsequent boots, BuildMacVMConfig loads the persisted state directly.
func StartVM ¶
func StartVM(queue *Queue, vm vz.VZVirtualMachine, completion func(error))
StartVM starts a VZVirtualMachine on its queue.
func StopVM ¶
func StopVM(queue *Queue, vm vz.VZVirtualMachine, completion func(error))
StopVM requests a stop of a VZVirtualMachine on its queue.
func VMCanCreateCore ¶ added in v0.5.0
func VMCanCreateCore(queue *Queue, vm vz.VZVirtualMachine) (bool, error)
VMCanCreateCore returns the private _canCreateCore property of a running VM.
func VMCrashContextMessage ¶ added in v0.5.0
func VMCrashContextMessage(queue *Queue, vm vz.VZVirtualMachine) string
VMCrashContextMessage returns the private _crashContextMessage property.
func VMName ¶ added in v0.5.0
func VMName(queue *Queue, vm vz.VZVirtualMachine) string
VMName returns the private _name property of a VZVirtualMachine.
func VMServicePID ¶ added in v0.5.0
func VMServicePID(queue *Queue, vm vz.VZVirtualMachine) (int, error)
VMServicePID returns the private _serviceProcessIdentifier of a running VM.
func VMShouldSendHIDReports ¶ added in v0.5.0
func VMShouldSendHIDReports(queue *Queue, vm vz.VZVirtualMachine) (bool, error)
VMShouldSendHIDReports returns the private _shouldSendHIDReports property.
func VMState ¶
func VMState(queue *Queue, vm vz.VZVirtualMachine) vz.VZVirtualMachineState
VMState returns the current state of a VZVirtualMachine.
func VMStateDescription ¶ added in v0.5.0
func VMStateDescription(queue *Queue, vm vz.VZVirtualMachine) (string, error)
VMStateDescription returns the private _stateDescription of a running VM.
func ValidateConfig ¶
func ValidateConfig(config vz.VZVirtualMachineConfiguration) error
ValidateConfig validates a VZVirtualMachineConfiguration and returns any error.
Types ¶
type AudioConfig ¶ added in v0.5.0
AudioConfig holds audio device configuration settings.
type BalloonInfo ¶
BalloonInfo contains memory balloon device information.
func GetBalloonInfo ¶
func GetBalloonInfo(queue *Queue, vm vz.VZVirtualMachine) (BalloonInfo, error)
GetBalloonInfo retrieves memory balloon information from a running VM.
type DisplayConfig ¶
DisplayConfig describes a single display.
func DefaultDisplayConfig ¶
func DefaultDisplayConfig() DisplayConfig
DefaultDisplayConfig returns the default macOS display configuration.
func DefaultLinuxDisplayConfig ¶
func DefaultLinuxDisplayConfig() DisplayConfig
DefaultLinuxDisplayConfig returns the default Linux display configuration.
func ParseDisplaySpec ¶
func ParseDisplaySpec(s string) (DisplayConfig, error)
ParseDisplaySpec parses a display specification.
type DisplaySlice ¶
DisplaySlice is a convenience wrapper for repeated display flags.
type ErrorCompletionHandler ¶
type ErrorCompletionHandler struct {
// contains filtered or unexported fields
}
ErrorCompletionHandler captures an optional NSError from an Objective-C completion handler callback (void (^)(NSError *)).
Usage:
h := vmkit.NewErrorCompletionHandler()
objcMethod(h.Block())
h.Wait()
if err := h.Error(); err != nil { ... }
func NewErrorCompletionHandler ¶
func NewErrorCompletionHandler() *ErrorCompletionHandler
NewErrorCompletionHandler creates a completion handler for error-only callbacks.
func (*ErrorCompletionHandler) Block ¶
func (h *ErrorCompletionHandler) Block() objc.Block
Block returns the underlying objc.Block for passing to Objective-C methods.
func (*ErrorCompletionHandler) Done ¶
func (h *ErrorCompletionHandler) Done() bool
Done reports whether the completion handler has been called.
func (*ErrorCompletionHandler) Error ¶
func (h *ErrorCompletionHandler) Error() error
Error returns the error if one was received, or nil.
func (*ErrorCompletionHandler) Wait ¶
func (h *ErrorCompletionHandler) Wait()
Wait blocks until the completion handler is called.
type LinuxVMConfig ¶
type LinuxVMConfig struct {
CPUs uint // Number of CPUs
MemoryGB uint64 // Memory in gigabytes
DiskPath string // Path to the main disk image
ISOPath string // Optional ISO to attach as second block device (read-only)
// Boot mode: set KernelPath for direct boot, leave empty for EFI boot.
KernelPath string
InitrdPath string
CmdLine string
// EFI state directory (for efi.nvram and linux-machine.id).
StateDir string
// Nested virtualization (requires macOS 15+, M3+ chip).
// Defaults to true; set to false to disable.
NestedVirtualization *bool
// Peripherals
Volumes []VolumeMount // VirtioFS mounts
Network NetworkConfig // Network configuration
Audio *AudioConfig // Audio device configuration (nil for no audio)
Headless bool // Skip graphics if true
}
LinuxVMConfig describes the configuration for a Linux virtual machine.
type MacVMConfig ¶ added in v0.5.0
type MacVMConfig struct {
CPUs uint // Number of CPUs
MemoryGB uint64 // Memory in gigabytes
DiskPath string // Path to the main disk image
// StateDir stores persistent machine state (hardware model, machine
// identifier, auxiliary storage). Required.
StateDir string
// HardwareModel is the hardware model data representation. If nil, it is
// loaded from StateDir. For first-time setup, obtain a hardware model
// from a VZMacOSRestoreImage and save it to StateDir before calling
// BuildMacVMConfig.
HardwareModel []byte
// Peripherals
Displays []DisplayConfig // Graphics displays (default: 1920x1200 @ 144 PPI)
Volumes []VolumeMount // VirtioFS mounts
Network NetworkConfig // Network configuration
Audio *AudioConfig // Audio device configuration (nil for no audio)
Headless bool // Skip graphics, keyboard, and trackpad if true
}
MacVMConfig describes the configuration for a macOS virtual machine.
type NetworkConfig ¶
NetworkConfig holds network configuration settings.
func ParseNetworkMode ¶
func ParseNetworkMode(s string) (NetworkConfig, error)
ParseNetworkMode parses a network mode string.
type NetworkMode ¶
NetworkMode represents the type of network configuration.
type Queue ¶
Queue wraps a dispatch queue for VM operations.
type RestoreImageInfo ¶ added in v0.5.0
RestoreImageInfo describes a macOS restore image (.ipsw).
func FetchLatestRestoreImage ¶ added in v0.5.0
func FetchLatestRestoreImage(ctx context.Context) (RestoreImageInfo, error)
FetchLatestRestoreImage fetches information about the latest supported restore image.
func LoadRestoreImage ¶ added in v0.5.0
func LoadRestoreImage(ctx context.Context, path string) (RestoreImageInfo, error)
LoadRestoreImage loads a macOS restore image from a local .ipsw file.
type SnapshotManager ¶
SnapshotManager handles VM state snapshot operations.
func NewSnapshotManager ¶
func NewSnapshotManager(vmDir string) *SnapshotManager
NewSnapshotManager creates a snapshot manager for the given VM directory.
type SnapshotMeta ¶
SnapshotMeta is the on-disk metadata format for VM state snapshots.
type VhostUserNetworkConfig ¶ added in v0.5.0
type VhostUserNetworkConfig = networkx.VhostUserConfig
VhostUserNetworkConfig describes a private vhost-user network attachment.
func DefaultVhostUserNetworkConfig ¶ added in v0.5.0
func DefaultVhostUserNetworkConfig(interfaceName string) VhostUserNetworkConfig
DefaultVhostUserNetworkConfig returns a config populated with framework defaults.
type VolumeMount ¶
VolumeMount represents a host-to-guest volume mount configuration.
func ParseVolumeSpec ¶
func ParseVolumeSpec(spec string) (VolumeMount, error)
ParseVolumeSpec parses a docker-style volume specification.
type VsockConn ¶
VsockConn wraps a VZVirtioSocketConnection as a net.Conn.
func NewVsockConn ¶
func NewVsockConn(vzConn vz.VZVirtioSocketConnection) (*VsockConn, error)
NewVsockConn converts a VZVirtioSocketConnection into a net.Conn.
type VsockManager ¶
VsockManager manages the VZVirtioSocketDevice for a running VM.
func NewVsockManager ¶
func NewVsockManager(vm vz.VZVirtualMachine) (*VsockManager, error)
NewVsockManager wraps the first VZVirtioSocketDevice from a running VM.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package audio provides sound device helpers for Apple Virtualization VMs.
|
Package audio provides sound device helpers for Apple Virtualization VMs. |
|
Package balloon provides memory balloon helpers for running virtual machines.
|
Package balloon provides memory balloon helpers for running virtual machines. |
|
Package capture provides image conversion and processing utilities for VM screenshot workflows.
|
Package capture provides image conversion and processing utilities for VM screenshot workflows. |
|
Package clipboard configures host-guest clipboard sharing via SPICE agent.
|
Package clipboard configures host-guest clipboard sharing via SPICE agent. |
|
Package configcodec provides virtual machine configuration encoding helpers.
|
Package configcodec provides virtual machine configuration encoding helpers. |
|
Package debugstub provides debug stub configuration helpers.
|
Package debugstub provides debug stub configuration helpers. |
|
Package disk provides helpers for managing macOS disk images via hdiutil.
|
Package disk provides helpers for managing macOS disk images via hdiutil. |
|
Package display provides display specifications and graphics device builders for Virtualization framework guests.
|
Package display provides display specifications and graphics device builders for Virtualization framework guests. |
|
Package exp contains experimental wrappers for private or unstable Virtualization.framework features.
|
Package exp contains experimental wrappers for private or unstable Virtualization.framework features. |
|
accelerator
Package accelerator provides experimental accelerator device helpers.
|
Package accelerator provides experimental accelerator device helpers. |
|
biometric
Package biometric provides experimental biometric device configuration helpers.
|
Package biometric provides experimental biometric device configuration helpers. |
|
custommmio
Package custommmio provides experimental custom MMIO device helpers.
|
Package custommmio provides experimental custom MMIO device helpers. |
|
customvirtio
Package customvirtio provides experimental custom Virtio device helpers.
|
Package customvirtio provides experimental custom Virtio device helpers. |
|
mailbox
Package mailbox provides experimental mailbox device helpers.
|
Package mailbox provides experimental mailbox device helpers. |
|
power
Package power provides experimental power source device helpers.
|
Package power provides experimental power source device helpers. |
|
Package framebuffer provides direct framebuffer access and capture helpers.
|
Package framebuffer provides direct framebuffer access and capture helpers. |
|
Package input provides CGEvent-based keyboard and mouse input helpers.
|
Package input provides CGEvent-based keyboard and mouse input helpers. |
|
Package network provides network configuration helpers for Apple Virtualization virtual machines.
|
Package network provides network configuration helpers for Apple Virtualization virtual machines. |
|
Package ocr provides text recognition using Apple's Vision framework.
|
Package ocr provides text recognition using Apple's Vision framework. |
|
Package privatevm provides focused wrappers for private Virtualization.framework VM selectors.
|
Package privatevm provides focused wrappers for private Virtualization.framework VM selectors. |
|
Package restore provides helpers for working with macOS restore images.
|
Package restore provides helpers for working with macOS restore images. |
|
Package snapshot provides VM state snapshot helpers.
|
Package snapshot provides VM state snapshot helpers. |
|
Package spice provides SPICE agent integration helpers.
|
Package spice provides SPICE agent integration helpers. |
|
Package storage provides common storage and serial-console helpers for Apple Virtualization VMs.
|
Package storage provides common storage and serial-console helpers for Apple Virtualization VMs. |
|
Package storagehotplug provides runtime storage device management.
|
Package storagehotplug provides runtime storage device management. |
|
Package usbhid provides safe HID input event helpers for Apple Virtualization framework virtual machines.
|
Package usbhid provides safe HID input event helpers for Apple Virtualization framework virtual machines. |
|
Package usbpassthrough provides runtime USB passthrough helpers.
|
Package usbpassthrough provides runtime USB passthrough helpers. |
|
Package virtiofs provides VirtioFS configuration helpers for Apple Virtualization VMs.
|
Package virtiofs provides VirtioFS configuration helpers for Apple Virtualization VMs. |
|
Package vm provides the core runtime helpers for Apple Virtualization VMs.
|
Package vm provides the core runtime helpers for Apple Virtualization VMs. |
|
Package vminput provides direct virtual-machine input injection helpers.
|
Package vminput provides direct virtual-machine input injection helpers. |
|
Package vnc provides headless remote display serving for virtual machines.
|
Package vnc provides headless remote display serving for virtual machines. |
|
Package vsock provides Go net.Conn adapters for Virtio socket connections and helpers for connecting to a guest over vsock.
|
Package vsock provides Go net.Conn adapters for Virtio socket connections and helpers for connecting to a guest over vsock. |