taskcluster-worker: github.com/taskcluster/taskcluster-worker/plugins/interactive Index | Files | Directories

package interactive

import "github.com/taskcluster/taskcluster-worker/plugins/interactive"

Package interactive implements the plugin that serves the interactive display and shell sessions over websockets.

The package can also be used as library that provides functionality to host display and shell sessions over websockets. This is useful for reusing the code in small utilities.


Package Files

config.go cors.go displayhandler.go displayserver.go doc.go interactive.go payload.go shellhandler.go shellserver.go

type DisplayHandler Uses

type DisplayHandler struct {
    // contains filtered or unexported fields

DisplayHandler handles serving a VNC display socket over a websocket, avoiding huge buffers and disposing all resources.

func NewDisplayHandler Uses

func NewDisplayHandler(ws *websocket.Conn, display io.ReadWriteCloser, monitor runtime.Monitor) *DisplayHandler

NewDisplayHandler creates a DisplayHandler that connects the websocket to the display socket.

func (*DisplayHandler) Abort Uses

func (d *DisplayHandler) Abort()

Abort the display handler

type DisplayProvider Uses

type DisplayProvider interface {
    // See engines.Sandbox for documentation for methods.
    ListDisplays() ([]engines.Display, error)
    OpenDisplay(name string) (io.ReadWriteCloser, error)

A DisplayProvider is an object that supplies displays. This is a subset of the Sandbox interface.

type DisplayServer Uses

type DisplayServer struct {
    // contains filtered or unexported fields

A DisplayServer exposes a DisplayProvider over a websocket, tracks connections and ensures they are all cleaned up.

func NewDisplayServer Uses

func NewDisplayServer(provider DisplayProvider, monitor runtime.Monitor) *DisplayServer

NewDisplayServer creates a DisplayServer for exposing the given provider over a websocket.

func (*DisplayServer) Abort Uses

func (s *DisplayServer) Abort()

Abort stops new display connections from opneing and aborts all existing connections, cleaning up all resources held.

func (*DisplayServer) ServeHTTP Uses

func (s *DisplayServer) ServeHTTP(w http.ResponseWriter, r *http.Request)

type SetSizeFunc Uses

type SetSizeFunc func(columns, rows uint16) error

A SetSizeFunc can set the TTY size of a terminal.

type ShellFactory Uses

type ShellFactory func(command []string, tty bool) (engines.Shell, error)

ShellFactory is a function that can make a shell

type ShellHandler Uses

type ShellHandler struct {
    // contains filtered or unexported fields

ShellHandler handles a websocket and exposes a reader for stdin, and writers for piping out stdout and stderr.

func NewShellHandler Uses

func NewShellHandler(ws *websocket.Conn, monitor runtime.Monitor) *ShellHandler

NewShellHandler returns a new ShellHandler structure for that can serve/expose a shell over a websocket.

func (*ShellHandler) Communicate Uses

func (s *ShellHandler) Communicate(setSize SetSizeFunc, abort func() error)

Communicate starts receiving and sending data to/from the exposed pipes. Caller provides an optional function setSize for changing the terminal size, and a function abort that will be called to kill the underlying shell.

func (*ShellHandler) StderrPipe Uses

func (s *ShellHandler) StderrPipe() io.WriteCloser

StderrPipe returns the stderr stream

func (*ShellHandler) StdinPipe Uses

func (s *ShellHandler) StdinPipe() io.ReadCloser

StdinPipe returns the stdin stream

func (*ShellHandler) StdoutPipe Uses

func (s *ShellHandler) StdoutPipe() io.WriteCloser

StdoutPipe returns the stdout stream

func (*ShellHandler) Terminated Uses

func (s *ShellHandler) Terminated(success bool)

Terminated tells that the shell has been terminated

type ShellServer Uses

type ShellServer struct {
    // contains filtered or unexported fields

A ShellServer implements http.Handler and upgrades connections to websockets, creates a shell and connects the websocket to the shell.

func NewShellServer Uses

func NewShellServer(makeShell ShellFactory, monitor runtime.Monitor) *ShellServer

NewShellServer returns a new ShellServer which creates shells using the makeShell function.

func (*ShellServer) Abort Uses

func (s *ShellServer) Abort()

Abort will abort all active interactive shells

func (*ShellServer) ServeHTTP Uses

func (s *ShellServer) ServeHTTP(w http.ResponseWriter, r *http.Request)

func (*ShellServer) Wait Uses

func (s *ShellServer) Wait()

Wait will wait for all active shells to be done and return

func (*ShellServer) WaitAndClose Uses

func (s *ShellServer) WaitAndClose()

WaitAndClose will wait for all active shells to be done and abort creation of all new shells atomically.


displayclientPackage displayclient provides a golang implementation of websockify, transforming a websocket connection to an ioext.ReadWriteCloser object.
shellclientPackage shellclient provides a wrapper for demuxing a shell websocket and exposing the stdout/stderr streams as well as offering a way to provide the stdin stream.
shellconstsPackage shellconsts contains constants shared between shell server and client which is split into different packages to reduce the binary size of potential commandline clients.

Package interactive imports 22 packages (graph) and is imported by 4 packages. Updated 2017-12-05. Refresh now. Tools for package owners.