remote

package
v0.0.0-...-1dd1f65 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package remote provides helpers for dealing with remote test operations over SSH and SCP.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// SCPTimeoutMins is a timeout to apply to SCP.
	SCPTimeoutMins int `toml:"scp_timeout,omitzero"`

	// KnownHostsFilePaths is a list of raw filepaths to SSH known-hosts file.
	KnownHostsFilePaths []string `toml:"known_hosts_paths,omitempty"`
}

Config is the top-level configuration for c4t's SSH support.

type MachineConfig

type MachineConfig struct {
	// The host to use when dialing into the machine.
	Host string `json:"host" toml:"host"`
	// The user to use when dialing into the machine.
	User string `json:"user,omitempty" toml:"user,omitzero"`
	// The port to use when dialing into the machine.
	// If zero, defaults to 22.
	Port int `json:"port,omitempty" toml:"port,omitzero"`
	// The directory to which we shall copy intermediate files.
	DirCopy string `json:"copy_dir" toml:"copy_dir"`
}

MachineConfig is SSH configuration for a remote machine.

func (*MachineConfig) MachineRunner

func (m *MachineConfig) MachineRunner(c *Config) (*MachineRunner, error)

MachineRunner gets a SSH runner for this machine, given the configuration in c.

type MachineRunner

type MachineRunner struct {
	// Config points to the machine configuration that was used to create this runner.
	Config *MachineConfig
	// contains filtered or unexported fields
}

MachineRunner encapsulates information about how to run jobs remotely through SSH.

func (*MachineRunner) Close

func (r *MachineRunner) Close() error

Close closes this MachineRunner's underlying SSH connection.

func (*MachineRunner) NewSFTP

func (r *MachineRunner) NewSFTP() (*sftp.Client, error)

NewSFTP opens a new SFTP session.

func (*MachineRunner) NewSession

func (r *MachineRunner) NewSession() (*ssh.Session, error)

NewSession opens a new SSH session.

type Pipeset

type Pipeset struct {
	// Stdin is the standard input pipe.
	Stdin io.WriteCloser
	// Stdout is the standard output pipe.
	Stdout io.ReadCloser
	// Stderr is the standard error
	Stderr io.ReadCloser
}

Pipeset groups together the three pipes of a Runner.

func OpenCmdPipes

func OpenCmdPipes(c *exec.Cmd) (*Pipeset, error)

OpenCmdPipes opens a pipeset on command c.

func OpenSSHPipes

func OpenSSHPipes(s *ssh.Session) (*Pipeset, error)

OpenSSHPipes opens a pipeset on SSH session s.

func (*Pipeset) Close

func (p *Pipeset) Close() error

Close tries to close each non-nil pipe in Pipeset.

Jump to

Keyboard shortcuts

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