ssh

package
v0.0.0-...-1d1a3e7 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client struct for ssh

func Dial

func Dial(network, addr string, config *ssh.ClientConfig) (*Client, error)

Dial starts a client connection to the given SSH server. This is wrap the ssh.Dial

func DialWithKey

func DialWithKey(addr, user, keyfile string) (*Client, error)

DialWithKey starts a client connection to the given SSH server with key auth method.

func DialWithPasswd

func DialWithPasswd(addr, user, passwd string) (*Client, error)

DialWithPasswd starts a client connection to the given SSH server with password auth method.

func (*Client) Close

func (c *Client) Close() error

Close connection

func (*Client) Cmd

func (c *Client) Cmd(cmd string) *RemoteScript

Cmd create a command on client

func (*Client) Shell

func (c *Client) Shell() *RemoteShell

Shell create a noninteractive shell on client.

type RemoteScript

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

RemoteScript is a wrap for command on remote machine

func (*RemoteScript) Cmd

func (rs *RemoteScript) Cmd(cmd string) *RemoteScript

Cmd set command

func (*RemoteScript) Output

func (rs *RemoteScript) Output() ([]byte, error)

Output wil return output as []byte

func (*RemoteScript) Run

func (rs *RemoteScript) Run() error

Run command on remote machine

func (*RemoteScript) SetStdio

func (rs *RemoteScript) SetStdio(stdout, stderr io.Writer) *RemoteScript

SetStdio will set stdio and stderr

type RemoteShell

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

RemoteShell struct to execute many commands in 1 pipe

func (*RemoteShell) SetStdio

func (rs *RemoteShell) SetStdio(stdin io.Reader, stdout, stderr io.Writer) *RemoteShell

SetStdio set stdio, stderr and stdin to remote shell

func (*RemoteShell) Start

func (rs *RemoteShell) Start(commands []string) error

Start start a remote shell on client and run slice of commands

type TerminalConfig

type TerminalConfig struct {
	Term   string
	Height int
	Weight int
	Modes  ssh.TerminalModes
}

TerminalConfig struct for shell

Jump to

Keyboard shortcuts

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