ssh

package module
v0.0.0-...-58306fc Latest Latest
Warning

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

Go to latest
Published: May 20, 2020 License: Apache-2.0 Imports: 15 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

Hosts - The array of all hosts once loaded

Functions

func AddHost

func AddHost(address, keypath, username string) error

AddHost will append additional hosts to the host array that the ssh package will use

func ImportHostsFromDeployment

func ImportHostsFromDeployment(deployment services.DeploymentConfigurationFile) error

ImportHostsFromDeployment - This will parse a deployment (either file or HTTP post)

func ImportHostsFromRawDeployment

func ImportHostsFromRawDeployment(config []byte) error

ImportHostsFromRawDeployment - This will parse a deployment (either file or HTTP post)

func ReadKeyFiles

func ReadKeyFiles(keyFiles []string) ([]ssh.AuthMethod, error)

ReadKeyFiles - will read an array of keys from disk

func SetPassword

func SetPassword(password string) []ssh.AuthMethod

SetPassword - Turn a password string into an SSH auth method

Types

type CommandResult

type CommandResult struct {
	Host   string // Host that the command was being ran against
	Error  error  // Errors that may have been returned
	Result string // The CLI results
}

CommandResult - This is returned when running commands against servers

func ParalellDownload

func ParalellDownload(hosts []HostSSHConfig, source, destination string, to int) []CommandResult

ParalellDownload - Allow downloading a file over SFTP from multiple hosts in parallel

func ParalellExecute

func ParalellExecute(cmd, pipefile, pipecmd string, hosts []HostSSHConfig, to int) []CommandResult

ParalellExecute - This will execute the same command in paralell across multiple hosts

func ParalellUpload

func ParalellUpload(hosts []HostSSHConfig, source, destination string, to int) []CommandResult

ParalellUpload - Allow uploading a file over SFTP to multiple hosts in parallel

func SingleExecute

func SingleExecute(cmd, pipefile, pipecmd string, host HostSSHConfig, to int) CommandResult

SingleExecute - This will execute a command on a single host

type HostSSHConfig

type HostSSHConfig struct {
	Host         string
	User         string
	Timeout      int
	ClientConfig *ssh.ClientConfig
	Session      *ssh.Session
	Connection   *ssh.Client
}

HostSSHConfig - The struct of an SSH connection

func FindHosts

func FindHosts(parlayHosts []string) ([]HostSSHConfig, error)

FindHosts - This will take an array of hosts and find the matching HostSSH Configuration

func (HostSSHConfig) DownloadFile

func (c HostSSHConfig) DownloadFile(source, destination string) error

DownloadFile -

func (*HostSSHConfig) ExecuteCmd

func (c *HostSSHConfig) ExecuteCmd(cmd string) (string, error)

ExecuteCmd -

func (*HostSSHConfig) ExecuteCmdWithStdinCmd

func (c *HostSSHConfig) ExecuteCmdWithStdinCmd(cmd, localCmd string) (string, error)

ExecuteCmdWithStdinCmd -

func (*HostSSHConfig) ExecuteCmdWithStdinFile

func (c *HostSSHConfig) ExecuteCmdWithStdinFile(cmd, filePath string) (string, error)

ExecuteCmdWithStdinFile -

func (*HostSSHConfig) StartConnection

func (c *HostSSHConfig) StartConnection() (*ssh.Client, error)

StartConnection -

func (*HostSSHConfig) StartSession

func (c *HostSSHConfig) StartSession() (*ssh.Session, error)

StartSession -

func (*HostSSHConfig) StopConnection

func (c *HostSSHConfig) StopConnection() error

StopConnection -

func (*HostSSHConfig) StopSession

func (c *HostSSHConfig) StopSession()

StopSession -

func (HostSSHConfig) String

func (c HostSSHConfig) String() string

To string

func (HostSSHConfig) UploadFile

func (c HostSSHConfig) UploadFile(source, destination string) error

UploadFile -

Jump to

Keyboard shortcuts

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