darwin

package
v0.2.9 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2026 License: MIT Imports: 20 Imported by: 0

Documentation

Rendered for darwin/amd64

Index

Constants

View Source
const (
	VsockPortExec  = 5000
	VsockPortVFS   = 5001
	VsockPortReady = 5002
)

Variables

View Source
var (
	ErrKernelNotFound  = errors.New("kernel not found")
	ErrRootfsNotFound  = errors.New("rootfs not found")
	ErrVMConfigInvalid = errors.New("VM configuration validation failed")
	ErrInvalidCPUCount = errors.New("invalid cpu count")
)

Config errors

View Source
var (
	ErrVMStart    = errors.New("failed to start VM")
	ErrVMNotReady = errors.New("VM failed to become ready")
	ErrVMReady    = errors.New("timeout waiting for VM ready signal")
	ErrVMCreate   = errors.New("failed to create virtual machine")
)

VM lifecycle errors

View Source
var (
	ErrCopyRootfs      = errors.New("failed to copy rootfs")
	ErrDiskAttachment  = errors.New("failed to create disk attachment")
	ErrStorageConfig   = errors.New("failed to create storage config")
	ErrExtraDiskAttach = errors.New("failed to create extra disk attachment")
	ErrExtraDiskConfig = errors.New("failed to create extra disk config")
)

Storage errors

View Source
var (
	ErrSocketPair       = errors.New("failed to create socket pair")
	ErrFileHandleAttach = errors.New("failed to create file handle network attachment")
	ErrNATAttach        = errors.New("failed to create NAT network attachment")
	ErrNetworkConfig    = errors.New("failed to create network config")
	ErrMACAddress       = errors.New("failed to generate MAC address")
)

Network errors

View Source
var (
	ErrBootLoader    = errors.New("failed to create boot loader")
	ErrVMConfig      = errors.New("failed to create VM configuration")
	ErrVsockConfig   = errors.New("failed to create vsock config")
	ErrEntropyConfig = errors.New("failed to create entropy config")
	ErrNoVsockDevice = errors.New("no vsock device available")
	ErrVsockFD       = errors.New("vsock FD not available; use SocketDevice() for native vsock")
)

Device errors

View Source
var (
	ErrConsoleLog    = errors.New("failed to create console log")
	ErrConsoleConfig = errors.New("failed to configure console")
	ErrDevNull       = errors.New("failed to open /dev/null for reading")
	ErrSerialAttach  = errors.New("failed to create serial attachment")
	ErrConsoleDevice = errors.New("failed to create console config")
)

Console errors

View Source
var (
	ErrExecConnect     = errors.New("failed to connect to exec service")
	ErrExecEncode      = errors.New("failed to encode exec request")
	ErrExecEncodeReq   = errors.New("failed to encode request")
	ErrExecWriteHeader = errors.New("failed to write header")
	ErrExecWriteReq    = errors.New("failed to write request")
	ErrExecReadHeader  = errors.New("failed to read response header")
	ErrExecReadData    = errors.New("failed to read response data")
	ErrExecDecode      = errors.New("failed to decode exec response")
	ErrExecRemote      = errors.New("exec error")
)

Exec errors

View Source
var (
	ErrStop              = errors.New("stop")
	ErrCloseVFSListener  = errors.New("close vfs listener")
	ErrCloseSocketPair   = errors.New("close socket pair")
	ErrCloseConsoleFiles = errors.New("close console files")
)

Close errors

Functions

func CopyRootfsToTemp

func CopyRootfsToTemp(srcPath string) (string, error)

CopyRootfsToTemp copies the rootfs image to a temp file so each VM gets a clean copy

Types

type DarwinBackend

type DarwinBackend struct{}

func NewDarwinBackend

func NewDarwinBackend() *DarwinBackend

func (*DarwinBackend) Create

func (b *DarwinBackend) Create(ctx context.Context, config *vm.VMConfig) (vm.Machine, error)

func (*DarwinBackend) Name

func (b *DarwinBackend) Name() string

type DarwinMachine

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

func (*DarwinMachine) Close

func (m *DarwinMachine) Close(ctx context.Context) error

func (*DarwinMachine) Config

func (m *DarwinMachine) Config() *vm.VMConfig

func (*DarwinMachine) DialVsock added in v0.1.20

func (m *DarwinMachine) DialVsock(port uint32) (net.Conn, error)

DialVsock opens a host-initiated vsock stream to a guest service port.

func (*DarwinMachine) Exec

func (m *DarwinMachine) Exec(ctx context.Context, command string, opts *api.ExecOptions) (*api.ExecResult, error)

func (*DarwinMachine) ExecInteractive

func (m *DarwinMachine) ExecInteractive(ctx context.Context, command string, opts *api.ExecOptions, rows, cols uint16, stdin io.Reader, stdout io.Writer, resizeCh <-chan [2]uint16) (int, error)

func (*DarwinMachine) ListFiles added in v0.1.25

func (m *DarwinMachine) ListFiles(ctx context.Context, path string) ([]api.FileInfo, error)

func (*DarwinMachine) NetworkFD

func (m *DarwinMachine) NetworkFD() (int, error)

func (*DarwinMachine) NetworkFile

func (m *DarwinMachine) NetworkFile() *os.File

func (*DarwinMachine) PID

func (m *DarwinMachine) PID() int

func (*DarwinMachine) ReadFile added in v0.1.25

func (m *DarwinMachine) ReadFile(ctx context.Context, path string) ([]byte, error)

func (*DarwinMachine) RootfsPath

func (m *DarwinMachine) RootfsPath() string

func (*DarwinMachine) SetupVFSListener

func (m *DarwinMachine) SetupVFSListener() (*vz.VirtioSocketListener, error)

func (*DarwinMachine) SocketDevice

func (m *DarwinMachine) SocketDevice() *vz.VirtioSocketDevice

func (*DarwinMachine) Start

func (m *DarwinMachine) Start(ctx context.Context) error

func (*DarwinMachine) Stop

func (m *DarwinMachine) Stop(ctx context.Context) error

func (*DarwinMachine) VsockFD

func (m *DarwinMachine) VsockFD() (int, error)

func (*DarwinMachine) Wait

func (m *DarwinMachine) Wait(ctx context.Context) error

func (*DarwinMachine) WriteFile added in v0.1.25

func (m *DarwinMachine) WriteFile(ctx context.Context, path string, content []byte, mode uint32) error

type SocketPair

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

func (*SocketPair) Close

func (sp *SocketPair) Close() error

func (*SocketPair) GuestFD

func (sp *SocketPair) GuestFD() int

func (*SocketPair) GuestFile

func (sp *SocketPair) GuestFile() *os.File

func (*SocketPair) HostFD

func (sp *SocketPair) HostFD() int

func (*SocketPair) HostFile

func (sp *SocketPair) HostFile() *os.File

Jump to

Keyboard shortcuts

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