{"modulePath":"github.com/taskcluster/taskcluster-worker","version":"v0.1.20","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package interactive\n\nPackage interactive implements the plugin that serves the interactive display and shell sessions over websockets.\n\nThe 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.\n\n## Types\n\n```go\ntype DisplayHandler struct {\n\t// contains filtered or unexported fields\n}\n```\nDisplayHandler handles serving a VNC display socket over a websocket, avoiding huge buffers and disposing all resources.\n\n```go\nfunc NewDisplayHandler(ws *websocket.Conn, display io.ReadWriteCloser, monitor runtime.Monitor) *DisplayHandler\n```\nNewDisplayHandler creates a DisplayHandler that connects the websocket to the display socket.\n\n```go\nfunc (d *DisplayHandler) Abort()\n```\nAbort the display handler\n\n```go\ntype DisplayProvider interface {\n\t// See engines.Sandbox for documentation for methods.\n\tListDisplays() ([]engines.Display, error)\n\tOpenDisplay(name string) (io.ReadWriteCloser, error)\n}\n```\nA DisplayProvider is an object that supplies displays. This is a subset of the Sandbox interface.\n\n```go\ntype DisplayServer struct {\n\t// contains filtered or unexported fields\n}\n```\nA DisplayServer exposes a DisplayProvider over a websocket, tracks connections and ensures they are all cleaned up.\n\n```go\nfunc NewDisplayServer(provider DisplayProvider, monitor runtime.Monitor) *DisplayServer\n```\nNewDisplayServer creates a DisplayServer for exposing the given provider over a websocket.\n\n```go\nfunc (s *DisplayServer) Abort()\n```\nAbort stops new display connections from opneing and aborts all existing connections, cleaning up all resources held.\n\n```go\nfunc (s *DisplayServer) ServeHTTP(w http.ResponseWriter, r *http.Request)\n```\n\n```go\ntype SetSizeFunc func(columns, rows uint16) error\n```\nA SetSizeFunc can set the TTY size of a terminal.\n\n```go\ntype ShellFactory func(command []string, tty bool) (engines.Shell, error)\n```\nShellFactory is a function that can make a shell\n\n```go\ntype ShellHandler struct {\n\t// contains filtered or unexported fields\n}\n```\nShellHandler handles a websocket and exposes a reader for stdin, and writers for piping out stdout and stderr.\n\n```go\nfunc NewShellHandler(ws *websocket.Conn, monitor runtime.Monitor) *ShellHandler\n```\nNewShellHandler returns a new ShellHandler structure for that can serve/expose a shell over a websocket.\n\n```go\nfunc (s *ShellHandler) Communicate(setSize SetSizeFunc, abort func() error)\n```\nCommunicate 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.\n\n```go\nfunc (s *ShellHandler) StderrPipe() io.WriteCloser\n```\nStderrPipe returns the stderr stream\n\n```go\nfunc (s *ShellHandler) StdinPipe() io.ReadCloser\n```\nStdinPipe returns the stdin stream\n\n```go\nfunc (s *ShellHandler) StdoutPipe() io.WriteCloser\n```\nStdoutPipe returns the stdout stream\n\n```go\nfunc (s *ShellHandler) Terminated(success bool)\n```\nTerminated tells that the shell has been terminated\n\n```go\ntype ShellServer struct {\n\t// contains filtered or unexported fields\n}\n```\nA ShellServer implements http.Handler and upgrades connections to websockets, creates a shell and connects the websocket to the shell.\n\n```go\nfunc NewShellServer(makeShell ShellFactory, monitor runtime.Monitor) *ShellServer\n```\nNewShellServer returns a new ShellServer which creates shells using the makeShell function.\n\n```go\nfunc (s *ShellServer) Abort()\n```\nAbort will abort all active interactive shells\n\n```go\nfunc (s *ShellServer) ServeHTTP(w http.ResponseWriter, r *http.Request)\n```\n\n```go\nfunc (s *ShellServer) Wait()\n```\nWait will wait for all active shells to be done and return\n\n```go\nfunc (s *ShellServer) WaitAndClose()\n```\nWaitAndClose will wait for all active shells to be done and abort creation of all new shells atomically.\n\n","path":"github.com/taskcluster/taskcluster-worker/plugins/interactive","name":"interactive","synopsis":"Package interactive implements the plugin that serves the interactive display and shell sessions over websockets.","isRedistributable":true}
