@@ -310,6 +310,8 @@ type Settings struct {
310310
311311 VersionString string
312312
313+ ConnectTimeout time.Duration
314+
313315 ntlm * ntlmssp.Client
314316}
315317
@@ -363,7 +365,8 @@ func Run(settings *Settings) {
363365 }
364366
365367 config := & ssh.ClientConfig {
366- User : fmt .Sprintf ("%s.%s" , username , hostname ),
368+ Timeout : settings .ConnectTimeout ,
369+ User : fmt .Sprintf ("%s.%s" , username , hostname ),
367370 Auth : []ssh.AuthMethod {
368371 ssh .PublicKeys (sshPriv ),
369372 },
@@ -396,8 +399,9 @@ func Run(settings *Settings) {
396399 var conn net.Conn
397400 if scheme != "stdio" {
398401 log .Println ("Connecting to" , settings .Addr )
402+
399403 // First create raw TCP connection
400- conn , err = Connect (realAddr , settings .ProxyAddr , config . Timeout , settings .ProxyUseHostKerberos , settings .ntlm )
404+ conn , err = Connect (realAddr , settings .ProxyAddr , settings . ConnectTimeout , settings .ProxyUseHostKerberos , settings .ntlm )
401405 if err != nil {
402406
403407 if errMsg := err .Error (); strings .Contains (errMsg , "missing port in address" ) {
@@ -426,7 +430,7 @@ func Run(settings *Settings) {
426430 continue
427431 }
428432
429- <- time .After (10 * time .Second )
433+ time .Sleep (10 * time .Second )
430434 continue
431435 }
432436
@@ -480,7 +484,7 @@ func Run(settings *Settings) {
480484 case "http" , "https" :
481485
482486 conn , err = NewHTTPConn (scheme + "://" + realAddr , func () (net.Conn , error ) {
483- return Connect (realAddr , settings .ProxyAddr , config . Timeout , settings .ProxyUseHostKerberos , settings .ntlm )
487+ return Connect (realAddr , settings .ProxyAddr , settings . ConnectTimeout , settings .ProxyUseHostKerberos , settings .ntlm )
484488 })
485489
486490 if err != nil {
0 commit comments