ssh

package
v0.6.0-alpha Latest Latest
Warning

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

Go to latest
Published: May 12, 2020 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package ssh is a simple wrapper around an ssh.Client which implements utilities to be performed with a remote server.

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 wrapper type over a ssh connection that takes care of creating a channel and running commands in a single method.

func (*Client) Close

func (sshc *Client) Close() error

Close closes the underlying connection.

func (*Client) Download

func (sshc *Client) Download(src string, dst io.Writer, sudo bool) error

Download downloads a given src remote filepath to a given dst writer.

func (*Client) RunCommand

func (sshc *Client) RunCommand(cmd string) ([]byte, error)

RunCommand runs a given command in a new ssh session.

func (*Client) StartCommand

func (sshc *Client) StartCommand(cmd string) error

StartCommand starts a given command in a new ssh session. Unlike RunCommand this command does not wait command to finish. This is needed for running commands in the background.

func (*Client) Upload

func (sshc *Client) Upload(src io.Reader, dst string, sudo bool) ([]byte, error)

Upload uploads a given src object to a given destination file.

func (*Client) UploadFile

func (sshc *Client) UploadFile(src, dst string, sudo bool) ([]byte, error)

UploadFile uploads a given file path to a given destination file.

type ExtAgent

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

ExtAgent is a wrapper type over agent.ExtendedAgent provding a method to return a Client.

func NewAgent

func NewAgent() (*ExtAgent, error)

NewAgent connects to the local ssh agent and validates that it has atleast one key added. It returns the agent if everything looks good.

func (*ExtAgent) NewClient

func (ea *ExtAgent) NewClient(ip string) (*Client, error)

NewClient returns a Client object by dialing the ssh agent.

Jump to

Keyboard shortcuts

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