github.com/jerryclinesmith/packer@v0.3.7/communicator/ssh/connect.go (about)

     1  package ssh
     2  
     3  import (
     4  	"log"
     5  	"net"
     6  	"time"
     7  )
     8  
     9  // ConnectFunc is a convenience method for returning a function
    10  // that just uses net.Dial to communicate with the remote end that
    11  // is suitable for use with the SSH communicator configuration.
    12  func ConnectFunc(network, addr string) func() (net.Conn, error) {
    13  	return func() (net.Conn, error) {
    14  		log.Printf("Opening conn for SSH to %s %s", network, addr)
    15  		return net.DialTimeout(network, addr, 15*time.Second)
    16  	}
    17  }