Hypervisors
Module: forge.lthn.ai/core/go-container
Interface
type Hypervisor interface {
Name() string
Available() bool
BuildCommand(ctx, image string, opts *HypervisorOptions) (*exec.Cmd, error)
}
QEMU
NewQemuHypervisor() — Default binary: qemu-system-x86_64.
Features:
- KVM acceleration on Linux (
/dev/kvm)
- HVF acceleration on macOS (
-accel hvf)
- Nographic mode with serial console on stdio
- User networking with port forwarding (
hostfwd)
- Virtio-9p filesystem shares for volumes
- Supports all image formats (ISO as
-cdrom, others as -drive)
Hyperkit
NewHyperkitHypervisor() — macOS-only, default binary: hyperkit.
Features:
- ACPI support
- Virtio-blk for disk images
- Slirp networking with port forwarding
- Serial console on stdio
- PCI slot-based device assignment
Detection
DetectHypervisor() priority:
- Hyperkit (macOS only, if installed)
- QEMU (all platforms)
- Error if neither available
GetHypervisor(name) returns a specific hypervisor by name ("qemu" or "hyperkit").