Documentation
¶
Overview ¶
Package ssh builds argument vectors for invoking either `gcloud compute ssh` or the system `ssh` binary, given a set of user-chosen Options.
The package is intentionally UI-free: it has no Bubble Tea dependencies and is fully unit-testable.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildGcloudArgs ¶
BuildGcloudArgs returns argv to pass to `exec.Command("gcloud", args...)`.
Each --ssh-flag value becomes its own argv element. gcloud forwards each element to ssh as a single token, so "-l USER" must be split as "--ssh-flag=-l --ssh-flag=USER" rather than joined-and-quoted.
func BuildSSHArgs ¶
BuildSSHArgs returns argv to pass to `exec.Command("ssh", args...)`.
opts.InternalIP is intentionally ignored here: in ssh mode the dialog has already encoded the desired address into opts.Host.
func LookupBinary ¶
LookupBinary returns the absolute path to `name` if found on $PATH.
Types ¶
type Options ¶
type Options struct {
// Method is used by callers to pick BuildGcloudArgs vs BuildSSHArgs;
// the builders themselves do not read it.
Method Method
Project string // gcloud only
Zone string // gcloud only
Instance string // gcloud only — used as the SSH target
Host string // ssh only — the destination address
User string // optional, both modes
IAPTunnel bool // gcloud only
InternalIP bool // gcloud only — ssh mode encodes the IP into Host instead
PortForward string // optional, both modes — "L:H:R"
}
Options bundles every choice the SSH dialog can produce.