controls

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2019 License: LGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Read

func Read(dir string) (map[string]string, map[string]Control, error)

Read imports all *.toml files from dir (including subdirectories) and returns authKeys and controls

Types

type Control

type Control struct {
	Category string
	ID       int
	Allowed  []string
	AuthKeys []string
}

Control holds the config for one Miniserver control

func (*Control) Validate

func (c *Control) Validate() ControlError

Validate returns an error if a control contains invalid data

type ControlError

type ControlError interface {
	Error() string
	GetType() string
}

ControlError implements GetType() wich is used in tests to test the validation.

type InvalidAuthKeyError added in v0.3.0

type InvalidAuthKeyError struct {
	Name string
}

InvalidAuthKeyError is an error type for invalid authKeys

func (*InvalidAuthKeyError) Error added in v0.3.0

func (e *InvalidAuthKeyError) Error() string

func (*InvalidAuthKeyError) GetType added in v0.3.0

func (e *InvalidAuthKeyError) GetType() string

GetType returns a string containing the error Type

type InvalidCategoryError

type InvalidCategoryError struct {
	Category string
}

InvalidCategoryError is an error type for invalid categories

func (*InvalidCategoryError) Error

func (e *InvalidCategoryError) Error() string

func (*InvalidCategoryError) GetType

func (e *InvalidCategoryError) GetType() string

GetType returns a string containing the error Type

type InvalidCommandError

type InvalidCommandError struct {
	Category string
	Command  string
}

InvalidCommandError is an error type for invalid commands

func (*InvalidCommandError) Error

func (e *InvalidCommandError) Error() string

func (*InvalidCommandError) GetType

func (e *InvalidCommandError) GetType() string

GetType returns a string containing the error Type

type InvalidControlNameError added in v0.2.0

type InvalidControlNameError struct {
	Name string
}

InvalidControlNameError is an error type for invalid commands

func (*InvalidControlNameError) Error added in v0.2.0

func (e *InvalidControlNameError) Error() string

func (*InvalidControlNameError) GetType added in v0.2.0

func (e *InvalidControlNameError) GetType() string

GetType returns a string containing the error Type

type NoAuthKeysError added in v0.3.0

type NoAuthKeysError struct {
	Name string
}

NoAuthKeysError is an error type for invalid authKeys

func (*NoAuthKeysError) Error added in v0.3.0

func (e *NoAuthKeysError) Error() string

func (*NoAuthKeysError) GetType added in v0.3.0

func (e *NoAuthKeysError) GetType() string

GetType returns a string containing the error Type

Jump to

Keyboard shortcuts

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