I’ve seen a few but I can’t decide which protocol to use yet. I’m working on a DHT pet project and I’d like to avoid making it rely on any relay servers.
Thanks in advance for any pointers!
If all you want is to break through NAT, you can try a TURN client (rusturn for instance). Unfortunately, STUN/TURN doesn’t solve the entire problem (there are types of NAT that it can’t break through and you need to fall back to full relay mode) but this technology is still used for P2P voice calls all over the place.
You could consider Veilid, which already handles a lot of DHT stuff. It’s not exactly ultra low latency but it does solve the reachability solution without you having to host any STUN/TURN servers yourself. You can also tweak the protocol a little (either get Tor-like privacy through a whole bunch of intermediate nodes, or just pick two nodes per direction for lower latency).
I don’t think there’s a Rust crate, but Yggdrasil can also take care of NAT for you while at the same time being exposed like a normal network, so you don’t need to learn a new API.
There’s libtor that’ll let you embed a Tor client inside your application. Of course Tor is most well-known for privacy and such, but it’s also very effective at busting through any kind of NAT you can imagine.
Unfortunately, there is no way to get P2P working across the internet without some kind of handshake server, someone needs to tell you where to find the other nodes.
Thanks a bunch for the detailed response! Yes, for this project which is not really serious I just need to have some NAT scenarios working, so that I can try it with a few friends. I’m on a quest to understand how decentralized technologies and cryptography work. I think rusturn should do the trick.
Whoa… why was your response deleted?
deleted by creator
Ah, I see. Good to know that. Sounds like a good practice.