mirror of
https://github.com/hashicorp/packer.git
synced 2026-02-23 09:51:08 -05:00
17 lines
465 B
Go
17 lines
465 B
Go
package ssh
|
|
|
|
import (
|
|
"log"
|
|
"net"
|
|
"time"
|
|
)
|
|
|
|
// 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.
|
|
func ConnectFunc(network, addr string) func() (net.Conn, error) {
|
|
return func() (net.Conn, error) {
|
|
log.Printf("Opening conn for SSH to %s %s", network, addr)
|
|
return net.DialTimeout(network, addr, 15*time.Second)
|
|
}
|
|
}
|