ssh

package
v0.3.10-0-alpha.2 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2022 License: Apache-2.0 Imports: 14 Imported by: 17

Documentation

Index

Constants

View Source
const (
	ErrBadConfig = errors.Error("bad config")
	ErrNetwork   = errors.Error("network error")
	ErrProtocol  = errors.Error("ssh protocol error")
)

Variables

This section is empty.

Functions

func IsExitMissingError

func IsExitMissingError(err error) bool

func ParseOutput

func ParseOutput(output []byte) []string

Types

type Client

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

func NewClient

func NewClient(
	host string,
	port int,
	username string,
	password string,
	privateKey string,
) (*Client, error)

func (*Client) Close

func (s *Client) Close()

func (*Client) GetConfig

func (s *Client) GetConfig() ClientConfig

func (*Client) RawRun

func (s *Client) RawRun(cmds ...string) ([]string, error)

func (*Client) Run

func (s *Client) Run(cmds ...string) ([]string, error)

func (*Client) RunTerminal

func (s *Client) RunTerminal() error

func (*Client) RunWithInput

func (s *Client) RunWithInput(input io.Reader, cmds ...string) ([]string, error)

func (*Client) RunWithTTY

func (s *Client) RunWithTTY(cmds ...string) ([]string, error)

RunWithTTY request Pty before run command.

type ClientConfig

type ClientConfig struct {
	Username   string
	Password   string
	Host       string
	Port       int
	PrivateKey string
}

func (ClientConfig) Connect

func (conf ClientConfig) Connect() (*ssh.Client, error)

func (ClientConfig) ConnectContext

func (conf ClientConfig) ConnectContext(ctx context.Context) (*ssh.Client, error)

func (ClientConfig) NewClient

func (conf ClientConfig) NewClient() (*Client, error)

func (ClientConfig) ToSshConfig

func (conf ClientConfig) ToSshConfig() (*ssh.ClientConfig, error)

Jump to

Keyboard shortcuts

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