Documentation
¶
Overview ¶
Package launch runs the aibox VM: virtiofsd for each share, the proxy and the terminal for the VM, then QEMU.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrNoTerminal = host.ErrNoTerminal
ErrNoTerminal is a VM that ended before the command in it connected, which the console log usually explains.
var ErrSocketTimeout = errors.New("virtiofsd did not create its socket in time")
ErrSocketTimeout is returned when virtiofsd does not create its socket in time.
Functions ¶
Types ¶
type Backend ¶
Backend runs the VM on QEMU and virtiofsd, on a Linux host with KVM. Owner is the host user the VM user stands for in the shares. An empty Virtiofsd is found by Run.
func NewBackend ¶
func NewBackend() Backend
NewBackend returns the Backend for the user running aibox.
type Options ¶
type Options struct {
QEMU string
// Virtiofsd is the program that serves the shares. Empty means
// virtiofsd on the PATH, or else /usr/libexec/virtiofsd.
Virtiofsd string
Stdin *os.File
Stdout io.Writer
Stderr io.Writer
// Progress gets the standard error of a session without a terminal,
// which a task has. Nil runs the session on the terminal.
Progress io.Writer
// RemoveState removes the state disk once QEMU has it open.
RemoveState bool
// SocketTimeout is how long virtiofsd may take to create its socket.
// Zero means ten seconds.
SocketTimeout time.Duration
// OpenVsock opens the vsock the VM and aibox talk over. Nil runs the
// namespace helper of aibox.
OpenVsock func() (*vsockns.Vsock, error)
Proxy proxy.Options
// Env are variables for the command in the VM, as NAME=value.
Env []string
// OnPaste is called each time the person presses Ctrl+V, or is nil.
OnPaste func()
// KVMDevice is the KVM device file QEMU gets. Empty means /dev/kvm.
KVMDevice string
// Bubblewrap is the program that runs QEMU in its sandbox. Empty means
// bwrap on the PATH.
Bubblewrap string
// NoSandbox runs QEMU without the sandbox.
NoSandbox bool
// Confine is called once QEMU has started, with the TCP ports the proxy
// may still connect to. Nil means confine.Apply.
Confine func(ports []uint16) error
// Ports are the TCP ports of the allow list.
Ports []uint16
// ConsoleLog is the file the console of the VM is written to. Empty
// throws it away.
ConsoleLog string
// Libraries and Firmware are what QEMU is made of on the host, bound
// into its sandbox. Empty means those of the QEMU found, see libraries
// and firmware.
Libraries []string
Firmware string
// StopDelay is how long a stopped program may take before it is
// killed, and SessionEndDelay how long the session may go on after
// QEMU exited, to show the last output of the VM. Zero means the
// default.
StopDelay time.Duration
SessionEndDelay time.Duration
}
Options are the programs Run starts, the terminal of the person on Stdin and Stdout, where the messages of aibox and of the programs go, and how the VM reaches the host.