add ssh timeout
This commit is contained in:
parent
2f73df73b1
commit
59c2c028c8
@ -9,6 +9,7 @@ import (
|
|||||||
"os/user"
|
"os/user"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/kevinburke/ssh_config"
|
"github.com/kevinburke/ssh_config"
|
||||||
"golang.org/x/crypto/ssh"
|
"golang.org/x/crypto/ssh"
|
||||||
@ -106,6 +107,7 @@ func (remoteConfig *Host) ConnectToSSHHost() (*ssh.Client, error) {
|
|||||||
User: remoteConfig.User,
|
User: remoteConfig.User,
|
||||||
Auth: []ssh.AuthMethod{ssh.PublicKeys(signer)},
|
Auth: []ssh.AuthMethod{ssh.PublicKeys(signer)},
|
||||||
HostKeyCallback: ssh.FixedHostKey(hostKey),
|
HostKeyCallback: ssh.FixedHostKey(hostKey),
|
||||||
|
Timeout: 5 * time.Second,
|
||||||
}
|
}
|
||||||
for _, host := range remoteConfig.HostName {
|
for _, host := range remoteConfig.HostName {
|
||||||
println("Connecting to " + host)
|
println("Connecting to " + host)
|
||||||
|
Loading…
Reference in New Issue
Block a user