Documentation
¶
Overview ¶
Package macos provides macOS native virtualization.
Package macos provides macOS native virtualization backends. On non-darwin platforms, all backends are stubs that report unavailable and return errors when invoked.
Index ¶
- func DefaultVMImage(arch string) string
- func GenerateSandboxProfile(rootfs string, readOnly bool, network string) string
- type Backend
- type Capabilities
- type FSShare
- type PortForward
- type QEMUBackend
- func (b *QEMUBackend) Available() bool
- func (b *QEMUBackend) CreateVM(_ *VMConfig) error
- func (b *QEMUBackend) DeleteVM(_ string) error
- func (b *QEMUBackend) ForwardPort(_, _ int, _ string) error
- func (b *QEMUBackend) MinVersion() string
- func (b *QEMUBackend) Name() string
- func (b *QEMUBackend) RemoveForwardPort(_ int, _ string) error
- func (b *QEMUBackend) ShareHostDir(_, _, _ string, _ bool) error
- func (b *QEMUBackend) StartVM(_ string) error
- func (b *QEMUBackend) Stats(_ string) (*VMStats, error)
- func (b *QEMUBackend) StopVM(_ string, _ int) error
- func (b *QEMUBackend) UnshareHostDir(_ string) error
- func (b *QEMUBackend) VMStatus(_ string) (string, error)
- type SandboxBackend
- func (b *SandboxBackend) Available() bool
- func (b *SandboxBackend) CreateVM(_ *VMConfig) error
- func (b *SandboxBackend) DeleteVM(_ string) error
- func (b *SandboxBackend) ForwardPort(_, _ int, _ string) error
- func (b *SandboxBackend) MinVersion() string
- func (b *SandboxBackend) Name() string
- func (b *SandboxBackend) RemoveForwardPort(_ int, _ string) error
- func (b *SandboxBackend) ShareHostDir(_, _, _ string, _ bool) error
- func (b *SandboxBackend) StartVM(_ string) error
- func (b *SandboxBackend) Stats(_ string) (*VMStats, error)
- func (b *SandboxBackend) StopVM(_ string, _ int) error
- func (b *SandboxBackend) UnshareHostDir(_ string) error
- func (b *SandboxBackend) VMStatus(_ string) (string, error)
- type VMConfig
- type VMStats
- type VZBackend
- func (b *VZBackend) Available() bool
- func (b *VZBackend) CreateVM(_ *VMConfig) error
- func (b *VZBackend) DeleteVM(_ string) error
- func (b *VZBackend) ForwardPort(_, _ int, _ string) error
- func (b *VZBackend) MinVersion() string
- func (b *VZBackend) Name() string
- func (b *VZBackend) RemoveForwardPort(_ int, _ string) error
- func (b *VZBackend) ShareHostDir(_, _, _ string, _ bool) error
- func (b *VZBackend) StartVM(_ string) error
- func (b *VZBackend) Stats(_ string) (*VMStats, error)
- func (b *VZBackend) StopVM(_ string, _ int) error
- func (b *VZBackend) UnshareHostDir(_ string) error
- func (b *VZBackend) VMStatus(_ string) (string, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultVMImage ¶
DefaultVMImage returns the default VM image path for the given arch.
func GenerateSandboxProfile ¶
GenerateSandboxProfile produces a sandbox-exec profile string. The profile is tightened: process-exec is scoped to the rootfs and system paths (not unrestricted), mach-lookup is restricted to named services, and ipc-posix-shm is scoped.
Types ¶
type Backend ¶
type Backend interface {
Name() string
Available() bool
MinVersion() string
CreateVM(cfg *VMConfig) error
StartVM(id string) error
StopVM(id string, timeoutSec int) error
DeleteVM(id string) error
VMStatus(id string) (string, error)
ForwardPort(hostPort, guestPort int, proto string) error
RemoveForwardPort(hostPort int, proto string) error
Stats(id string) (*VMStats, error)
}
func SelectBackend ¶
func SelectBackend(caps *Capabilities) (Backend, error)
SelectBackend selects the best available backend based on detected capabilities. Returns (backend, error) — the error is non-nil if no backend is available.
type Capabilities ¶
type Capabilities struct {
Version string
Arch string
IsTahoe bool
IsAppleSilicon bool
ASIF bool
NFSv41 bool
VZ bool
VirtioFS bool
Rosetta bool
Hypervisor bool
QEMU bool
Sandbox bool
BestBackend string
}
func DetectCapabilities ¶
func DetectCapabilities() *Capabilities
type PortForward ¶
type QEMUBackend ¶
type QEMUBackend struct{}
QEMUBackend is a stub for the QEMU-based macOS virtualization backend.
func (*QEMUBackend) Available ¶
func (b *QEMUBackend) Available() bool
func (*QEMUBackend) CreateVM ¶
func (b *QEMUBackend) CreateVM(_ *VMConfig) error
func (*QEMUBackend) DeleteVM ¶
func (b *QEMUBackend) DeleteVM(_ string) error
func (*QEMUBackend) ForwardPort ¶
func (b *QEMUBackend) ForwardPort(_, _ int, _ string) error
func (*QEMUBackend) MinVersion ¶
func (b *QEMUBackend) MinVersion() string
func (*QEMUBackend) Name ¶
func (b *QEMUBackend) Name() string
func (*QEMUBackend) RemoveForwardPort ¶
func (b *QEMUBackend) RemoveForwardPort(_ int, _ string) error
func (*QEMUBackend) ShareHostDir ¶
func (b *QEMUBackend) ShareHostDir(_, _, _ string, _ bool) error
func (*QEMUBackend) StartVM ¶
func (b *QEMUBackend) StartVM(_ string) error
func (*QEMUBackend) UnshareHostDir ¶
func (b *QEMUBackend) UnshareHostDir(_ string) error
type SandboxBackend ¶
type SandboxBackend struct{}
SandboxBackend uses macOS sandbox-exec to run processes in a restricted sandbox profile. This is the lightest isolation backend and does not require Hypervisor.framework.
func (*SandboxBackend) Available ¶
func (b *SandboxBackend) Available() bool
func (*SandboxBackend) CreateVM ¶
func (b *SandboxBackend) CreateVM(_ *VMConfig) error
func (*SandboxBackend) DeleteVM ¶
func (b *SandboxBackend) DeleteVM(_ string) error
func (*SandboxBackend) ForwardPort ¶
func (b *SandboxBackend) ForwardPort(_, _ int, _ string) error
func (*SandboxBackend) MinVersion ¶
func (b *SandboxBackend) MinVersion() string
func (*SandboxBackend) Name ¶
func (b *SandboxBackend) Name() string
func (*SandboxBackend) RemoveForwardPort ¶
func (b *SandboxBackend) RemoveForwardPort(_ int, _ string) error
func (*SandboxBackend) ShareHostDir ¶
func (b *SandboxBackend) ShareHostDir(_, _, _ string, _ bool) error
func (*SandboxBackend) StartVM ¶
func (b *SandboxBackend) StartVM(_ string) error
func (*SandboxBackend) UnshareHostDir ¶
func (b *SandboxBackend) UnshareHostDir(_ string) error
type VZBackend ¶
type VZBackend struct{}
VZBackend is a stub for the macOS Virtualization framework backend.