I have found a copy of synapse_ssh_test.zip but that only works with cryptlib because cryptlib has the tunnel-function in it. I'm not sure OpenSSL has that default.
It's not a problem. Can you attach it to me?
The original synapse_ssh_test.zip had an .exe and lots of dcu and was originally for Delphi.
I cleaned it up and changed it for use in Lazarus.
You need to add cl32.dll yourself (it was too big).
I tried to tunnel port 127.0.0.1:22 and tried to reconnect back to the same server but it didn't work. It did try but I got a "ssh_exchange_identification: Connection closed by remote host". So it tried to make the real connection.
But you can see how it works.
It creates a listenerthread on a port (I chose 51000) and when a connection is made with that port it will create a clientthread which forwards all traffic from port 51000 to the specified IP:Port over the Host:22 SSH connection.
Please report back if you get the example working (and how). I'm sure others will find it interesting too.