code: func CheckConnection(network, ip string, port int, timeout time.Duration) bool {
  	conn, _ := net.DialTimeout(network,
  		net.JoinHostPort(ip, strconv.Itoa(port)), timeout)
  	if conn != nil {
  		conn.Close()
  		return true
  	}
  	return false
  }
docs: // CheckConnection connects to the specified host on the specified port.
  // If the connection is successful then return true.