Documentation
¶
Index ¶
- Variables
- func ListOfflineImages() ([]string, error)
- func ValidateMounts(mounts []Mount) error
- func ValidateNetworkConfig(cfg *NetworkConfig) error
- type Box
- func (b *Box) Close()
- func (b *Box) Exec(command string, opts *ExecOptions) (*ExecResult, error)
- func (b *Box) ExecStream(command string, opts *ExecOptions, cb ExecStreamCallbacks) (*ExecResult, error)
- func (b *Box) ID() string
- func (b *Box) Info() (BoxInfo, error)
- func (b *Box) Name() string
- func (b *Box) Start() error
- func (b *Box) Stop() error
- type BoxInfo
- type BoxOptions
- type CIDRRule
- type DNSConfig
- type DomainRule
- type ExecOptions
- type ExecResult
- type ExecStreamCallbacks
- type Mount
- type NetworkConfig
- type NetworkMode
- type NetworkPolicy
- type OfflineImageMetadata
- type PolicyMode
- type PortForward
- type Protocol
- type ProxyConfig
- type Runtime
- func (r *Runtime) Close()
- func (r *Runtime) CreateBox(ctx context.Context, name string, opts BoxOptions) (*Box, error)
- func (r *Runtime) GetBox(ctx context.Context, idOrName string) (*Box, error)
- func (r *Runtime) ListBoxes(ctx context.Context) ([]BoxInfo, error)
- func (r *Runtime) RemoveBox(ctx context.Context, idOrName string, force bool) error
- type RuntimeNetworkDefaults
- type RuntimeOptions
- type TrafficLimits
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrNetworkUnsupportedPlatform = errors.New("network unsupported on this platform") ErrNetworkInvalidConfig = errors.New("invalid network config") )
View Source
var ErrMountInvalidConfig = errors.New("invalid mount config")
View Source
var ( ErrNativeUnavailable = errors.New("govm native bridge unavailable: rebuild with -tags govm_native and bundled native libs") )
Functions ¶
func ListOfflineImages ¶
ListOfflineImages returns embedded offline image names.
func ValidateMounts ¶ added in v0.1.1
func ValidateNetworkConfig ¶
func ValidateNetworkConfig(cfg *NetworkConfig) error
Types ¶
type Box ¶
type Box struct {
// contains filtered or unexported fields
}
Box is a handle to one sandbox VM.
func (*Box) Close ¶
func (b *Box) Close()
Close only frees the handle; it does not remove the underlying box.
func (*Box) Exec ¶
func (b *Box) Exec(command string, opts *ExecOptions) (*ExecResult, error)
func (*Box) ExecStream ¶ added in v0.1.3
func (b *Box) ExecStream(command string, opts *ExecOptions, cb ExecStreamCallbacks) (*ExecResult, error)
type BoxInfo ¶
type BoxInfo struct {
ID string `json:"id"`
Name string `json:"name,omitempty"`
Image string `json:"image"`
State string `json:"state"`
CreatedAt time.Time `json:"created_at"`
}
BoxInfo contains metadata and state of a box.
type BoxOptions ¶
type BoxOptions struct {
Image string `json:"image"`
// LocalBundlePath points to a local OCI image layout directory.
// When set, it takes precedence over Image.
LocalBundlePath string `json:"local_bundle_path,omitempty"`
// RootfsPath is kept for backward compatibility and aliases LocalBundlePath.
// Deprecated: use LocalBundlePath.
RootfsPath string `json:"rootfs_path,omitempty"`
// OfflineImage references an embedded offline image bundle shipped in this repo.
// Runtime.CreateBox will extract it and fill RootfsPath automatically.
OfflineImage string `json:"offline_image,omitempty"`
CPUs int `json:"cpus,omitempty"`
MemoryMB int `json:"memory_mb,omitempty"`
Env map[string]string `json:"env,omitempty"`
WorkingDir string `json:"working_dir,omitempty"`
Mounts []Mount `json:"mounts,omitempty"`
Network *NetworkConfig `json:"network,omitempty"`
}
BoxOptions configures a new box.
type DomainRule ¶
type ExecOptions ¶
type ExecOptions struct {
Args []string
Env map[string]string
TTY bool
User string
Timeout time.Duration
WorkingDir string
}
ExecOptions controls execution behavior for a command.
type ExecResult ¶
ExecResult is the final result of command execution.
type ExecStreamCallbacks ¶ added in v0.1.3
ExecStreamCallbacks receives incremental stdout/stderr from guest command execution.
type NetworkConfig ¶
type NetworkConfig struct {
Enabled bool `json:"enabled"`
Mode NetworkMode `json:"mode,omitempty"`
Policy *NetworkPolicy `json:"policy,omitempty"`
PortForwards []PortForward `json:"port_forwards,omitempty"`
IsolateFromHostLAN bool `json:"isolate_from_host_lan,omitempty"`
}
func BalancedNetworkProfile ¶
func BalancedNetworkProfile() *NetworkConfig
func OpenNetworkProfile ¶
func OpenNetworkProfile() *NetworkConfig
func StrictNetworkProfile ¶
func StrictNetworkProfile() *NetworkConfig
type NetworkMode ¶
type NetworkMode string
const ( NetworkDisabled NetworkMode = "disabled" NetworkNAT NetworkMode = "nat" NetworkBridged NetworkMode = "bridged" )
type NetworkPolicy ¶
type NetworkPolicy struct {
Mode PolicyMode `json:"mode,omitempty"`
AllowCIDR []CIDRRule `json:"allow_cidr,omitempty"`
DenyCIDR []CIDRRule `json:"deny_cidr,omitempty"`
AllowDomain []DomainRule `json:"allow_domain,omitempty"`
DenyDomain []DomainRule `json:"deny_domain,omitempty"`
DNS *DNSConfig `json:"dns,omitempty"`
Proxy *ProxyConfig `json:"proxy,omitempty"`
Limits *TrafficLimits `json:"limits,omitempty"`
}
type OfflineImageMetadata ¶
func ListOfflineImageMetadata ¶
func ListOfflineImageMetadata() ([]OfflineImageMetadata, error)
ListOfflineImageMetadata returns metadata for embedded offline image bundles.
type PolicyMode ¶
type PolicyMode string
const ( PolicyBlockAll PolicyMode = "block_all" PolicyAllowAll PolicyMode = "allow_all" )
type PortForward ¶
type ProxyConfig ¶
type Runtime ¶
type Runtime struct {
// contains filtered or unexported fields
}
Runtime is the high-level client entry point.
func NewRuntime ¶
func NewRuntime(opts *RuntimeOptions) (*Runtime, error)
NewRuntime creates a new runtime.
type RuntimeNetworkDefaults ¶
type RuntimeNetworkDefaults struct {
Profile string `json:"profile,omitempty"`
Config *NetworkConfig `json:"config,omitempty"`
}
type RuntimeOptions ¶
type RuntimeOptions struct {
HomeDir string
ImageRegistries []string
NetworkDefaults *RuntimeNetworkDefaults
}
RuntimeOptions configures Runtime creation.
type TrafficLimits ¶
Click to show internal directories.
Click to hide internal directories.