ssh

package
v0.80.2 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2024 License: MIT Imports: 18 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 establishes 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 establishes 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

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

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