guacamole

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: 40 Imported by: 1

Documentation

Index

Constants

View Source
const (
	Running   = State(0)
	Suspended = State(1)
	Booked    = State(2)
	Closed    = State(3)
	Error     = State(4)
)

Variables

View Source
var (
	RdpConfErr      = errors.New("error too few rdp connections")
	StartingGuacErr = errors.New("error while starting guac")

	ErrMaxLabs         = errors.New("maximum amount of allowed labs has been reached")
	ErrNoAvailableLabs = errors.New("no labs available in the queue")
)
View Source
var (
	MalformedLoginErr = errors.New("malformed login response")
	NoHostErr         = errors.New("host is missing")
	NoPortErr         = errors.New("port is missing")
	NoNameErr         = errors.New("name is missing")
	IncorrectColorErr = errors.New("colorDepth can take the following values: 8, 16, 24, 32")
	UnexpectedRespErr = errors.New("unexpected response from Guacamole")
	SessionErr        = errors.New("session must exist")

	DefaultAdminUser = "guacadmin"
	DefaultAdminPass = "guacadmin"
)
View Source
var (
	KeyPressed = func(kf *KeyFrame) bool {
		return kf.Pressed == "1"
	}
	MouseClicked = func(mf *MouseFrame) bool {
		return mf.Button == "1" || mf.Button == "4" || mf.Button == "2"
	}
)
View Source
var (
	InvalidOpcodeErr = errors.New("invalid opcode")
	InvalidArgsErr   = errors.New("invalid number of args")
)
View Source
var (
	UnknownTeamIdErr = errors.New("Unknown team id")
)

Functions

func NewGuacTokenLoginEndpoint

func NewGuacTokenLoginEndpoint(users *GuacUserStore, ts store.Event, am *amigo.Amigo, loginFunc func(string, string) (string, error)) *guacTokenLoginEndpoint

Types

type Action

type Action string

type Chain

type Chain string

type Config

type Config struct {
	AdminPass string `yaml:"admin_pass"`
}

type CreateRDPConnOpts

type CreateRDPConnOpts struct {
	Host             string
	Port             uint
	Name             string
	GuacUser         string
	Username         *string
	Password         *string
	EnableWallPaper  *bool
	ResolutionWidth  uint
	ResolutionHeight uint
	MaxConn          uint
	ColorDepth       uint
	EnableDrive      *bool
	CreateDrivePath  *bool
	DrivePath        *string
}

type Element

type Element string

type Errori

type Errori struct {
	Out []byte
	Err error
}

func (Errori) Error

func (e Errori) Error() string

type Event

type Event interface {
	Start(context.Context) error
	Close() error
	Suspend(context.Context) error
	Resume(context.Context) error

	Finish(string)
	AssignLab(*store.Team, lab.Lab) error
	Handler() http.Handler
	PauseSignup(bool)
	AddNotification(message string, loggedInUsers bool) error
	SetStatus(int32)
	GetStatus() int32
	GetConfig() store.EventConfig
	GetTeams() []*store.Team
	GetTeamById(teamId string) (*store.Team, error)
	GetHub() lab.Hub
	UpdateTeamPassword(id, pass, passRepeat string) (string, error)
	GetLabByTeam(teamId string) (lab.Lab, bool)
	GetAssignedLabs() map[string]lab.Lab
	GetFrontendData() *amigo.FrontendData
	DeleteTeam(id string) (bool, error)
}

func NewEvent

func NewEvent(ctx context.Context, e store.Event, hub lab.Hub, flags []store.ChildrenChalConfig, reCaptchaKey string) (Event, error)

type ExecFunc

type ExecFunc func(cmd string, args ...string) ([]byte, error)

type Frame

type Frame struct {
	Opcode Element
	Args   []Element
}

func NewFrame

func NewFrame(rawFrame RawFrame) (*Frame, error)

type GuacError

type GuacError struct {
	// contains filtered or unexported fields
}

func (*GuacError) Error

func (ge *GuacError) Error() string

type GuacUser

type GuacUser struct {
	Username string
	Password string
}

type GuacUserStore

type GuacUserStore struct {
	// contains filtered or unexported fields
}

func NewGuacUserStore

func NewGuacUserStore() *GuacUserStore

func (*GuacUserStore) CreateUserForTeam

func (us *GuacUserStore) CreateUserForTeam(tid string, u GuacUser)

func (*GuacUserStore) GetUserForTeam

func (us *GuacUserStore) GetUserForTeam(tid string) (*GuacUser, error)

type Guacamole

type Guacamole interface {
	io.Closer
	Start(context.Context) error
	CreateUser(username, password string) error
	CreateRDPConn(opts CreateRDPConnOpts) error
	GetAdminPass() string
	GetPort() uint
	RawLogin(username, password string) ([]byte, error)
	ProxyHandler(us *GuacUserStore, klp KeyLoggerPool, am *amigo.Amigo, event Event) svcs.ProxyConnector
}

func New

func New(ctx context.Context, conf Config, onlyVPN int32, eventTag string) (Guacamole, error)

type Host

type Host interface {
	CreateEventFromEventDB(context.Context, store.EventConfig, string) (Event, error)
	CreateEventFromConfig(context.Context, store.EventConfig, string) (Event, error)
}

func NewHost

func NewHost(vlib vbox.Library, elib eproto.ExerciseStoreClient, eDir string, dbc pbc.StoreClient, config wg.WireGuardConfig) Host

type IPTables

type IPTables struct {
	// contains filtered or unexported fields
}

type KeyFrame

type KeyFrame struct {
	Key     Element
	Pressed Element
}

func NewKeyFrame

func NewKeyFrame(f *Frame) (*KeyFrame, error)

type KeyFrameFilter

type KeyFrameFilter interface {
	Filter(RawFrame) (kf *KeyFrame, ok bool, err error)
}

func NewKeyFrameFilter

func NewKeyFrameFilter(conditions ...KeyFrameFilterCondition) KeyFrameFilter

type KeyFrameFilterCondition

type KeyFrameFilterCondition func(*KeyFrame) bool

type KeyLogger

type KeyLogger interface {
	Log(rm RawFrame)
}

func NewKeyLogger

func NewKeyLogger(logger *zerolog.Logger) (KeyLogger, error)

type KeyLoggerPool

type KeyLoggerPool interface {
	GetLogger(t store.Team) (KeyLogger, error)
	io.Closer
}

func NewKeyLoggerPool

func NewKeyLoggerPool(dir string) (KeyLoggerPool, error)

type MouseFrame

type MouseFrame struct {
	X      Element
	Y      Element
	Button Element
}

func NewMouseFrame

func NewMouseFrame(f *Frame) (*MouseFrame, error)

type MouseFrameFilter

type MouseFrameFilter interface {
	Filter(RawFrame) (mf *MouseFrame, ok bool, err error)
}

func NewMouseFrameFilter

func NewMouseFrameFilter(conditions ...MouseFrameFilterCondition) MouseFrameFilter

type MouseFrameFilterCondition

type MouseFrameFilterCondition func(*MouseFrame) bool

type PipeFunc

type PipeFunc func(stdin io.Reader, cmd string, args ...string) ([]byte, error)

type Policy

type Policy string

type RawFrame

type RawFrame []byte

type State

type State int

Jump to

Keyboard shortcuts

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