I need to create a custom timeout solution for ssh.Dial. I tried setting the timeout in the sshConfig, but it just doesn't work sometimes which causes the whole program to hang.
connection, err := ssh.Dial("tcp", "X.X.X.X:22", sshConfig)
In some cases it times out, it works in other cases. But it stumbles on specific IPs and doesn't do anything. It just hangs the entire program.
So how would I go about coding "my own" timeout solution for this line of code?