ssh

package
v0.0.0-...-7489d9d Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2022 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrCreatingNativeGoClient = utils.Error("Error creating native Go SSH client")
)

Variables

This section is empty.

Functions

func NewNativeConfig

func NewNativeConfig(user string, auth *Auth) (ssh.ClientConfig, error)

Types

type Auth

type Auth struct {
	Passwords []string
	Keys      []string
}

type Client

type Client interface {
	Output(command string) (string, error)
	OutputWithPty(command string) (string, error)
	Shell(args ...string) error

	// Start starts the specified command without waiting for it to finish. You
	// have to call the Wait function for that.
	//
	// The first two io.ReadCloser are the standard output and the standard
	// error of the executing command respectively. The returned error follows
	// the same logic as in the exec.Cmd.Start function.
	Start(command string) (io.ReadCloser, io.ReadCloser, error)

	// Wait waits for the command started by the Start function to exit. The
	// returned error follows the same logic as in the exec.Cmd.Wait function.
	Wait() error
}

func NewClient

func NewClient(user string, host string, port int, auth *Auth) (Client, error)

func NewNativeClient

func NewNativeClient(user, host string, port int, auth *Auth) (Client, error)

type NativeClient

type NativeClient struct {
	Config   ssh.ClientConfig
	Hostname string
	Port     int
	// contains filtered or unexported fields
}

func (*NativeClient) Output

func (client *NativeClient) Output(command string) (string, error)

func (*NativeClient) OutputWithPty

func (client *NativeClient) OutputWithPty(command string) (string, error)

func (*NativeClient) Shell

func (client *NativeClient) Shell(args ...string) error

func (*NativeClient) Start

func (client *NativeClient) Start(command string) (io.ReadCloser, io.ReadCloser, error)

func (*NativeClient) Wait

func (client *NativeClient) Wait() error

Jump to

Keyboard shortcuts

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