ssh

package
v1.6.3 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2019 License: MIT Imports: 11 Imported by: 0

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 maintains a persistent connect with a server, allowing commands to be run on that server. This object is thread safe.

func NewClient

func NewClient(host string, serverId int) (*Client, error)

NewClient creates an instance of Client, with a connection to the host server given.

func (*Client) Close

func (this *Client) Close()

Clean up the resources used by this object

func (*Client) DockerCp

func (this *Client) DockerCp(node int, source string, dest string) error

Run docker cp on a remote machine, coping a file from source to dest in the node

func (*Client) DockerExec

func (this *Client) DockerExec(node int, command string) (string, error)

DockerExec executes a command inside of a node

func (*Client) DockerExecd

func (this *Client) DockerExecd(node int, command string) (string, error)

DockerExecd runs the given command, and then returns immediately. This function will not return the output of the command. This is useful if you are starting a persistent process inside a container

func (*Client) DockerExecdLog

func (this *Client) DockerExecdLog(node int, command string) error

DockerExecdLog will cause the stdout and stderr of the command to be stored in the logs. Should only be used for the blockchain process.

func (*Client) DockerExecdLogAppend

func (this *Client) DockerExecdLogAppend(node int, command string) error

DockerExecdLogAppend will cause the stdout and stderr of the command to be stored in the logs. Should only be used for the blockchain process. Will append to existing logs.

func (*Client) DockerExecdit

func (this *Client) DockerExecdit(node int, command string) (string, error)

DockerExecd runs the given command, and then returns immediately. This function will not return the output of the command. This is useful if you are starting a persistent process inside a container

func (*Client) DockerMultiExec

func (this *Client) DockerMultiExec(node int, commands []string) (string, error)

DockerMultiExec will run all of the given commands strung together with && on the given node.

func (*Client) DockerRead

func (this *Client) DockerRead(node int, file string, lines int) (string, error)

DockerRead will read the current output of the command ran with DockerExecdLog. Must be called after DockerExecdLog

func (*Client) FastMultiRun

func (this *Client) FastMultiRun(commands ...string) (string, error)

FastMultiRun speeds up remote execution by chaining commands together

func (*Client) InternalScp

func (this *Client) InternalScp(src string, dest string) error

Scp is a wrapper for the scp command. Can be used to copy a file over to a remote machine.

func (*Client) KTDockerMultiExec

func (this *Client) KTDockerMultiExec(node int, commands []string) (string, error)

KTDockerMultiExec is like DockerMultiExec, except it keeps attempting the command after failure

func (*Client) KeepTryDockerExec

func (this *Client) KeepTryDockerExec(node int, command string) (string, error)

KeepTryDockerExec is like KeepTryRun for nodes

func (*Client) KeepTryDockerExecAll

func (this *Client) KeepTryDockerExecAll(node int, commands ...string) ([]string, error)

KeepTryDockerExecAll is like KeepTryRun for nodes

func (*Client) KeepTryRun

func (this *Client) KeepTryRun(command string) (string, error)

KeepTryRun attempts to run a command successfully multiple times. It will keep trying until it reaches the max amount of tries or it is successful once.

func (*Client) MultiRun

func (this *Client) MultiRun(commands ...string) ([]string, error)

MultiRun provides an easy shorthand for multiple calls to sshExec

func (*Client) Run

func (this *Client) Run(command string) (string, error)

Run executes a given command on the connected remote machine.

func (*Client) Scp

func (this *Client) Scp(src string, dest string) error

Scp is a wrapper for the scp command. Can be used to copy a file over to a remote machine.

type Session

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

func NewSession

func NewSession(sess *ssh.Session, sem *semaphore.Weighted) *Session

func (Session) Close

func (this Session) Close()

func (Session) Get

func (this Session) Get() *ssh.Session

Jump to

Keyboard shortcuts

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