shellclient

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: 13 Imported by: 1

Documentation

Overview

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.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ShellClient

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

ShellClient exposes the client interface to a shell running remotely. This object implements the engines.Shell interface.

func Dial

func Dial(socketURL string, command []string, tty bool) (*ShellClient, error)

Dial will open a websocket to socketURL giving command and tty to the server. If no command is given the server should open its default shell in a human usable configuration.

func New

func New(ws *websocket.Conn) *ShellClient

New takes a websocket and creates a ShellClient object implementing the engines.Shell interface.

func (*ShellClient) Abort

func (s *ShellClient) Abort() error

Abort will tell the remote shell to abort and close the websocket.

func (*ShellClient) SetSize

func (s *ShellClient) SetSize(columns, rows uint16) error

SetSize will attempt to set the TTY width (columns) and height (rows) on the remote shell.

func (*ShellClient) StderrPipe

func (s *ShellClient) StderrPipe() io.ReadCloser

StderrPipe returns a pipe from which stderr must be read. It's important to drain this pipe or the shell will block when the internal buffer is full.

func (*ShellClient) StdinPipe

func (s *ShellClient) StdinPipe() io.WriteCloser

StdinPipe returns a pipe to which stdin must be written. It's important to close stdin, if you expect the remote shell to terminate.

func (*ShellClient) StdoutPipe

func (s *ShellClient) StdoutPipe() io.ReadCloser

StdoutPipe returns a pipe from which stdout must be read. It's important to drain this pipe or the shell will block when the internal buffer is full.

func (*ShellClient) Wait

func (s *ShellClient) Wait() (bool, error)

Wait will wait for the remote shell to finish, by either succeeding or returning an error.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL