Files
xc/remote/ssh.go
Воробьев Павел a28b8b5da5 configure ssh options
2020-09-15 16:43:54 +03:00

33 lines
671 B
Go

package remote
import (
"fmt"
)
var (
sshOptions = map[string]string{
"PasswordAuthentication": "no",
"PubkeyAuthentication": "yes",
"StrictHostKeyChecking": "no",
"TCPKeepAlive": "yes",
"ServerAliveCountMax": "12",
"ServerAliveInterval": "5",
}
)
// ApplyConfiguredOptions merges default options and configured ones
func ApplyConfiguredOptions(cfgOptions map[string]string) {
for k, v := range cfgOptions {
sshOptions[k] = v
}
}
func sshOpts() (params []string) {
params = make([]string, 0)
for opt, value := range sshOptions {
option := fmt.Sprintf("%s=%s", opt, value)
params = append(params, "-o", option)
}
return
}