interactive

package
Version: v0.1.20 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2018 License: MPL-2.0 Imports: 22 Imported by: 0

Documentation

Overview

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.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DisplayHandler

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

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

func (d *DisplayHandler) Abort()

Abort the display handler

type DisplayProvider

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

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

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

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

func (*DisplayServer) Abort

func (s *DisplayServer) Abort()

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

func (*DisplayServer) ServeHTTP

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

type SetSizeFunc

type SetSizeFunc func(columns, rows uint16) error

A SetSizeFunc can set the TTY size of a terminal.

type ShellFactory

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

ShellFactory is a function that can make a shell

type ShellHandler

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

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

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

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

StderrPipe returns the stderr stream

func (*ShellHandler) StdinPipe

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

StdinPipe returns the stdin stream

func (*ShellHandler) StdoutPipe

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

StdoutPipe returns the stdout stream

func (*ShellHandler) Terminated

func (s *ShellHandler) Terminated(success bool)

Terminated tells that the shell has been terminated

type ShellServer

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

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

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

func (*ShellServer) Abort

func (s *ShellServer) Abort()

Abort will abort all active interactive shells

func (*ShellServer) ServeHTTP

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

func (*ShellServer) Wait

func (s *ShellServer) Wait()

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

func (*ShellServer) WaitAndClose

func (s *ShellServer) WaitAndClose()

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

Directories

Path Synopsis
Package displayclient provides a golang implementation of websockify, transforming a websocket connection to an ioext.ReadWriteCloser object.
Package displayclient provides a golang implementation of websockify, transforming a websocket connection to an ioext.ReadWriteCloser object.
Package 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.
Package 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.
Package 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 shellconsts contains constants shared between shell server and client which is split into different packages to reduce the binary size of potential commandline clients.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to