Documentation ¶
Index ¶
- Variables
- func NewEventConfigStore(conf EventConfig, hooks ...func(EventConfig) error) *eventconfigstore
- func NewEventFile(dir string, filename string, file RawEventFile) *eventfile
- func NewTeamStore(opts ...TeamStoreOpt) *teamstore
- func WithPostTeamHook(hook func(teams []Team) error) func(ts *teamstore)
- func WithTeams(teams []Team) func(ts *teamstore)
- type Archiver
- type Challenge
- type ContainerOptions
- type DockerConfig
- type EmptyVarErr
- type EnvVarConfig
- type EventConfig
- type EventConfigStore
- type EventFile
- type EventFileHub
- type ExerTagExistsErr
- type Exercise
- type ExerciseInstanceConfig
- type ExerciseStore
- type FlagConfig
- type FrontendStore
- type InstanceConfig
- type InvalidTagSyntaxErr
- type Lab
- type RawEventFile
- type RecordConfig
- type SignupKey
- type SignupKeyStore
- type Tag
- type Team
- type TeamStore
- type TeamStoreOpt
- type UnknownExerTagErr
- type User
- type UserStore
- type UsersFile
- type VboxConfig
Constants ¶
This section is empty.
Variables ¶
View Source
var ( TeamExistsErr = errors.New("Team already exists") UnknownTeamErr = errors.New("Unknown team") UnknownTokenErr = errors.New("Unknown token") NoFrontendErr = errors.New("lab requires at least one frontend") InvalidFlagValueErr = errors.New("Incorrect value for flag") UnknownChallengeErr = errors.New("Unknown challenge") )
View Source
var ( EmptyExTags = errors.New("Exercise cannot have zero tags") ImageNotDefinedErr = errors.New("image cannot be empty") MemoryNotDefinedErr = errors.New("memory cannot be empty") )
View Source
var ( UserStoreNoFileErr = errors.New("Unable to find user store file") UserExistsErr = errors.New("User already exists") UserNotFoundErr = errors.New("User not found") PasswdTooShortErr = errors.New("Password too short, requires atleast six characters") SignupKeyExistsErr = errors.New("Signup key already exists") SignupKeyNotFoundErr = errors.New("Signup key not found") )
View Source
var (
TagEmptyErr = errors.New("Tag cannot be empty")
)
Functions ¶
func NewEventConfigStore ¶
func NewEventConfigStore(conf EventConfig, hooks ...func(EventConfig) error) *eventconfigstore
func NewEventFile ¶
func NewEventFile(dir string, filename string, file RawEventFile) *eventfile
func NewTeamStore ¶
func NewTeamStore(opts ...TeamStoreOpt) *teamstore
func WithPostTeamHook ¶
Types ¶
type ContainerOptions ¶
type ContainerOptions struct { DockerConf docker.ContainerConfig Records []RecordConfig Challenges []Challenge }
type DockerConfig ¶
type DockerConfig struct { Envs []EnvVarConfig `yaml:"env"` ExerciseInstanceConfig `yaml:",inline"` }
func (DockerConfig) Validate ¶
func (df DockerConfig) Validate() error
type EmptyVarErr ¶
func (*EmptyVarErr) Error ¶
func (eve *EmptyVarErr) Error() string
type EnvVarConfig ¶
func (EnvVarConfig) Validate ¶
func (evc EnvVarConfig) Validate() error
type EventConfig ¶
type EventConfig struct { Name string `yaml:"name"` Tag Tag `yaml:"tag"` Available int `yaml:"available"` Capacity int `yaml:"capacity"` Lab Lab `yaml:"lab"` StartedAt *time.Time `yaml:"started-at,omitempty"` FinishedAt *time.Time `yaml:"finished-at,omitempty"` }
func (EventConfig) Validate ¶
func (e EventConfig) Validate() error
type EventConfigStore ¶
type EventFile ¶
type EventFile interface { TeamStore EventConfigStore Archiver }
type EventFileHub ¶
type EventFileHub interface { CreateEventFile(EventConfig) (EventFile, error) GetUnfinishedEvents() ([]EventFile, error) }
func NewEventFileHub ¶
func NewEventFileHub(path string) (EventFileHub, error)
type ExerTagExistsErr ¶
type ExerTagExistsErr struct {
// contains filtered or unexported fields
}
func (*ExerTagExistsErr) Error ¶
func (eee *ExerTagExistsErr) Error() string
type Exercise ¶
type Exercise struct { Name string `yaml:"name"` Tags []Tag `yaml:"tags"` DockerConfs []DockerConfig `yaml:"docker"` VboxConfs []VboxConfig `yaml:"vbox"` }
func (Exercise) ContainerOpts ¶
func (e Exercise) ContainerOpts() []ContainerOptions
func (Exercise) Flags ¶
func (e Exercise) Flags() []FlagConfig
type ExerciseInstanceConfig ¶
type ExerciseInstanceConfig struct { Flags []FlagConfig `yaml:"flag"` Records []RecordConfig `yaml:"dns"` InstanceConfig `yaml:",inline"` }
func (ExerciseInstanceConfig) Validate ¶
func (eic ExerciseInstanceConfig) Validate() error
type ExerciseStore ¶
type ExerciseStore interface { GetExercisesByTags(...Tag) ([]Exercise, error) CreateExercise(Exercise) error DeleteExerciseByTag(Tag) error ListExercises() []Exercise }
func NewExerciseFile ¶
func NewExerciseFile(path string) (ExerciseStore, error)
func NewExerciseStore ¶
func NewExerciseStore(exercises []Exercise, hooks ...func([]Exercise) error) (ExerciseStore, error)
type FlagConfig ¶
type FlagConfig struct { Tag Tag `yaml:"tag"` Name string `yaml:"name"` EnvVar string `yaml:"env"` Static string `yaml:"static"` Points uint `yaml:"points"` }
func (FlagConfig) Validate ¶
func (fc FlagConfig) Validate() error
type FrontendStore ¶
type FrontendStore interface { GetFrontends(...string) []InstanceConfig SetMemoryMB(string, uint) error SetCpu(string, float64) error // contains filtered or unexported methods }
func NewFrontendsFile ¶
func NewFrontendsFile(path string) (FrontendStore, error)
type InstanceConfig ¶
type InstanceConfig struct { Image string `yaml:"image"` MemoryMB uint `yaml:"memoryMB"` CPU float64 `yaml:"cpu"` }
func (InstanceConfig) Validate ¶
func (ic InstanceConfig) Validate() error
type InvalidTagSyntaxErr ¶
type InvalidTagSyntaxErr struct {
// contains filtered or unexported fields
}
func (*InvalidTagSyntaxErr) Error ¶
func (ite *InvalidTagSyntaxErr) Error() string
type Lab ¶
type Lab struct { Frontends []InstanceConfig `yaml:"frontends"` Exercises []Tag `yaml:"exercises"` }
type RawEventFile ¶
type RawEventFile struct { EventConfig `yaml:",inline"` Teams []Team `yaml:"teams,omitempty"` }
type RecordConfig ¶
type RecordConfig struct { Type string `yaml:"type"` Name string `yaml:"name"` RData string `yaml:"rdata"` }
func (RecordConfig) Format ¶
func (rc RecordConfig) Format(ip string) string
func (RecordConfig) Validate ¶
func (rc RecordConfig) Validate() error
type SignupKey ¶
type SignupKey struct { WillBeSuperUser bool `yaml:"super-user,omitempty"` Value string `yaml:"value,omitempty"` }
func NewSignupKey ¶
func NewSignupKey() SignupKey
type SignupKeyStore ¶
type SignupKeyStore interface { CreateSignupKey(SignupKey) error GetSignupKey(string) (SignupKey, error) DeleteSignupKey(SignupKey) error ListSignupKeys() []SignupKey }
func NewSignupKeyStore ¶
func NewSignupKeyStore(keys []SignupKey, hooks ...func([]SignupKey) error) SignupKeyStore
type Team ¶
type Team struct { Id string `yaml:"id"` Email string `yaml:"email"` Name string `yaml:"name"` HashedPassword string `yaml:"hashed-password"` SolvedChallenges []Challenge `yaml:"solved-challenges,omitempty"` Metadata map[string]string `yaml:"metadata,omitempty"` CreatedAt *time.Time `yaml:"created-at,omitempty"` ChalMap map[Tag]Challenge `yaml:"-"` }
func (*Team) AddChallenge ¶
func (*Team) AddMetadata ¶
func (*Team) DataCollection ¶
func (*Team) DataConsent ¶
type TeamStoreOpt ¶
type TeamStoreOpt func(ts *teamstore)
type UnknownExerTagErr ¶
type UnknownExerTagErr struct {
// contains filtered or unexported fields
}
func (*UnknownExerTagErr) Error ¶
func (uee *UnknownExerTagErr) Error() string
type User ¶
type User struct { Username string `yaml:"username"` HashedPassword string `yaml:"hashed-password"` SuperUser bool `yaml:"super-user"` CreatedAt time.Time `yaml:"created-at"` }
func (User) IsCorrectPassword ¶
type UserStore ¶
type VboxConfig ¶
type VboxConfig struct {
ExerciseInstanceConfig `yaml:",inline"`
}
func (VboxConfig) Validate ¶
func (vc VboxConfig) Validate() error
Click to show internal directories.
Click to hide internal directories.