Documentation
¶
Overview ¶
Package configcodec provides virtual machine configuration encoding helpers.
It is intended to wrap the private configuration encoder, decoder, start options, and save options APIs so callers can serialize VM configurations, restore them later, and opt into private save or start behaviors such as compression, encryption, DFU, or iBoot stop points.
The package should cover:
Encoding and decoding configurations Builders for save and start option values Helpers that keep path handling explicit and predictable
This package complements snapshot and lifecycle helpers in the parent vzkit package.
Index ¶
- Variables
- func Decode(data []byte, format Format) (pvz.VZVirtualMachineConfiguration, error)
- func DecodeAtBasePath(basePath string, data []byte, format Format) (pvz.VZVirtualMachineConfiguration, error)
- func Encode(configuration objectivec.IObject, format Format) ([]byte, error)
- func EncodeAtBasePath(basePath string, configuration objectivec.IObject, format Format) ([]byte, error)
- type Decoder
- type Encoder
- type Format
- type MacStartConfig
- type MacStartOptions
- type SaveOptions
- type StartConfig
- type StartOptions
Constants ¶
This section is empty.
Variables ¶
var ErrUnsupportedFormat = fmt.Errorf("unsupported configuration format")
ErrUnsupportedFormat reports a missing encoding/decoding format.
Functions ¶
func Decode ¶
func Decode(data []byte, format Format) (pvz.VZVirtualMachineConfiguration, error)
Decode decodes bytes into a VM configuration using the default decoder.
func DecodeAtBasePath ¶
func DecodeAtBasePath(basePath string, data []byte, format Format) (pvz.VZVirtualMachineConfiguration, error)
DecodeAtBasePath decodes bytes using a decoder rooted at basePath.
func Encode ¶
func Encode(configuration objectivec.IObject, format Format) ([]byte, error)
Encode encodes configuration to bytes using the default encoder.
func EncodeAtBasePath ¶
func EncodeAtBasePath(basePath string, configuration objectivec.IObject, format Format) ([]byte, error)
EncodeAtBasePath encodes configuration with a file URL base path.
Types ¶
type Decoder ¶
type Decoder struct {
// contains filtered or unexported fields
}
Decoder wraps the private configuration decoder.
func NewDecoderWithBasePath ¶
NewDecoderWithBasePath creates a decoder rooted at a file URL for basePath.
func NewDecoderWithBaseURL ¶
func NewDecoderWithBaseURL(url foundation.INSURL) Decoder
NewDecoderWithBaseURL creates a decoder rooted at baseURL.
func (Decoder) Configuration ¶
func (d Decoder) Configuration(data objectivec.IObject, format unsafe.Pointer) (objectivec.IObject, error)
Configuration decodes configuration data.
type Encoder ¶
type Encoder struct {
// contains filtered or unexported fields
}
Encoder wraps the private configuration encoder.
func NewEncoderWithBasePath ¶
NewEncoderWithBasePath creates a configuration encoder rooted at a file URL for basePath.
func NewEncoderWithBaseURL ¶
func NewEncoderWithBaseURL(url foundation.INSURL) Encoder
NewEncoderWithBaseURL creates a configuration encoder rooted at baseURL.
func (Encoder) Bytes ¶
Bytes encodes the configuration and returns the raw bytes from the resulting NSData.
func (Encoder) Data ¶
func (e Encoder) Data(configuration objectivec.IObject, format uint64) (objectivec.IObject, error)
Data encodes the configuration into opaque data.
type Format ¶
type Format uint64
Format identifies a Virtualization configuration format.
const DefaultFormat Format = 0
DefaultFormat is the framework default configuration format.
type MacStartConfig ¶
MacStartConfig describes macOS-specific start options.
type MacStartOptions ¶
type MacStartOptions struct {
// contains filtered or unexported fields
}
MacStartOptions wraps private macOS-specific VM start options.
func NewMacStartOptions ¶
func NewMacStartOptions() MacStartOptions
NewMacStartOptions creates macOS start options.
func NewMacStartOptionsFrom ¶
func NewMacStartOptionsFrom(cfg MacStartConfig) (MacStartOptions, error)
NewMacStartOptionsFrom creates macOS start options and applies the requested flags.
func (MacStartOptions) ForceDFU ¶
func (o MacStartOptions) ForceDFU() bool
ForceDFU reports whether DFU start is enabled.
func (MacStartOptions) SetForceDFU ¶
func (o MacStartOptions) SetForceDFU(v bool)
SetForceDFU toggles DFU start.
func (MacStartOptions) SetStopInIBootStage1 ¶
func (o MacStartOptions) SetStopInIBootStage1(v bool)
SetStopInIBootStage1 toggles stage 1 iBoot stop.
func (MacStartOptions) SetStopInIBootStage2 ¶
func (o MacStartOptions) SetStopInIBootStage2(v bool)
SetStopInIBootStage2 toggles stage 2 iBoot stop.
func (MacStartOptions) StopInIBootStage1 ¶
func (o MacStartOptions) StopInIBootStage1() bool
StopInIBootStage1 reports whether stage 1 iBoot stop is enabled.
func (MacStartOptions) StopInIBootStage2 ¶
func (o MacStartOptions) StopInIBootStage2() bool
StopInIBootStage2 reports whether stage 2 iBoot stop is enabled.
type SaveOptions ¶
type SaveOptions struct {
// contains filtered or unexported fields
}
SaveOptions wraps private VM save options.
func NewSaveOptions ¶
func NewSaveOptions() SaveOptions
NewSaveOptions creates default save options.
func NewSaveOptionsFrom ¶
func NewSaveOptionsFrom(compress, encrypt bool) (SaveOptions, error)
NewSaveOptionsFrom creates save options and applies the requested flags.
func (SaveOptions) Compress ¶
func (o SaveOptions) Compress() bool
Compress reports whether compression is enabled.
func (SaveOptions) Encrypt ¶
func (o SaveOptions) Encrypt() bool
Encrypt reports whether encryption is enabled.
func (SaveOptions) SetCompress ¶
func (o SaveOptions) SetCompress(v bool)
SetCompress toggles compression.
func (SaveOptions) SetEncrypt ¶
func (o SaveOptions) SetEncrypt(v bool)
SetEncrypt toggles encryption.
type StartConfig ¶
type StartConfig struct {
DelegatedExceptionClasses []objectivec.IObject
}
StartConfig describes the delegated exception classes to install on a VM.
type StartOptions ¶
type StartOptions struct {
// contains filtered or unexported fields
}
StartOptions wraps private VM start options.
func NewStartOptions ¶
func NewStartOptions() StartOptions
NewStartOptions creates default start options.
func NewStartOptionsFrom ¶
func NewStartOptionsFrom(cfg StartConfig) (StartOptions, error)
NewStartOptionsFrom creates start options and applies the requested classes.
func (StartOptions) DelegatedExceptionClasses ¶
func (o StartOptions) DelegatedExceptionClasses() foundation.INSArray
DelegatedExceptionClasses returns the delegated exception class list.
func (StartOptions) SetDelegatedExceptionClasses ¶
func (o StartOptions) SetDelegatedExceptionClasses(classes objectivec.IObject)
SetDelegatedExceptionClasses sets the delegated exception classes.