"ruderich.org/simon/safcm/remote"
)
-func (c *Conn) DialSSH(user, host, sshConfig string) error {
+type SSHConfig struct {
+ Host string
+ User string // optional
+ SshConfig string // optional
+}
+
+func (c *Conn) DialSSH(cfg SSHConfig) error {
if c.events == nil {
return fmt.Errorf("cannot reuse Conn")
}
- remote := host
- if user != "" {
- remote = user + "@" + host
+ remote := cfg.Host
+ if cfg.User != "" {
+ remote = cfg.User + "@" + cfg.Host
}
c.debugf("DialSSH: connecting to %q", remote)
}
c.sshRemote = remote
- if sshConfig != "" {
- c.sshOpts = append(c.sshOpts, "-F", sshConfig)
+ if cfg.SshConfig != "" {
+ c.sshOpts = []string{"-F", cfg.SshConfig}
}
c.cmd = exec.Command("ssh",
append(append([]string{}, c.sshOpts...),
tmp="$(mktemp "$x.XXXXXX")"
# Report filename for upload
echo "$tmp"
-
# Wait for upload to complete
read unused