types

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Logging Logging `yaml:"logging"`

	Profiles map[string]Profile `yaml:"profiles"`

	// MimeHandler configures mime types and the specific workloads to handle them.
	MimeHandlers map[string]MimeHandler `yaml:"mimeHandlers"`

	DefaultMimeHandler *MimeHandler `yaml:"defaultMimeHandler"`

	// WorkloadPullMode defines how workload images should be pulled.
	WorkloadPullMode WorkloadPullMode `yaml:"workloadPullMode"`

	RootDir string
}

func LoadConfig

func LoadConfig(path string) (*Config, error)

func (*Config) Profile added in v0.0.6

func (c *Config) Profile(name string) (*Profile, bool)

func (*Config) WorkloadFiles

func (c *Config) WorkloadFiles() ([]string, error)

WorkloadFiles returns a list of workload file paths.

type EffectiveWorkload

type EffectiveWorkload struct {
	// Name combines the name of both the workload and the profile
	// in which it will be executed under.
	Name     string
	Profile  *Profile
	Workload Workload
}

func (EffectiveWorkload) Validate

func (w EffectiveWorkload) Validate() error

type HostAccess

type HostAccess struct {
	// Dbus controls access to the dbus session running at the host.
	// If false, a new dbus session for the specific Qubesome profile
	// will be created.
	Dbus bool `yaml:"dbus"`

	// Network defines what container network the workload should be
	// bound to. If empty, uses default bridge network.
	// When set at profile level, the workload must either have the
	// same network set, or set it to 'none'.
	Network string `yaml:"network"`

	Camera     bool `yaml:"camera"`
	Microphone bool `yaml:"microphone"`
	Speakers   bool `yaml:"speakers"`
	VarRunUser bool `yaml:"varRunUser"`
	Privileged bool `yaml:"privileged"`
	Mime       bool `yaml:"mime"`

	Bluetooth bool `yaml:"bluetooth"`

	// USBDevices defines the USB devices to be made available to a
	// workload, based on the USB product name.
	//
	// To list all USB product names for the current machine use:
	//  cat /sys/bus/usb/devices/*/product | sort -u
	USBDevices []string `yaml:"usbDevices"`
	Gpus       string   `yaml:"gpus"`
	Paths      []string `yaml:"paths"`

	CapsAdd []string `yaml:"capsAdd"`
	Devices []string `yaml:"devices"`
}

type Logging

type Logging struct {
	LogToFile   bool   `yaml:"logToFile"`
	LogToStdout bool   `yaml:"logToStdout"`
	LogToSyslog bool   `yaml:"logToSyslog"`
	Level       string `yaml:"level"`
}

type MimeHandler

type MimeHandler struct {
	Workload string `yaml:"workload"`
	Profile  string `yaml:"profile"`
}

type Profile

type Profile struct {
	Name string
	// Path defines the root path for the given profile. All other
	// paths (e.g. Paths) will descend from it.
	//
	// Note that this Path descends from the dir where the qubesome
	// config is being consumed. When sourcing from git, it descends
	// from the git repository directory.
	Path   string `yaml:"path"`
	Runner string `yaml:"runner"`

	// HostAccess defines all the access request which are allowed for
	// its workloads.
	HostAccess `yaml:"hostAccess"`

	// Display holds the display to be created for this profile.
	// All workloads running within this profile will share the same
	// display.
	Display uint8 `yaml:"display"`

	// Paths defines the paths to be mounted to the profile's container.
	Paths []string `yaml:"paths"`

	// ExternalDrives defines the required external drives to run the profile.
	ExternalDrives []string `yaml:"externalDrives"`

	// Image is the container image name used for running the profile.
	// It should contain Xephyr and any additional window managers required.
	Image string `yaml:"image"`

	Timezone string `yaml:"timezone"`

	DNS string `yaml:"dns"`

	// WindowManager holds the command to run the Window Manager once
	// the X server is running.
	//
	// Example: exec awesome
	WindowManager string `yaml:"windowManager"`

	// XephyrArgs defines additional args to be passed on to Xephyr.
	XephyrArgs string `yaml:"xephyrArgs"`
}

func (Profile) Validate added in v0.0.2

func (p Profile) Validate() error

type Workload

type Workload struct {
	Name           string     `yaml:"name"`
	Image          string     `yaml:"image"`
	Command        string     `yaml:"command"`
	Args           []string   `yaml:"args"`
	SingleInstance bool       `yaml:"singleInstance"`
	HostAccess     HostAccess `yaml:"hostAccess"`
	MimeApps       []string   `yaml:"mimeApps"`

	Runner string `yaml:"runner"`
	User   *int   `yaml:"user"`
}

func (Workload) ApplyProfile

func (w Workload) ApplyProfile(p *Profile) EffectiveWorkload

func (Workload) Validate

func (w Workload) Validate() error

type WorkloadPullMode

type WorkloadPullMode string
const (
	// OnDemand is a no-op and won't preemptively pull workload images.
	// This is the default behaviour.
	OnDemand WorkloadPullMode = "on-demand"
	// Background downloads all workload images on the background when
	// any command is executed. This operation will only take place once
	// a day.
	Background WorkloadPullMode = "background"
)

Jump to

Keyboard shortcuts

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