Documentation
¶
Index ¶
- type Client
- func (c *Client) Close() error
- func (c *Client) CopyFileTo(ctx context.Context, localPath, remotePath string) error
- func (c *Client) CopyFiles(ctx context.Context, localPaths []string, remoteDir string) error
- func (c *Client) Run(ctx context.Context, command string) (string, error)
- func (c *Client) RunWithOutput(ctx context.Context, command string, w io.Writer) error
- func (c *Client) Stream(ctx context.Context, command string) (<-chan string, error)
- type Config
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client wraps an SSH connection to a remote host.
func NewClient ¶
NewClient establishes an SSH connection using the given config.
Key resolution order:
- PILOT_SSH_KEY env var — PEM content directly (CI/CD pipelines, GitHub Actions secrets)
- cfg.KeyPath file — local path, supports ~/ expansion
func (*Client) CopyFileTo ¶
CopyFileTo uploads a single local file to an exact remote path, creating parent directories as needed. Use this instead of CopyFiles when the remote path must differ from the basename (e.g. preserving relative directory structure: ./nginx/prod.conf → ~/pilot/nginx/prod.conf).
func (*Client) CopyFiles ¶
CopyFiles uploads local files to a remote directory using SCP-over-SSH. All files land flat in remoteDir (basename only, no subdirectory structure).
func (*Client) RunWithOutput ¶
RunWithOutput executes a command on the remote host and writes combined stdout+stderr to w in real time. Returns an error if the command exits non-zero. Unlike Run, the caller sees output as it arrives — useful for long-running commands such as docker pull or docker compose up.