state

package
v1.0.3 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ResumeState

func ResumeState(vlib *virtual.VboxLibrary, workerPool worker.WorkerPool, statePath string) (*environment.EnvPool, error)

Resumes from a saves state, which means it reasembles the environment pool in order to restore it across ex. restarts

func SaveState

func SaveState(envPool *environment.EnvPool, statePath string) error

Saves the current state of the environment pool to a state.json file. Should be called whenever any changes to the environment pool is made

Types

type Container

type Container struct {
	Id      string
	Conf    virtual.ContainerConfig
	Network virtual.Network
}

type EnvConfig

type EnvConfig struct {
	Tag             string
	Type            lab.LabType
	VPNAddress      string
	VPNEndpointPort int
	VpnConfig       wg.WireGuardConfig
	LabConf         LabConf
	Status          env.Status
	TeamSize        int
}

type Environment

type Environment struct {
	EnvConfig EnvConfig
	Guac      Guacamole
	IpT       IPTables
	IpRules   map[string]env.IpRules
	IpAddrs   [][]int
	Labs      map[string]Lab
}

type Exercise

type Exercise struct {
	ContainerOpts []exercise.ContainerOptions
	VboxOpts      []exercise.ExerciseInstanceConfig
	Tag           string
	Net           *virtual.Network
	DnsAddr       string
	DnsRecords    []exercise.RecordConfig
	Ips           []int
	Containers    []*virtual.Container
	Vms           []*virtual.Vm
}

type Guacamole

type Guacamole struct {
	Token      string
	Port       uint
	AdminPass  string
	Containers map[string]*virtual.Container
}

type IPTables

type IPTables struct {
	Sudo  bool
	Flags []string
	Debug bool
}

type Lab

type Lab struct {
	Tag               string
	Type              lab.LabType
	Frontends         map[string]lab.FrontendConf
	Exercises         map[string]Exercise
	ExerciseConfigs   []exercise.ExerciseConfig
	DisabledExercises []string
	DnsRecords        []*lab.DNSRecord
	Network           *virtual.Network
	DnsServer         *dns.Server
	DhcpServer        *dhcp.Server
	DnsAddress        string
	IsVPN             bool
	GuacUsername      string
	GuacPassword      string
	VpnConfs          []string
}

type LabConf

type LabConf struct {
	Frontends         []virtual.InstanceConfig
	ExerciseConfs     []exercise.ExerciseConfig
	DisabledExercises []string
}

type Network

type Network struct {
	Net       virtual.Network
	Subnet    string
	IsVPN     bool
	Connected []string
}

type State

type State struct {
	Environments map[string]Environment `json:"environments`
}

type Vm

type Vm struct {
	Id      string
	Path    string
	Image   string
	Running bool
}

Jump to

Keyboard shortcuts

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