config

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2020 License: BSD-3-Clause Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Boot

type Boot struct {
	Kexec    Kexec    `toml:"kexec"`
	Firmware Firmware `toml:"firmware"`
	FBSD     FBSD     `toml:"fbsd"`
}

Boot config

func (*Boot) Cli

func (b *Boot) Cli() []string

type CDROM

type CDROM struct {
	Path    string
	Driver  string
	Extract bool
}

type Config

type Config struct {
	Network Network `toml:"network"`
	VM      VM      `toml:"vm"`
	Path    string  // Path to the loaded configuration
}

Config represents a hkmgr.toml config file

func (*Config) Defaults added in v0.0.5

func (c *Config) Defaults() error

Defaults sets default values for unset variables in the config.

func (*Config) UpdateRelativePaths added in v0.0.5

func (c *Config) UpdateRelativePaths()

UpdateRelativePaths finds relative paths in the config and turns them into fully qualified paths based on the config file path.

type FBSD

type FBSD struct {
	Userboot   string `toml:"userboot"`
	BootVolume string `toml:"userboot"`
	KernelEnv  string `toml:"kernelenv"`
}

func (*FBSD) Cli

func (f *FBSD) Cli() []string

func (*FBSD) Validate added in v0.0.2

func (f *FBSD) Validate() error

Validate for FBSD is currently a noop, TODO.

type Firmware

type Firmware struct {
	Path string `toml:"path"`
}

func (*Firmware) Cli

func (f *Firmware) Cli() []string

func (*Firmware) Validate added in v0.0.2

func (f *Firmware) Validate() error

Validate for Firmware is currently a noop, TODO.

type HDD

type HDD struct {
	Path   string
	Format string
	Driver string
	Size   string
	Create bool
}

type Kexec

type Kexec struct {
	Kernel  string `toml:"kernel"`
	Initrd  string `toml:"initrd"`
	Cmdline string `toml:"cmdline"`
}

func (*Kexec) Cli

func (k *Kexec) Cli() []string

func (*Kexec) Validate added in v0.0.2

func (k *Kexec) Validate() error

type NetConf

type NetConf struct {
	IP       string `toml:"ip"`
	MAC      string `toml:"mac"`
	Device   string `toml:"device"`
	Driver   string `toml:"driver"`
	MemberOf string `toml:"memberOf"`
}

NetConf is a VM network configuration

type NetType

type NetType interface {
	Discover() error
	Up() error
	Destroy() error
}

type NetTypes

type NetTypes struct {
	Vmnet  *Vmnet  `toml:"vmnet"`
	Tap    *Tap    `toml:"tap"`
	VPNKit *VPNKit `toml:"vpnkit"`
}

func (*NetTypes) NetType

func (nt *NetTypes) NetType() NetType

NetType asdf

type Network

type Network map[string]NetTypes

type Status

type Status int

Status is the status of a VM process

const (
	// Running status represents a running hyperkit process being found
	Running Status = 1
	// Stopped status represents that a pid file was found but a matching hyperkit process was not found
	Stopped Status = 2
	// NotFound status represents that a pid file was not found
	NotFound Status = 3
)

func (Status) String

func (s Status) String() string

type Tap

type Tap struct {
	Nat       bool     `toml:"nat"`
	DHCP      bool     `toml:"dhcp"`
	Bridge    string   `toml:"bridge"`
	IP        string   `toml:"ip"`
	NatIf     string   `toml:"nat_if"`
	PfRules   []string `toml:"pf_rules"`
	BridgeDev *network.Bridge
}

func (*Tap) Destroy

func (t *Tap) Destroy() error

func (*Tap) Discover

func (t *Tap) Discover() error

func (*Tap) Up

func (t *Tap) Up() error

type VM

type VM map[string]*VMConfig

VM is the map of VM names to VMConfig

type VMConfig

type VMConfig struct {
	Memory        string     `toml:"memory"`
	Cores         int        `toml:"cores"`
	UUID          string     `toml:"uuid"`
	SSHKey        string     `toml:"ssh_key"`
	ProvisionPre  string     `toml:"provision_pre"`
	ProvisionPost string     `toml:"provision_post"`
	Before        []string   `toml:"before"`
	After         []string   `toml:"after"`
	Requires      []string   `toml:"requires"`
	RunDir        string     `toml:"run_dir"`
	Network       []*NetConf `toml:"network"`
	Boot          Boot       `toml:"boot"`
	HDD           []*HDD     `toml:"hdd"`
	CDROM         []*CDROM   `toml:"cdrom"`
	PID           int
}

func (*VMConfig) Cli

func (v *VMConfig) Cli() []string

func (*VMConfig) Down added in v0.0.3

func (v *VMConfig) Down(signal string) error

Down stops a VM if its running.

func (*VMConfig) Kill added in v0.0.3

func (v *VMConfig) Kill(signal string) error

Kill attempts to kill a VM via the pid file with the specified signal.

func (*VMConfig) Status

func (v *VMConfig) Status() Status

Status attempts to find the pid file in the run dir of a VM and checks to see if its running or not.

func (*VMConfig) Up

func (v *VMConfig) Up() error

Up starts a VM if its not already running.

func (*VMConfig) Validate

func (v *VMConfig) Validate() error

type VPNKit

type VPNKit struct {
}

func (*VPNKit) Destroy

func (v *VPNKit) Destroy() error

func (*VPNKit) Discover

func (v *VPNKit) Discover() error

func (*VPNKit) Up

func (v *VPNKit) Up() error

type Vmnet

type Vmnet struct {
	Bridge string `toml:"bridge"`
	IP     string `toml:"ip"`
}

func (*Vmnet) Destroy

func (v *Vmnet) Destroy() error

func (*Vmnet) Discover

func (v *Vmnet) Discover() error

func (*Vmnet) Up

func (v *Vmnet) Up() error

Jump to

Keyboard shortcuts

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