-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 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...),
}
c.cmd = exec.Command("ssh",
append(append([]string{}, c.sshOpts...),