Documentation
¶
Overview ¶
Package sshx dials hosts from the inventory (with jump-host chains, keychain/agent/password auth and TOFU host-key checking) and runs commands.
Index ¶
- func BuildCommand(c *Client, r RunRequest) (cmd string, stdinPrefix []byte, err error)
- func ForgetHost(addr string) (int, error)
- func KnownHostsPath() string
- func Output(ctx context.Context, c *Client, cmd string, timeout time.Duration) (string, int, error)
- func ParseAdhoc(s string) (*store.Host, error)
- func Q(s string) string
- func ScanHostKey(ctx context.Context, addr string, timeout time.Duration) (ssh.PublicKey, error)
- func TrustKey(addr string, key ssh.PublicKey) error
- type Client
- type Options
- type RunRequest
- type RunResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildCommand ¶
func BuildCommand(c *Client, r RunRequest) (cmd string, stdinPrefix []byte, err error)
BuildCommand assembles the final remote shell line: env exports, cd, sudo wrapping. Exposed so --dry-run can show exactly what would run.
func ForgetHost ¶
ForgetHost removes known_hosts lines for addr (host:port normalised).
func KnownHostsPath ¶
func KnownHostsPath() string
func ParseAdhoc ¶
ParseAdhoc parses user@host:port into a transient host.
func ScanHostKey ¶
ScanHostKey fetches the server's host key without authenticating.
Types ¶
type Client ¶
Client wraps an ssh.Client plus the chain of jump clients that must be closed with it.
type RunRequest ¶
type RunResult ¶
type RunResult struct {
ExitCode int `json:"exit_code"`
Stdout string `json:"stdout"`
Stderr string `json:"stderr"`
StdoutTruncated bool `json:"stdout_truncated,omitempty"`
StderrTruncated bool `json:"stderr_truncated,omitempty"`
TimedOut bool `json:"timed_out,omitempty"`
Signal string `json:"signal,omitempty"`
DurationMS int64 `json:"duration_ms"`
}