lab

package
v0.0.0-...-eeb3e7f Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2024 License: Apache-2.0 Imports: 13 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrBufferSize = errors.New("Buffer cannot be larger than capacity")
	ErrNoLabByTag = errors.New("Could not find lab by the specified tag")
)

Functions

func NewHub

func NewHub(creator Creator, buffer int, cap int, isVPN int32) (*hub, error)

Types

type Config

type Config struct {
	Frontends         []store.InstanceConfig
	Exercises         []store.Exercise
	DisabledExercises []store.Tag
}

func (Config) Flags

func (conf Config) Flags() []store.ChildrenChalConfig

func (Config) GetChildrenChallenges

func (conf Config) GetChildrenChallenges(parentTag string) []string

GetChildrenChallenges returns list of children challenge tags to be used in amigo frontend

type Creator

type Creator interface {
	NewLab(context.Context, int32) (Lab, error)
	UpdateExercises([]store.Exercise)
}

type Hub

type Hub interface {
	Queue() <-chan Lab
	Close() error
	Suspend(context.Context) error
	Resume(context.Context) error
	Update(labTag <-chan Lab)
	Labs() map[string]Lab
	UpdateExercises(exercises []store.Exercise)
}

type Lab

type Lab interface {
	Start(context.Context) error
	Stop() error
	Restart(context.Context) error
	Suspend(context.Context) error
	Resume(context.Context) error
	Environment() exercise.Environment
	ResetFrontends(ctx context.Context, eventTag, teamId string) error
	RdpConnPorts() []uint
	Tag() string
	AddChallenge(ctx context.Context, confs ...store.Exercise) error
	InstanceInfo() []virtual.InstanceInfo
	Close() error
}

type LabHost

type LabHost struct {
	Vlib vbox.Library
	Conf Config
}

func (*LabHost) NewLab

func (lh *LabHost) NewLab(ctx context.Context, isVPN int32) (Lab, error)

func (*LabHost) UpdateExercises

func (lh *LabHost) UpdateExercises(newExercises []store.Exercise)

Jump to

Keyboard shortcuts

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