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 ConnectDocker(ctx context.Context, containerRef string) (*tools.DockerExecutor, 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 ContainerInfo
- 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 ConnectDocker ¶ added in v0.6.4
ConnectDocker binds to a container by id or name, starting it if stopped (A1 semantics; see tools.AcquireDockerContainer).
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 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 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).