Documentation
¶
Overview ¶
Package shell pipes a Mist remote shell websocket to a terminal.
Framing (same as the mistapi Python package): keystrokes are sent as binary frames prefixed with a 0x00 byte, terminal size changes as a text frame {"resize":{"width":W,"height":H}}, and everything the device sends is raw terminal output.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrEscape = errors.New("session closed with ~.")
ErrEscape is returned when the user ended the session with "~.".
var ErrLost = errors.New("connection lost: the server stopped responding")
ErrLost is returned when the server stops answering keepalive pings, for example after the computer slept or the network changed.
Functions ¶
Types ¶
type Options ¶
type Options struct {
URL string
Header http.Header
// HTTPClient is used for the websocket handshake (nil: default client).
HTTPClient *http.Client
Stdin io.Reader
Stdout io.Writer
Size SizeFunc
// ResizePoll is how often the terminal size is checked (default 250ms).
// Polling works the same on every OS, including Windows.
ResizePoll time.Duration
// ReadyTimeout is how long to hold keystrokes back while waiting for the
// first output of the device (default 10s).
ReadyTimeout time.Duration
// PingInterval is how often a websocket ping checks that the connection
// is still alive (default 30s; negative disables). A session is only
// ended for a missed pong once the server has answered one, so a server
// that never answers pings is not cut off.
PingInterval time.Duration
// PingTimeout is how long to wait for a pong (default 15s).
PingTimeout time.Duration
// Escape enables the ssh-style "~." (at the start of a line) sequence
// to end the session locally.
Escape bool
}
Options configures a shell session.