I'm writing an application which will be doing something similar to SSH tunnelling (port forwarding and reverse port forwarding). However, SSH will not be involved at all, hence why I'm not using any existing libraries to do this.
What I'd like to know is how SSH currently achieves tunnelling. Are tunnels multiplexed over the initial SSH connection, or are multiple connections created for each tunnel?