Documentation ¶
Index ¶
- type BinaryWriter
- type Dialer
- type DockerDialer
- func (d *DockerDialer) ChangeWindowSize(win *WindowSize) error
- func (d *DockerDialer) Close() error
- func (d *DockerDialer) ExecStart(needRestore bool) error
- func (d *DockerDialer) MonitorTtySize(ctx context.Context) error
- func (d *DockerDialer) OpenTerminal() error
- func (d *DockerDialer) ResizeTty(ctx context.Context) error
- func (d *DockerDialer) ResizeTtyTo(ctx context.Context, height, width uint) error
- func (d *DockerDialer) SetIO(stdout, stderr io.Writer, stdin io.ReadCloser)
- func (d *DockerDialer) SetStdio(stdout, stderr io.Writer, stdin io.ReadCloser) *DockerDialer
- func (d *DockerDialer) SetWindowSize(height, weight int)
- func (d *DockerDialer) SetWriter(w io.Writer) *DockerDialer
- func (d *DockerDialer) Terminal() error
- func (d *DockerDialer) Wait() error
- func (d *DockerDialer) Write(b []byte) error
- type PtyDialer
- func (d *PtyDialer) ChangeWindowSize(win *WindowSize) error
- func (d *PtyDialer) Close() error
- func (d *PtyDialer) OpenTerminal() error
- func (d *PtyDialer) SetIO(stdout, stderr io.Writer, stdin io.ReadCloser)
- func (d *PtyDialer) SetWindowSize(height, weight int)
- func (d *PtyDialer) Wait() error
- func (d *PtyDialer) Write(b []byte) error
- type SSHDialer
- func (d *SSHDialer) ChangeWindowSize(win *WindowSize) error
- func (d *SSHDialer) Close() error
- func (d *SSHDialer) Cmd(cmd string) *SSHDialer
- func (d *SSHDialer) Dial(t bool) (*ssh.Client, error)
- func (d *SSHDialer) NewSession() error
- func (d *SSHDialer) OpenTerminal() error
- func (d *SSHDialer) Run() error
- func (d *SSHDialer) SetIO(stdout, stderr io.Writer, stdin io.ReadCloser)
- func (d *SSHDialer) SetStdio(stdout, stderr io.Writer, stdin io.ReadCloser) *SSHDialer
- func (d *SSHDialer) SetWindowSize(height, weight int)
- func (d *SSHDialer) SetWriter(w io.Writer) *SSHDialer
- func (d *SSHDialer) Terminal() error
- func (d *SSHDialer) Wait() error
- func (d *SSHDialer) Write(b []byte) error
- type TerminalReader
- type WebSocketDialer
- func (d *WebSocketDialer) ChangeWindowSize(win *WindowSize)
- func (d *WebSocketDialer) Close()
- func (d *WebSocketDialer) ReadMessage(ctx context.Context) error
- func (d *WebSocketDialer) SetDefaultSize(height, weight int)
- func (d *WebSocketDialer) Terminal() error
- func (d *WebSocketDialer) Write(bytes []byte) error
- type WindowSize
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BinaryWriter ¶ added in v0.4.3
type BinaryWriter struct {
// contains filtered or unexported fields
}
BinaryWriter struct for binary writer.
func NewBinaryWriter ¶ added in v0.4.3
func NewBinaryWriter(con *websocket.Conn) *BinaryWriter
NewBinaryWriter returns new binary writer.
type Dialer ¶
type Dialer interface { SetIO(stdout, stderr io.Writer, stdin io.ReadCloser) SetWindowSize(height, weight int) ChangeWindowSize(win *WindowSize) error OpenTerminal() error Wait() error Write(b []byte) error Close() error }
Dialer dialer interface definition.
type DockerDialer ¶ added in v0.4.3
type DockerDialer struct { Stdin io.ReadCloser Stdout io.Writer Stderr io.Writer Writer io.Writer Height int Weight int // contains filtered or unexported fields }
DockerDialer struct for docker dialer.
func NewDockerDialer ¶ added in v0.4.3
func NewDockerDialer(n *types.Node) (*DockerDialer, error)
NewDockerDialer returns new docker dialer.
func (*DockerDialer) ChangeWindowSize ¶ added in v0.4.4
func (d *DockerDialer) ChangeWindowSize(win *WindowSize) error
ChangeWindowSize change tty window size for websocket.
func (*DockerDialer) Close ¶ added in v0.4.3
func (d *DockerDialer) Close() error
Close close the Docker connection.
func (*DockerDialer) ExecStart ¶ added in v0.4.3
func (d *DockerDialer) ExecStart(needRestore bool) error
ExecStart handles setting up the IO and then begins streaming stdin/stdout to/from the hijacked connection, blocking until it is either done reading output, the user inputs the detach key sequence when in TTY mode, or when the given context is cancelled. Borrowed from https://github.com/docker/cli/blob/master/cli/command/container/hijack.go#L40.
func (*DockerDialer) MonitorTtySize ¶ added in v0.4.3
func (d *DockerDialer) MonitorTtySize(ctx context.Context) error
MonitorTtySize monitor and change tty size. Borrowed from https://github.com/docker/cli/blob/master/cli/command/container/tty.go#L71.
func (*DockerDialer) OpenTerminal ¶ added in v0.4.4
func (d *DockerDialer) OpenTerminal() error
OpenTerminal open docker websocket terminal.
func (*DockerDialer) ResizeTty ¶ added in v0.4.3
func (d *DockerDialer) ResizeTty(ctx context.Context) error
ResizeTty changes to the current win size.
func (*DockerDialer) ResizeTtyTo ¶ added in v0.4.3
func (d *DockerDialer) ResizeTtyTo(ctx context.Context, height, width uint) error
ResizeTtyTo changes the size of the tty for an exec process running inside a container.
func (*DockerDialer) SetIO ¶ added in v0.4.4
func (d *DockerDialer) SetIO(stdout, stderr io.Writer, stdin io.ReadCloser)
SetIO set dialer's reader and writer.
func (*DockerDialer) SetStdio ¶ added in v0.4.3
func (d *DockerDialer) SetStdio(stdout, stderr io.Writer, stdin io.ReadCloser) *DockerDialer
SetStdio set dialer's reader and writer.
func (*DockerDialer) SetWindowSize ¶ added in v0.4.4
func (d *DockerDialer) SetWindowSize(height, weight int)
SetWindowSize set dialer's default win size.
func (*DockerDialer) SetWriter ¶ added in v0.4.3
func (d *DockerDialer) SetWriter(w io.Writer) *DockerDialer
SetWriter set dialer's logs writer.
func (*DockerDialer) Terminal ¶ added in v0.4.3
func (d *DockerDialer) Terminal() error
Terminal open docker exec terminal.
func (*DockerDialer) Wait ¶ added in v0.4.4
func (d *DockerDialer) Wait() error
Wait waits for the command to exit. Borrowed from https://github.com/docker/cli/blob/master/cli/command/container/exec.go#L180.
func (*DockerDialer) Write ¶ added in v0.4.4
func (d *DockerDialer) Write(b []byte) error
Write write implement.
type PtyDialer ¶ added in v0.4.3
type PtyDialer struct { Stdin io.ReadCloser Stdout io.Writer Stderr io.Writer Writer io.Writer Height int Weight int // contains filtered or unexported fields }
PtyDialer struct for pty dialer.
func NewPtyDialer ¶ added in v0.4.3
NewPtyDialer returns new pty dialer struct.
func (*PtyDialer) ChangeWindowSize ¶ added in v0.4.4
func (d *PtyDialer) ChangeWindowSize(win *WindowSize) error
ChangeWindowSize changes to the current window size.
func (*PtyDialer) OpenTerminal ¶ added in v0.4.4
OpenTerminal open pty websocket terminal.
func (*PtyDialer) SetIO ¶ added in v0.4.4
func (d *PtyDialer) SetIO(stdout, stderr io.Writer, stdin io.ReadCloser)
SetIO set dialer's reader and writer.
func (*PtyDialer) SetWindowSize ¶ added in v0.4.4
SetWindowSize set tty window size size.
type SSHDialer ¶
type SSHDialer struct { Stdin io.ReadCloser Stdout io.Writer Stderr io.Writer Writer io.Writer Height int Weight int Term string Modes ssh.TerminalModes // contains filtered or unexported fields }
SSHDialer struct for ssh dialer.
func NewSSHDialer ¶ added in v0.4.3
NewSSHDialer returns new ssh dialer.
func (*SSHDialer) ChangeWindowSize ¶ added in v0.4.4
func (d *SSHDialer) ChangeWindowSize(win *WindowSize) error
ChangeWindowSize change the window size for current session.
func (*SSHDialer) Cmd ¶ added in v0.4.3
Cmd pass commands in dialer, support multiple calls, e.g. d.Cmd("ls").Cmd("id").
func (*SSHDialer) NewSession ¶ added in v0.4.4
NewSession returns new session.
func (*SSHDialer) OpenTerminal ¶ added in v0.4.4
OpenTerminal starts a login shell on the remote host.
func (*SSHDialer) SetIO ¶ added in v0.4.4
func (d *SSHDialer) SetIO(stdout, stderr io.Writer, stdin io.ReadCloser)
SetIO set dialer's reader and writer.
func (*SSHDialer) SetWindowSize ¶ added in v0.4.4
SetWindowSize set dialer's default window size.
func (*SSHDialer) Terminal ¶ added in v0.4.3
Terminal starts a login shell on the remote host for CLI.
type TerminalReader ¶ added in v0.4.3
type TerminalReader struct { ClosedCh chan bool // contains filtered or unexported fields }
TerminalReader struct for terminal reader.
func NewTerminalReader ¶ added in v0.4.3
func NewTerminalReader(con *websocket.Conn) *TerminalReader
NewTerminalReader returns new terminal reader.
func (*TerminalReader) Close ¶ added in v0.4.3
func (t *TerminalReader) Close() error
Close used to close terminal reader.
func (*TerminalReader) Read ¶ added in v0.4.3
func (t *TerminalReader) Read(p []byte) (int, error)
Read terminal reader Read implement.
func (*TerminalReader) SetResizeFunction ¶ added in v0.4.3
func (t *TerminalReader) SetResizeFunction(resizeFun func(size *WindowSize))
SetResizeFunction set terminal reader resize function.
type WebSocketDialer ¶ added in v0.4.3
type WebSocketDialer struct {
// contains filtered or unexported fields
}
WebSocketDialer struct for websocket dialer.
func NewWebSocketDialer ¶ added in v0.4.3
func NewWebSocketDialer(conn *websocket.Conn, dialer Dialer) *WebSocketDialer
NewWebSocketDialer returns new websocket dialer.
func (*WebSocketDialer) ChangeWindowSize ¶ added in v0.4.3
func (d *WebSocketDialer) ChangeWindowSize(win *WindowSize)
ChangeWindowSize change websocket win size.
func (*WebSocketDialer) Close ¶ added in v0.4.3
func (d *WebSocketDialer) Close()
Close close the WebSocket connection.
func (*WebSocketDialer) ReadMessage ¶ added in v0.4.3
func (d *WebSocketDialer) ReadMessage(ctx context.Context) error
ReadMessage read websocket message.
func (*WebSocketDialer) SetDefaultSize ¶ added in v0.4.3
func (d *WebSocketDialer) SetDefaultSize(height, weight int)
SetDefaultSize set dialer's default window size.
func (*WebSocketDialer) Terminal ¶ added in v0.4.3
func (d *WebSocketDialer) Terminal() error
Terminal open websocket terminal.
func (*WebSocketDialer) Write ¶ added in v0.4.3
func (d *WebSocketDialer) Write(bytes []byte) error
Write write bytes to the websocket connection.
type WindowSize ¶ added in v0.4.3
WindowSize struct for window size.