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 ¶
- func BuildAuthMethods(opts SSHOptions) ([]ssh.AuthMethod, error)
- func Connect(opts SSHOptions) (*tools.SSHExecutor, error)
- func DiscoverPwd(ctx context.Context, exec tools.Executor, fallback string) string
- func ListDirs(ctx context.Context, exec tools.Executor, path string) ([]string, error)
- func ProjectLabel(exec *tools.SSHExecutor, remotePwd string) string
- type SSHOptions
Constants ¶
This section is empty.
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 DiscoverPwd ¶
DiscoverPwd returns the remote default working directory (best effort), falling back to the provided default when `pwd` cannot be determined.
func ListDirs ¶
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.
func ProjectLabel ¶
func ProjectLabel(exec *tools.SSHExecutor, remotePwd string) string
ProjectLabel returns a stable, host-qualified identifier for a remote working directory. It is used as the session "project" key so remote sessions are grouped separately from local paths of the same name. Form: ssh://user@host:port/remote/path
Types ¶
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
}
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).