I want to build a decentralized, reddit-like system using P2P. What existing p2p library should I base it on?

吃可爱长大的小学妹 提交于 2019-12-04 07:55:32

问题


I want to build a decentralized, reddit-like system using P2P. Basically, I want to retain the basic capabilities of reddit, but make it decentralized, to make it more robust and immune to censorship. This will also allow people to develop different clients to match the way they want to browse it.

Could you recommend good p2p libraries to base my work on? They should be open-source, cross-platform, robust and easy to use. I don't care much about the language, I can adapt.


回答1:


Disclaimer: warning, self-promotion here !!!

Have you considered JXTA's latest release? It is probably sufficient for what you want to do. Else, we are working on a new P2P framework called Chaupal, but it is not operational yet.

EDIT

There is also what I call the quick-and-dirty UDP solution (which is not so dirty after all, I should call it minimal).

  1. Just implement one server with a public address and start listening for UPD.
  2. Peers located behind NATs contact the server which can read how their private IP address has been translated into a public IP address from the received datagrams.
  3. You send that information back to the peer who can forward it to other peers. The server can also help exchanging this information between peers.
  4. Then peers can communicate directly (one-to-one) by sending datagrams to these translated addresses.

Simple, easy to implement, but does not cover for lost datagrams, replays, out-of-order etc... (i.e., the typical stuff that TCP solves for you at the IP stack level).




回答2:


I haven't had a chance to use it, but Telehash seems to have been made for this kind of application. Peer2Peer apps have a particular challenge dealing with the restrictions of firewalls... since Telehash is based on UDP, it's well suited for hole-punching through firewalls.

EDIT for static_rtti's comment:

If code velocity is a requirement libjingle has a lot of effort going into it, but is primarily geared towards XMPP. You can port off parts of the ICE code and at least get hole-punching. See the libjingle architecture overview for details about their implementation.




回答3:


Check out CouchDB. It's a decentralized web app platform that uses an HTTP API. People have used it to create "CouchApps" which are decentralized CouchDB-based applications that can spread in a viral nature to other CouchDB servers. All you need to know to write CouchApps is Javascript and learn the CouchDB API. You can read this free online book to learn more: http://guide.couchdb.org

The secret sauce to CouchDB is a Master-to-Master replication protocol that lets information spread like a virus. When I attended the first CouchConf, they demonstrated how efficient this is by throwing a "Couch Party" (which is where you have a room full of people replicating to the person next to them simulating an ad hoc network).

Also, all the code that makes a CouchApp work is public by default in special entities known as Design Documents.

P.S. I've been thinking of doing a similar project, but I don't have a lot of time to devote to it at the moment. GOD SPEED MY BOY!



来源:https://stackoverflow.com/questions/5612230/i-want-to-build-a-decentralized-reddit-like-system-using-p2p-what-existing-p2p

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!