sshclient

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2026 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Start

func Start(ctx context.Context, options Options) (*Tunnel, Ready, error)

Start resolves the user's SSH configuration, authenticates, bootstraps the remote Warren daemon, and starts a loopback TCP forwarder.

Types

type HostConfig

type HostConfig struct {
	Host           string
	User           string
	Port           int
	IdentityFile   []string
	IdentitiesOnly bool
	IdentityAgent  string
	AgentDisabled  bool
	HostKeyAlias   string
	KnownHosts     string
	// KnownHostsDisabled records an explicit UserKnownHostsFile none. The
	// system-wide defaults may still be active unless
	// GlobalKnownHostsDisabled is also true.
	KnownHostsDisabled bool
	// GlobalKnownHostsDisabled records an explicit
	// GlobalKnownHostsFile none. UserKnownHostsFile defaults still apply in
	// that case, but the system-wide files must not be reintroduced by the
	// fallback below.
	GlobalKnownHostsDisabled bool
	// KnownHostsFiles preserves the configured/default user and system files
	// while KnownHosts remains the first path for callers that only need one
	// value.
	KnownHostsFiles []string
}

HostConfig contains the SSH connection values needed by the embedded client. It intentionally covers the portable subset of ~/.ssh/config that can be implemented without invoking the OpenSSH binary.

type HostEntry

type HostEntry struct {
	Name   string
	Config HostConfig
	Error  string
}

HostEntry is a selectable alias from the user's SSH configuration.

func ListHosts

func ListHosts(configPath string) ([]HostEntry, error)

ListHosts returns concrete SSH aliases in config order. Wildcard-only and negated patterns are intentionally omitted because they are defaults, not selectable destinations.

type Options

type Options struct {
	Target           string
	RemoteAddress    string
	LocalAddress     string
	SSHConfigPath    string
	KnownHostsPath   string
	IdentityFiles    []string
	ConnectTimeout   time.Duration
	BootstrapTimeout time.Duration
}

Options controls one embedded SSH forwarding connection.

type Ready

type Ready struct {
	URL   string
	Token string
}

Ready is the local endpoint returned after the remote daemon is reachable.

type Tunnel

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

Tunnel owns one SSH connection and its loopback forwarding listener.

func (*Tunnel) Addr

func (t *Tunnel) Addr() net.Addr

Addr returns the loopback listener address.

func (*Tunnel) Close

func (t *Tunnel) Close() error

Close stops forwarding and releases the SSH connection.

func (*Tunnel) Done

func (t *Tunnel) Done() <-chan struct{}

Done is closed when the tunnel is stopped.

Jump to

Keyboard shortcuts

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