ssh

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package ssh implements the SSH runner: a `run` step naming an ssh runner executes its command on a remote host over SSH, capturing stdout, stderr, and the exit code as a runner.Result. It is the atago counterpart to runn's SSH runner and builds on golang.org/x/crypto/ssh — the same transport runn uses — driven entirely by the runner's declared connection fields (no ~/.ssh/config dependency, so runs stay reproducible).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// Addr is the remote endpoint; a bare host gets the default port 22.
	Addr string
	// User is the login user (required).
	User string
	// Password, when set, enables password authentication.
	Password string
	// KeyFile, when set, is the path to a private key for public-key auth.
	KeyFile string
	// KnownHosts, when set, is a known_hosts file used to verify the host key.
	KnownHosts string
	// InsecureHostKey must be set to connect with an empty KnownHosts (host-key
	// verification disabled, for test/lab infrastructure). Without it an empty
	// KnownHosts is a configuration error, so the insecure mode is opt-in rather
	// than a silent MITM-able default (issue #17).
	InsecureHostKey bool
	// Timeout bounds connection establishment and each command; zero means none.
	Timeout time.Duration
}

Config is the resolved configuration for an ssh runner.

type Runner

type Runner struct {
	// contains filtered or unexported fields
}

Runner holds a live SSH connection for one ssh runner.

func Open

func Open(cfg Config) (*Runner, error)

Open dials the host and authenticates, returning a connected runner.

func (*Runner) Close

func (r *Runner) Close() error

Close ends the SSH connection.

func (*Runner) Run

func (r *Runner) Run(ctx context.Context, command string) (*runner.Result, error)

Run executes command in a fresh session and captures the result. A non-zero remote exit status is a successful Run with Result.ExitCode set (mirroring the cmd runner); only a transport/session failure returns an error.

Jump to

Keyboard shortcuts

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