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, log *logrus.Entry) *DisplayHandler
NewDisplayHandler creates a DisplayHandler that connects the websocket to the display socket.
type SetSizeFunc ¶
A SetSizeFunc can set the TTY size of a terminal.
type ShellFactory ¶
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, log *logrus.Entry) *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, log *logrus.Entry) *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.
Source Files ¶
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. |