github.com/kaixiang/packer@v0.5.2-0.20140114230416-1f5786b0d7f1/communicator/ssh/connect.go (about)

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