I recently started using OpenVPN. It is useful because you can securely connect many clients from different networks. However, when two clients communicate, they are not directly connected but they go through the server. This means that the performance depends on the server's upload and download speeds. Is there a way for the clients to connect to each other directly, similar to how it is done with Hamachi? I'm basically trying to connect some clients that are behind firewalls so that they can communicate as if they were on the same LAN. I was looking for an Open Source solution where I can host the server that organizes all the clients.
tinc seems to do the trick : http://www.tinc-vpn.org/
m2c
In OpenVPN no.
You can certainly create the mesh configuration, but there's no automatic support.
Hamachi (As I understand it) also goes through servers, they're merely servers owned by hamachi, rather than your servers. If two machines cannot communicate, then they won't be able to open tunnels to each other. If they can, then you can set up the VPNs on each machine, to each other machine to do this. Or, you can host a server somewhere with all the OpenVPN tunnels terminating on it.
The UDP hole punching isn't unique to Hamachi. You might want to start by looking up STUN. (This won't help on its own, you might have to make something if you need it badly enough)