ssh

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2018 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var UserSFTPOptions = SFTPOptions{
	BufferSizeKib:   32,
	RequestsPerFile: 64,
}

UserSFTPOptions changes how the SFTP subsystem will be configured for copying files.

Functions

This section is empty.

Types

type Actor

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

An Actor is able to perform actions on a remote via an SSH connection established to the host.

func (*Actor) Close

func (a *Actor) Close() error

Close closes the SSH connection and (if it exists) SFTP connection.

func (*Actor) CopyFileToRemote

func (a *Actor) CopyFileToRemote(localSource *os.File, remoteFilePath string, mode os.FileMode) error

CopyFileToRemote copies the file to the Actor's remote host at the remote file path.

func (*Actor) CreateRemoteDir

func (a *Actor) CreateRemoteDir(dirPath string, perms os.FileMode) error

CreateRemoteDir creates the dir as well as any nonexistent parents on the Actor's remote host if any of the dirs do not exist. Return nil if the paths already exist.

func (*Actor) RunCommand

func (a *Actor) RunCommand(command string) (stdout, stderr *bytes.Buffer, err error)

RunCommand runs the command on the Actor's remote host.

type Connector

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

A Connector is able to make SSH connections to remote hosts.

func NewConnector

func NewConnector() *Connector

NewConnector returns a new SSH connector.

func (*Connector) AddIdentityFile

func (c *Connector) AddIdentityFile(filePath string) error

AddIdentityFile adds the identity file's key to the remote authentication methods ssh will try when connecting to remote hosts.

func (*Connector) Connect

func (c *Connector) Connect(host string) (remote.Actor, error)

Connect connects to the host via ssh with the options that have been previously set and returns an actor which can be called to perform tasks on the remote host.

func (*Connector) Port

func (c *Connector) Port(p uint16) error

Port sets the port on which remote connections will be made to hosts. The default port is 22.

func (*Connector) User

func (c *Connector) User(u string) error

User sets the user on hosts to which connections will be made. The default user is 'root'.

type SFTPOptions added in v1.1.0

type SFTPOptions struct {
	BufferSizeKib   uint16
	RequestsPerFile uint16
}

SFTPOptions is defines options for SSH's SFTP subsystem.

Jump to

Keyboard shortcuts

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