title: Failed to dial when trying to create a session
body: <p>I try to connect to the host via ssh using a private key.
  I use an example from this documentation:
  <a href="https://pkg.go.dev/golang.org/x/crypto/ssh#PublicKeys" rel="nofollow noreferrer">https://pkg.go.dev/golang.org/x/crypto/ssh#PublicKeys</a></p>
  <pre><code>func main() {
      var hostKey ssh.PublicKey
      // A public key may be used to authenticate against the remote
      // server by using an unencrypted PEM-encoded private key file.
      //
      // If you have an encrypted private key, the crypto/x509 package
      // can be used to decrypt it.
      key, err := ioutil.ReadFile(&quot;/home/root/.ssh/id_rsa&quot;)
      if err != nil {
          log.Fatalf(&quot;unable to read private key: %v&quot;, err)
      }
  
      // Create the Signer for this private key.
      signer, err := ssh.ParsePrivateKey(key)
      if err != nil {
          log.Fatalf(&quot;unable to parse private key: %v&quot;, err)
      }
  
      config := &amp;ssh.ClientConfig{
          User: &quot;user&quot;,
          Auth: []ssh.AuthMethod{
              // Use the PublicKeys method for remote authentication.
              ssh.PublicKeys(signer),
          },
          HostKeyCallback: ssh.FixedHostKey(hostKey),
      }
  
      // Connect to the remote server and perform the SSH handshake.
      client, err := ssh.Dial(&quot;tcp&quot;, &quot;host.com:22&quot;, config)
      if err != nil {
          log.Fatalf(&quot;unable to connect: %v&quot;, err)
      }
      defer client.Close()
  }
  </code></pre>
  <p>And I've got an error:</p>
  <p><code>Failed to dial: dial tcp 10.1.12.10:22: connect: operation timed out</code></p>
  <p>I can connect to this host from the terminal on my mac so with a network I think it all is good.</p>
  <p>Maybe someone had a similar issue, will appreciate any help.</p>