@@ -22,8 +22,8 @@ const (
22
22
defaultSSHAuthMethods = "agent,privkey"
23
23
)
24
24
25
- func (curi * ConnectionURI ) parseAuthMethods () []ssh.AuthMethod {
26
- q := curi .Query ()
25
+ func (u * ConnectionURI ) parseAuthMethods () []ssh.AuthMethod {
26
+ q := u .Query ()
27
27
28
28
authMethods := q .Get ("sshauth" )
29
29
if authMethods == "" {
@@ -65,7 +65,7 @@ func (curi *ConnectionURI) parseAuthMethods() []ssh.AuthMethod {
65
65
}
66
66
result = append (result , ssh .PublicKeys (signer ))
67
67
case "ssh-password" :
68
- if sshPassword , ok := curi .User .Password (); ok {
68
+ if sshPassword , ok := u .User .Password (); ok {
69
69
result = append (result , ssh .Password (sshPassword ))
70
70
} else {
71
71
log .Printf ("[ERROR] Missing password in userinfo of URI authority section" )
@@ -79,12 +79,12 @@ func (curi *ConnectionURI) parseAuthMethods() []ssh.AuthMethod {
79
79
return result
80
80
}
81
81
82
- func (curi * ConnectionURI ) dialSSH () (net.Conn , error ) {
83
- authMethods := curi .parseAuthMethods ()
82
+ func (u * ConnectionURI ) dialSSH () (net.Conn , error ) {
83
+ authMethods := u .parseAuthMethods ()
84
84
if len (authMethods ) < 1 {
85
85
return nil , fmt .Errorf ("Could not configure SSH authentication methods" )
86
86
}
87
- q := curi .Query ()
87
+ q := u .Query ()
88
88
89
89
knownHostsPath := q .Get ("knownhosts" )
90
90
knownHostsVerify := q .Get ("known_hosts_verify" )
@@ -107,7 +107,7 @@ func (curi *ConnectionURI) dialSSH() (net.Conn, error) {
107
107
hostKeyCallback = cb
108
108
}
109
109
110
- username := curi .User .Username ()
110
+ username := u .User .Username ()
111
111
if username == "" {
112
112
u , err := user .Current ()
113
113
if err != nil {
@@ -123,12 +123,12 @@ func (curi *ConnectionURI) dialSSH() (net.Conn, error) {
123
123
Timeout : 2 * time .Second ,
124
124
}
125
125
126
- port := curi .Port ()
126
+ port := u .Port ()
127
127
if port == "" {
128
128
port = defaultSSHPort
129
129
}
130
130
131
- sshClient , err := ssh .Dial ("tcp" , fmt .Sprintf ("%s:%s" , curi .Hostname (), port ), & cfg )
131
+ sshClient , err := ssh .Dial ("tcp" , fmt .Sprintf ("%s:%s" , u .Hostname (), port ), & cfg )
132
132
if err != nil {
133
133
return nil , err
134
134
}
0 commit comments