remotessh

package
v0.0.0-...-7a622f3 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2023 License: Apache-2.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

View Source
const MaxNumberOfSSHConnections = 15

MaxNumberOfSSHConnections defines the max number of ssh connections to each ssh remote device that can be used to run commands concurrently.

Variables

This section is empty.

Functions

func Devices

func Devices(ctx context.Context, configuration []io.ReadCloser) ([]bind.Device, error)

Devices returns the list of attached ssh devices.

func Monitor

func Monitor(ctx context.Context, r *bind.Registry, interval time.Duration, conf func() ([]io.ReadCloser, error)) error

Monitor updates the registry with devices that are added and removed at the specified interval. Monitor returns once the context is cancelled.

Types

type Configuration

type Configuration struct {
	// The name to use for this connection
	Name string
	// The hostname to connect to
	Host string `json:"host"`
	// User is the username to use for login
	User string `json:"user"`
	// Which port should be used
	Port uint16 `json:"port,string"`
	// The pem encoded public key file to use for the connection.
	// If not specified uses ~/.ssh/id_rsa
	Keyfile string `json:"keyPath"`
	// The known_hosts file to use for authentication. Defaults to
	// ~/.ssh/known_hosts
	KnownHosts string `json:"knownHostsPath"`
	// Environment variables to set on the connection
	Env []string
}

Configuration represents a configuration for connecting to an SSH remote client. The SSH agent is first used to attempt connection, followed by the given Keyfile

func ReadConfigurations

func ReadConfigurations(r io.Reader) ([]Configuration, error)

ReadConfigurations reads a set of configurations from then given reader, and returns the configurations to the user.

type Device

type Device interface {
	bind.Desktop
	// PullFile will transfer the remote file at sourcePath to the local
	// machine at destPath
	PullFile(ctx context.Context, sourcePath, destPath string) error
	// GetFilePermissions gets the unix permissions for the remote file
	GetFilePermissions(ctx context.Context, path string) (os.FileMode, error)
	// DefaultReplayCacheDir returns the default path for replay resource caches
	DefaultReplayCacheDir() string
}

Device extends the bind.Device interface with capabilities specific to remote SSH clients

func GetConnectedDevice

func GetConnectedDevice(ctx context.Context, c Configuration) (Device, error)

GetConnectedDevice returns a device that matches the given configuration.

type Port

type Port interface {
	// contains filtered or unexported methods
}

Port is the interface for socket ports that can be tunneled through SSH.

type TCPPort

type TCPPort int

TCPPort represents a TCP/IP port on the remote machine.

type UnixPort

type UnixPort string

UnixPort represents a Unix port on the remote machine.

Jump to

Keyboard shortcuts

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