ssh

package
v0.0.0-...-7146f0c Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2016 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewNativeConfig

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

func SetDefaultClient

func SetDefaultClient(clientType ClientType)

func WaitFor

func WaitFor(f func() bool) error

func WaitForSpecific

func WaitForSpecific(f func() bool, maxAttempts int, waitInterval time.Duration) error

func WaitForSpecificOrError

func WaitForSpecificOrError(f func() (bool, error), maxAttempts int, waitInterval time.Duration) error

Types

type Auth

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

type Client

type Client interface {
	Output(command string) (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 ClientType

type ClientType string
const (
	External ClientType = "external"
	Native   ClientType = "native"
)

type ExternalClient

type ExternalClient struct {
	BaseArgs   []string
	BinaryPath string
	// contains filtered or unexported fields
}

func NewExternalClient

func NewExternalClient(sshBinaryPath, user, host string, port int, auth *Auth) (*ExternalClient, error)

func (*ExternalClient) Output

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

func (*ExternalClient) Shell

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

func (*ExternalClient) Start

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

func (*ExternalClient) Wait

func (client *ExternalClient) Wait() 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) 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