X-Git-Url: https://ruderich.org/simon/gitweb/?p=safcm%2Fsafcm.git;a=blobdiff_plain;f=rpc%2Fdial.go;h=c0c6cd4088b2859d758aa0d06cf64405a2b70a16;hp=caa34b098fe933ca9fba22d7f0ea35aadb05d33a;hb=8a3f6af248e28ea7efc1bf89751a597d28834942;hpb=783a6fe604cdedeb386e9abad59b7d87d0d119e0 diff --git a/rpc/dial.go b/rpc/dial.go index caa34b0..c0c6cd4 100644 --- a/rpc/dial.go +++ b/rpc/dial.go @@ -32,14 +32,20 @@ import ( "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) @@ -50,8 +56,8 @@ func (c *Conn) DialSSH(user, host, sshConfig string) error { } c.sshRemote = remote - if sshConfig != "" { - c.sshOpts = []string{"-F", sshConfig} + if cfg.SshConfig != "" { + c.sshOpts = []string{"-F", cfg.SshConfig} } c.cmd = exec.Command("ssh", append(append([]string{}, c.sshOpts...),