danoctavian / bluntly

serverless, encrypted, NAT-breaking p2p connections - DEPRECATED
MIT License
267 stars 35 forks source link

rendezvous scheme simplification #3

Open mvayngrib opened 9 years ago

mvayngrib commented 9 years ago

hey, very cool project. I'm wondering, what's the need for the infoHash->rendezvousInfoHash scheme? I feel like you can get away with just one, but tell me if I'm wrong:

Each peer does:

dht.announce(myInfoHash, port) dht.lookup(peerInfoHash) dht.on('peer', function(addr, infoHash) { // someone wants to talk to me if (infoHash === myInfoHash) holePunch(addr) })

one downside I see here is that you will get yourself as one of the peers, since you don't know your own external ip

danoctavian commented 9 years ago

hey, thanks!

Yeah that's correct. Theoretically it's fine.

What i had in mind when i did it is that suppose N peers want to connect to a listener L. They will advertise themselves on infoHash all new peers attempting to connect to L, have to weed through N advertised addresses that do not listen until they find the real listener. The records persist for a while in the DHT so they will pile up. I wanted to avoid this behaviour.

Ideally i don't use a rendezvous point trick, ideally i have something like sammy kamkar's pwnat, but i couldn't get that to work.

mvayngrib commented 9 years ago

After hurting my brain for a while, I think your scheme works better.

I did observe the persisting records in the DHT, especially when using a random port each time, and it was highly annoying. I also noticed random peers in the DHT mirroring my messages back to me, which was funny (the first time).

If you're interested, your project inspired me to cook up something similar, though with some differences: rudp (takes care of hole-punching), and OTR (for encrypted chat). We're using it as part of a project for putting structured data on the bitcoin blockchain + in the DHT. I'd love some help with it, and I'll be monitoring bluntly for progress.

danoctavian commented 9 years ago

looks cool dude, i'll keep an eye out on your project.

at the moment i'm not developing bluntly more, i made it as POC, i'm glad it was useful in some way.

There are other production implementations out there like Bittorrent Bleep (closed source though) or Tox https://tox.im/ this one is open source but it relies on it's own "dht" for lookups.