orca

package
v0.0.0-...-e2521e0 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2019 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ImageNotAvailibleErr = errors.New("image not availible")
View Source
var ImageNotFoundErr = errors.New("image not found")
View Source
var InactivityTimeoutErr = errors.New("Inactivity Timeout Expired")
View Source
var SessionTimeoutErr = errors.New("Total Timeout Expired")

Functions

This section is empty.

Types

type Container

type Container struct {
	DockerID string
	Image    *Image
	// ui       *UserIdentity
	URL *url.URL
	// contains filtered or unexported fields
}

func (*Container) GetStream

func (oc *Container) GetStream(ctx context.Context) (types.HijackedResponse, error)

func (*Container) ResizeTTY

func (oc *Container) ResizeTTY(ctx context.Context, height, width int) error

func (*Container) String

func (oc *Container) String() string

func (*Container) WaitForShutdown

func (oc *Container) WaitForShutdown(ctx context.Context) (<-chan container.ContainerWaitOKBody, <-chan error)

type ContainerState

type ContainerState uint8
const (
	ContainerStateDead ContainerState = iota // null value
	ContainerStateStarting
	ContainerStateWorking
	ContainerStateStartErr
	ContainerStateShutdown
	ContainerStateShutdownInactivity // user was inactive too long
	ContainerStateShutdownSessionLen // user was active too long
	ContainerStateShutdownWithErr
	ContainerStateShutdownWithErrMsg
)

func (ContainerState) String

func (cs ContainerState) String() string

type ContainerStatus

type ContainerStatus struct {
	ContainerState ContainerState
	Err            error
	Status         int64
}

func (ContainerStatus) String

func (cs ContainerStatus) String() string

type ContainerUser

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

Image.ContainerUsers[UserId.ID] ->ContainerUser (new or cached) (atomically)

func (*ContainerUser) Activity

func (cu *ContainerUser) Activity()

Callback to mark user being active on the container

func (*ContainerUser) ActivityChan

func (cu *ContainerUser) ActivityChan() <-chan struct{}

Callback to mark user being active on the container

func (*ContainerUser) GetContainer

func (cu *ContainerUser) GetContainer() (oc *Container, status ContainerStatus)

returns running container, blocks while container starting

func (*ContainerUser) IsAlive

func (cu *ContainerUser) IsAlive() (isAlive bool)

func (*ContainerUser) NotifyConnectionClosed

func (cu *ContainerUser) NotifyConnectionClosed()

Strictly once after GetContainer

func (*ContainerUser) ShutdownDone

func (cu *ContainerUser) ShutdownDone() <-chan ContainerStatus

func (*ContainerUser) String

func (cu *ContainerUser) String() string

type Image

type Image struct {
	Kind            ImageKind
	Name            string
	Port            int
	ConcurrentUsers int
	TotalUsers      int

	DockerID string

	PersistBetweenReconnects bool
	Timeouts                 struct {
		Total    time.Duration
		Inactive time.Duration
	}
	// contains filtered or unexported fields
}

func NewImage

func NewImage(jc jobcontroller.JobController, img *mydocker.Image) (*Image, error)

func (*Image) GetContainerUser

func (oi *Image) GetContainerUser(jc jobcontroller.JobController, ui *User) (cu *ContainerUser)

func (*Image) IsVisibleTo

func (oi *Image) IsVisibleTo(ui *User) bool

func (*Image) MarkRemoved

func (oi *Image) MarkRemoved()

func (*Image) String

func (img *Image) String() string

type ImageKind

type ImageKind = string
const (
	ImageKindWeb ImageKind = "web"
	ImageKindSSH ImageKind = "ssh"
	ImageKindTCP ImageKind = "tcp"
)

type ImageList

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

func NewImageList

func NewImageList(jc jobcontroller.JobController) (il *ImageList, err error)

func (*ImageList) GetImage

func (il *ImageList) GetImage(kind ImageKind, name string, ui *User) (image *Image, err error)

func (*ImageList) GetImages

func (il *ImageList) GetImages(kind ImageKind, ui *User) map[string]*Image

func (*ImageList) UpdateImages

func (il *ImageList) UpdateImages(jc jobcontroller.JobController) (err error)

type User

type User struct {
	// login by default
	ID string
	// contains filtered or unexported fields
}

func (*User) String

func (ui *User) String() string

type UserList

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

func NewUserList

func NewUserList() *UserList

func (*UserList) GetUser

func (ul *UserList) GetUser(uid string) (ui *User)

func (*UserList) GetUserByLoginPassword

func (ul *UserList) GetUserByLoginPassword(login, password string) (ui *User, err error)

func (*UserList) GetUserByPubKey

func (ul *UserList) GetUserByPubKey(login, publicKey string) (ui *User, err error)

func (*UserList) GetUserByWebToken

func (ul *UserList) GetUserByWebToken(tasktoken string) (ui *User, err error)

todo: task token is looked up in db, not constant time. bad look for CTF framework

func (*UserList) GetUserFromSSH

func (ul *UserList) GetUserFromSSH(uid string) (ui *User, err error)

This is a mess... This func is called with authorized user id via ldap rpc TODO: restructure auth process, decouple auth methods from handlers in main e.g.: web auth also could be performed via login/password

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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