binding

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Box

type Box struct{}

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 ExecCallbacks) (ExecResult, error)

func (*Box) Free

func (b *Box) Free()

func (*Box) Info

func (b *Box) Info() (BoxInfo, error)

func (*Box) Start

func (b *Box) Start() error

func (*Box) Stop

func (b *Box) Stop() 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"`
}

type BoxOptions

type BoxOptions struct {
	Image               string            `json:"image"`
	RootfsPath          string            `json:"rootfs_path,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"`
	NetworkMode         string            `json:"network_mode,omitempty"`
	NetworkPolicyMode   string            `json:"network_policy_mode,omitempty"`
	PortForwards        []PortForward     `json:"port_forwards,omitempty"`
	MacOSNetworkEnabled bool              `json:"macos_network_enabled,omitempty"`
}

type ExecCallbacks added in v0.1.3

type ExecCallbacks struct {
	OnStdout func(string)
	OnStderr func(string)
}

type ExecOptions

type ExecOptions struct {
	Args       []string          `json:"args,omitempty"`
	Env        map[string]string `json:"env,omitempty"`
	TTY        bool              `json:"tty,omitempty"`
	User       string            `json:"user,omitempty"`
	TimeoutSec float64           `json:"timeout_secs,omitempty"`
	WorkingDir string            `json:"working_dir,omitempty"`
}

type ExecResult

type ExecResult struct {
	ExitCode int
	Stdout   []string
	Stderr   []string
}

type Mount added in v0.1.1

type Mount struct {
	HostPath  string `json:"host_path,omitempty"`
	GuestPath string `json:"guest_path,omitempty"`
	ReadOnly  bool   `json:"read_only,omitempty"`
}

type PortForward

type PortForward struct {
	HostIP    string `json:"host_ip,omitempty"`
	HostPort  int    `json:"host_port,omitempty"`
	GuestPort int    `json:"guest_port,omitempty"`
	Protocol  string `json:"protocol,omitempty"`
}

type Runtime

type Runtime struct{}

func NewRuntime

func NewRuntime(opts *RuntimeOptions) (*Runtime, error)

func (*Runtime) CreateBox

func (r *Runtime) CreateBox(name string, opts BoxOptions) (string, error)

func (*Runtime) Free

func (r *Runtime) Free()

func (*Runtime) GetBox

func (r *Runtime) GetBox(idOrName string) (*Box, string, error)

func (*Runtime) ListBoxes

func (r *Runtime) ListBoxes() ([]BoxInfo, error)

func (*Runtime) RemoveBox

func (r *Runtime) RemoveBox(idOrName string, force bool) error

type RuntimeOptions

type RuntimeOptions struct {
	HomeDir         string   `json:"home_dir,omitempty"`
	ImageRegistries []string `json:"image_registries,omitempty"`
}

Jump to

Keyboard shortcuts

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