ssh

package
v0.3.4 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2021 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AgentPidIdentifier = "SSH_AGENT_PID"
	AuthSockIdentifier = "SSH_AUTH_SOCK"
)

ssh-agent constant identifiers

Variables

This section is empty.

Functions

func AssertRemoteTestSSHFile added in v0.3.2

func AssertRemoteTestSSHFile(t *testing.T, args SSHArgs, filePath string)

func CopyFrom added in v0.3.0

func CopyFrom(args SSHArgs, agent Agent, rootDir string, sourcePath string) error

CopyFrom copies one or more files using SCP from remote host and returns the paths of files that were successfully copied.

func CopyTo added in v0.3.2

func CopyTo(args SSHArgs, agent Agent, sourcePath, targetPath string) error

CopyTo copies one or more files using SCP from local machine to remote host.

func MakeLocalTestFile added in v0.3.2

func MakeLocalTestFile(t *testing.T, filePath, content string)

func MakeRemoteTestSSHDir added in v0.3.2

func MakeRemoteTestSSHDir(t *testing.T, args SSHArgs, filePath string)

func MakeRemoteTestSSHFile added in v0.3.2

func MakeRemoteTestSSHFile(t *testing.T, args SSHArgs, filePath, content string)

func RemoveLocalTestFile added in v0.3.2

func RemoveLocalTestFile(t *testing.T, fileName string)

func RemoveRemoteTestSSHFile added in v0.3.2

func RemoveRemoteTestSSHFile(t *testing.T, args SSHArgs, fileName string)

func Run added in v0.3.0

func Run(args SSHArgs, agent Agent, cmd string) (string, error)

Run runs a command over SSH and returns the result as a string

func RunRead added in v0.3.0

func RunRead(args SSHArgs, agent Agent, cmd string) (io.Reader, error)

RunRead runs a command over SSH and returns an io.Reader for stdout/stderr

Types

type Agent added in v0.3.0

type Agent interface {
	AddKey(keyPath string) error
	RemoveKey(keyPath string) error
	Stop() error
	GetEnvVariables() string
}

func StartAgent added in v0.3.0

func StartAgent() (Agent, error)

StartAgent starts the ssh-agent process and returns the SSH authentication parameters.

type ProxyJumpArgs added in v0.3.0

type ProxyJumpArgs struct {
	User string
	Host string
}

type SSHArgs added in v0.3.0

type SSHArgs struct {
	User           string
	Host           string
	PrivateKeyPath string
	Port           string
	MaxRetries     int
	ProxyJump      *ProxyJumpArgs
}

Jump to

Keyboard shortcuts

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