vm

package module
v0.0.0-...-e377a08 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package vm defines data types and functions define and share data between the runtime runq, proxy and init.

Index

Constants

View Source
const QemuMountPt = "/.qemu.mnt"

QemuMountPt is used to bind mount /var/lib/runq/qemu

Variables

This section is empty.

Functions

func Encode

func Encode(e interface{}) ([]byte, error)

Encode encodes a data struct into binary Gob.

func ZipEncodeBase64

func ZipEncodeBase64(data interface{}) (string, error)

ZipEncodeBase64 encodes arbritray data into a gziped binary Gob and returns it encoded as base64.

Types

type AppCapabilities

type AppCapabilities struct {
	Ambient     []string
	Bounding    []string
	Effective   []string
	Inheritable []string
	Permitted   []string
}

AppCapabilities defines whitelists of Linux capabilities for the target application.

type Certificates

type Certificates struct {
	CACert []byte
	Cert   []byte
	Key    []byte
}

Certificates definenes TLS certificates

type DNS

type DNS struct {
	Server   []string
	Options  string
	Search   string
	Preserve bool
}

DNS contains dns configuration.

type Data

type Data struct {
	APDevice        string
	Cache9p         string
	ContainerID     string
	CPU             int
	CPUArgs         string
	Disks           []Disk
	DNS             DNS
	GitCommit       string
	Hostname        string
	MachineType     string
	Mem             int
	Mounts          []Mount
	NestedVM        bool
	Networks        []Network
	NoExec          bool
	QemuVersion     string
	Rootdisk        string
	RootdiskExclude []string
	Sysctl          map[string]string
	Entrypoint      Entrypoint
	Vsockd          Vsockd
}

Data contains all data needed by the VM.

func DecodeDataGob

func DecodeDataGob(buf []byte) (*Data, error)

DecodeDataGob decodes a Gob binary buffer into a Data struct.

func ZipDecodeBase64

func ZipDecodeBase64(str string) (*Data, error)

ZipDecodeBase64 decodes a base64 string, into a data struct.

type Disk

type Disk struct {
	Cache  string
	Dir    string
	Fstype string
	ID     string
	Mount  bool
	Path   string
	Serial string
	Type   Disktype
}

Disk defines a disk.

type Disktype

type Disktype int

Disktype represents a valid disk types.

const (
	DisktypeUnknown Disktype = iota // disk type is not known
	BlockDevice                     // regular block device
	Qcow2Image                      // Qcow2 image
	RawFile                         // regular file used as block device
)

known disk types

type Entrypoint

type Entrypoint struct {
	User
	Args            []string
	Capabilities    AppCapabilities
	Cwd             string
	DockerInit      string
	Env             []string
	NoNewPrivileges bool
	Rlimits         map[string]syscall.Rlimit
	Runqenv         bool
	SeccompGob      []byte
	Systemd         bool
	Terminal        bool
}

Entrypoint contains information of entrypoint.

func DecodeEntrypointGob

func DecodeEntrypointGob(buf []byte) (*Entrypoint, error)

DecodeEntrypointGob decodes a Gob binary buffer into a Entrypoint struct.

type Mount

type Mount struct {
	Data   string
	Flags  int
	Fstype string
	ID     string
	Source string
	Target string
}

Mount defines a mount point.

type Msg

type Msg struct {
	Type Msgtype
	Data []byte
}

Msg defines the format of the data exchanged between proxy and init.

type Msgtype

type Msgtype uint8

Msgtype declares the type of a message.

const (
	Signal Msgtype // IPC signal such as SIGTERM
	Vmdata         // VM config data
)

Message types

type Network

type Network struct {
	Name       string
	MacAddress string
	MTU        int
	Addrs      []netlink.Addr
	Gateway    net.IP
	TapDevice  string
}

Network defines a network interface.

type User

type User struct {
	UID            uint32
	GID            uint32
	AdditionalGids []uint32
}

User specifies user information for the VM process.

type Vsockd

type Vsockd struct {
	Certificates
	EntrypointPid int
	EntrypointEnv []string
	CID           uint32
}

Vsockd contains config data for the vsockd process.

func DecodeVsockdGob

func DecodeVsockdGob(buf []byte) (*Vsockd, error)

DecodeVsockdGob decodes a Gob binary buffer into a Vsockd struct.

Jump to

Keyboard shortcuts

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