dialer

package
v0.9.3 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2024 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DockerShell

type DockerShell struct {
	Stdin  io.ReadCloser
	Stdout io.Writer
	Stderr io.Writer
	Writer io.Writer
	// contains filtered or unexported fields
}

DockerShell struct for docker dialer.

func NewDockerShell

func NewDockerShell(n *types.Node) (*DockerShell, error)

NewDockerDialer returns new docker dialer.

func (*DockerShell) ChangeWindowSize

func (d *DockerShell) ChangeWindowSize(win hosts.ShellWindowSize) error

ChangeWindowSize change tty window size for websocket.

func (*DockerShell) Close

func (d *DockerShell) Close() error

Close close the Docker connection.

func (*DockerShell) ExecStart

func (d *DockerShell) 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 (*DockerShell) MonitorTtySize

func (d *DockerShell) 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 (*DockerShell) OpenTerminal

func (d *DockerShell) OpenTerminal(_ hosts.ShellWindowSize) error

OpenTerminal open docker websocket terminal.

func (*DockerShell) ResizeTty

func (d *DockerShell) ResizeTty(ctx context.Context) error

ResizeTty changes to the current win size.

func (*DockerShell) ResizeTtyTo

func (d *DockerShell) ResizeTtyTo(ctx context.Context, height, width uint) error

ResizeTtyTo changes the size of the tty for an exec process running inside a container.

func (*DockerShell) SetIO

func (d *DockerShell) SetIO(stdout, stderr io.Writer, stdin io.ReadCloser)

SetIO set dialer's reader and writer.

func (*DockerShell) SetStdio

func (d *DockerShell) SetStdio(stdout, stderr io.Writer, stdin io.ReadCloser) *DockerShell

SetStdio set dialer's reader and writer.

func (*DockerShell) SetWriter

func (d *DockerShell) SetWriter(w io.Writer) *DockerShell

SetWriter set dialer's logs writer.

func (*DockerShell) Terminal

func (d *DockerShell) Terminal() error

Terminal open docker exec terminal.

func (*DockerShell) Wait

func (d *DockerShell) 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 (*DockerShell) Write

func (d *DockerShell) Write(_ []byte) error

Write write implement.

type PtyShell

type PtyShell struct {
	Stdin  io.ReadCloser
	Stdout io.Writer
	Stderr io.Writer
	Writer io.Writer
	// contains filtered or unexported fields
}

PtyShell struct for pty dialer.

func NewPtyShell

func NewPtyShell(cmd *exec.Cmd) (*PtyShell, error)

NewPtyDialer returns new pty dialer struct.

func (*PtyShell) ChangeWindowSize

func (d *PtyShell) ChangeWindowSize(win hosts.ShellWindowSize) error

ChangeWindowSize changes to the current window size.

func (*PtyShell) Close

func (d *PtyShell) Close() error

Close close the pty connection.

func (*PtyShell) OpenTerminal

func (d *PtyShell) OpenTerminal(win hosts.ShellWindowSize) error

OpenTerminal open pty websocket terminal.

func (*PtyShell) SetIO

func (d *PtyShell) SetIO(stdout, stderr io.Writer, stdin io.ReadCloser)

SetIO set dialer's reader and writer.

func (*PtyShell) Terminal

func (d *PtyShell) Terminal() error

func (*PtyShell) Wait

func (d *PtyShell) Wait() error

Wait waits for the command to exit.

func (*PtyShell) Write

func (d *PtyShell) Write(b []byte) error

type SSHDialer

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

SSHDialer struct for ssh dialer.

func NewSSHDialer

func NewSSHDialer(n *types.Node, timeout bool, logger *logrus.Logger) (*SSHDialer, error)

NewSSHDialer returns new ssh dialer.

func (*SSHDialer) Close

func (d *SSHDialer) Close() error

func (*SSHDialer) Dial

func (d *SSHDialer) Dial(t bool) (*ssh.Client, error)

Dial handshake with ssh address.

func (*SSHDialer) ExecuteCommands

func (d *SSHDialer) ExecuteCommands(cmds ...string) (string, error)

func (*SSHDialer) GetClient

func (d *SSHDialer) GetClient() *ssh.Client

func (*SSHDialer) OpenShell

func (d *SSHDialer) OpenShell() (hosts.Shell, error)

type SSHShell

type SSHShell struct {
	Stdin  io.ReadCloser
	Stdout io.Writer
	Stderr io.Writer
	Writer io.Writer

	Term  string
	Modes ssh.TerminalModes
	// contains filtered or unexported fields
}

func (*SSHShell) ChangeWindowSize

func (d *SSHShell) ChangeWindowSize(win hosts.ShellWindowSize) error

ChangeWindowSize change the window size for current session.

func (*SSHShell) Close

func (d *SSHShell) Close() error

Close close the SSH connection.

func (*SSHShell) OpenTerminal

func (d *SSHShell) OpenTerminal(win hosts.ShellWindowSize) error

OpenTerminal starts a login shell on the remote host.

func (*SSHShell) SetIO

func (d *SSHShell) SetIO(stdout, stderr io.Writer, stdin io.ReadCloser)

SetIO set dialer's reader and writer.

func (*SSHShell) SetWriter

func (d *SSHShell) SetWriter(w io.Writer) *SSHShell

SetWriter set dialer's logs writer.

func (*SSHShell) Terminal

func (d *SSHShell) Terminal() error

Terminal starts a login shell on the remote host for CLI.

func (*SSHShell) Wait

func (d *SSHShell) Wait() error

Wait waits for the remote command to exit.

func (*SSHShell) Write

func (d *SSHShell) Write(_ []byte) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL