ssh

package
v0.77.0 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CopyFromRemote

func CopyFromRemote(ctx context.Context, host *RemoteHost, remoteFile *RemoteFile, destinationPath string) (stderr string, err error)

CopyFromRemote copies a remote file to the local host.

Context ctx is only enforced during the process that stablishes the SSH connection and creates the SSH client.

func CopyToRemote

func CopyToRemote(ctx context.Context, host *RemoteHost, file *RemoteFile) (combinedOutput string, err error)

CopyToRemote copies a file to a remote host.

Context ctx is only enforced during the process that stablishes the SSH connection and creates the SSH client.

func ExecuteRemote

func ExecuteRemote(ctx context.Context, host *RemoteHost, script string) (combinedOutput string, err error)

ExecuteRemote executes a script in a remote host.

Context ctx is only enforced during the process that stablishes the SSH connection and creates the SSH client.

func PublicKeyAuth

func PublicKeyAuth(sshPrivateKeyPath string) (ssh.AuthMethod, error)

PublicKeyAuth returns an AuthMethod that uses a ssh key pair

func ValidateConfig added in v0.60.1

func ValidateConfig(host *JumpBox) error

ValidateConfig checks the JumpBox configuration

Types

type AuthConfig

type AuthConfig struct {
	User           string
	Password       string
	PrivateKeyPath string
}

type JumpBox

type JumpBox struct {
	URI             string
	Port            int
	OperatingSystem api.OSType
	AuthConfig      *AuthConfig
}

type RemoteFile

type RemoteFile struct {
	Path        string
	Permissions string
	Owner       string
	Content     []byte
}

func NewRemoteFile added in v0.60.0

func NewRemoteFile(path, permissions, owner string, content []byte) *RemoteFile

type RemoteHost

type RemoteHost struct {
	URI             string
	Port            int
	OperatingSystem api.OSType
	AuthConfig      *AuthConfig
	Jumpbox         *JumpBox
}

Jump to

Keyboard shortcuts

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