2013-07-14 07:22:41 -04:00
|
|
|
package ssh
|
|
|
|
|
|
|
|
import (
|
|
|
|
"log"
|
|
|
|
"net"
|
2013-07-14 07:31:51 -04:00
|
|
|
"time"
|
2013-07-14 07:22:41 -04:00
|
|
|
)
|
|
|
|
|
|
|
|
// ConnectFunc is a convenience method for returning a function
|
|
|
|
// that just uses net.Dial to communicate with the remote end that
|
|
|
|
// is suitable for use with the SSH communicator configuration.
|
2013-08-22 14:53:31 -04:00
|
|
|
func ConnectFunc(network, addr string) func() (net.Conn, error) {
|
2013-07-14 07:22:41 -04:00
|
|
|
return func() (net.Conn, error) {
|
2013-08-22 14:53:31 -04:00
|
|
|
log.Printf("Opening conn for SSH to %s %s", network, addr)
|
|
|
|
return net.DialTimeout(network, addr, 15*time.Second)
|
2013-07-14 07:22:41 -04:00
|
|
|
}
|
|
|
|
}
|