ssh

package
v0.2.5 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2021 License: Apache-2.0 Imports: 10 Imported by: 2

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 is a higher-level abstraction around the standard API's SSH configuration, client and connection to the remote machine.

func NewClient

func NewClient(params ClientParams) (*Client, error)

NewClient instantiates a new SSH Client object. N.B.: provide either the key (privateKey) or its path (privateKeyPath).

func (*Client) Close

func (c *Client) Close() error

Close closes this high-level Client's underlying SSH connection.

func (*Client) RunCommand

func (c *Client) RunCommand(ctx context.Context, command string, stdin io.Reader) (string, error)

RunCommand executes the provided command on the remote machine configured in this Client object. A new Session is created for each call to RunCommand. A Client supports multiple interactive sessions.

type ClientParams

type ClientParams struct {
	User           string
	Host           string
	Port           uint16
	PrivateKeyPath string
	PrivateKey     []byte
	PrintOutputs   bool
}

ClientParams groups inputs to build a client object.

Jump to

Keyboard shortcuts

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