remote

package
v0.12.4 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package remote provides UI-agnostic helpers for connecting to and inspecting remote execution targets (currently SSH). The connection + directory-listing logic here was extracted from the TUI command layer so that both the TUI and the web server can drive the same flow without depending on bubbletea.

Index

Constants

View Source
const (
	SSHHostKeyUnknown              = tools.SSHHostKeyUnknown
	SSHHostKeyChanged              = tools.SSHHostKeyChanged
	SSHHostKeyConfirmationMismatch = tools.SSHHostKeyConfirmationMismatch
)

Variables

This section is empty.

Functions

func BuildAuthMethods

func BuildAuthMethods(opts SSHOptions) ([]ssh.AuthMethod, error)

BuildAuthMethods assembles the SSH auth methods for the given options. It returns an error if an explicit key cannot be read or parsed, and falls back to the agent + default keys when no explicit credentials are supplied.

func Connect

func Connect(opts SSHOptions) (*tools.SSHExecutor, error)

Connect dials the remote host described by opts and returns a live executor.

func ConnectContext added in v0.12.4

func ConnectContext(ctx context.Context, opts SSHOptions) (*tools.SSHExecutor, error)

ConnectContext dials the remote host with bounded cancellation and JCode's strict known_hosts/TOFU policy.

func ConnectDocker added in v0.6.4

func ConnectDocker(ctx context.Context, containerRef string) (*tools.DockerExecutor, error)

ConnectDocker binds to a container by id or name, starting it if stopped (A1 semantics; see tools.AcquireDockerContainer).

func DiscoverPwd

func DiscoverPwd(ctx context.Context, exec tools.Executor, fallback string) string

DiscoverPwd returns the remote default working directory (best effort), falling back to the provided default when `pwd` cannot be determined.

func ListDirs

func ListDirs(ctx context.Context, exec tools.Executor, path string) ([]string, error)

ListDirs lists the sub-directories of path on the remote target using the executor. ".." is prepended (unless already at the filesystem root) so callers can render an "up" entry in a directory picker.

Types

type ContainerInfo added in v0.6.4

type ContainerInfo struct {
	ID      string `json:"id"`
	Name    string `json:"name"`
	Image   string `json:"image"`
	State   string `json:"state"`  // created / running / exited / ...
	Status  string `json:"status"` // human string, e.g. "Up 3 hours"
	Running bool   `json:"running"`
}

ContainerInfo is a UI-friendly summary of a Docker container for the remote-connect wizard's container picker.

func ListContainers added in v0.6.4

func ListContainers(ctx context.Context) ([]ContainerInfo, error)

ListContainers returns all containers (running and stopped), most useful first is left to the caller. It talks to the daemon configured via DOCKER_HOST (local socket by default).

type SSHHostKeyError added in v0.12.4

type SSHHostKeyError = tools.SSHHostKeyError

type SSHOptions

type SSHOptions struct {
	Host               string
	Port               int
	User               string
	Password           string // password auth
	KeyPath            string // explicit private key file (~ is expanded)
	Passphrase         string // passphrase for an encrypted private key
	AcceptHostKey      bool   // explicit TOFU confirmation
	HostKeyFingerprint string // SHA256 fingerprint shown by the previous attempt
}

SSHOptions describes how to reach and authenticate with a remote host.

Host may be "host", "host:port" or "user@host"; User and Port fill in the pieces a form provides separately. When neither Password nor KeyPath is set, authentication falls back to the SSH agent + the default ~/.ssh keys (the same behavior as tools.BuildSSHAuthMethods, used by the TUI).

Jump to

Keyboard shortcuts

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