开发者

C++ implementation of DHT

I am looking for opensource implementations of 开发者_StackOverflowKademlia DHT in C/C++. It must be lightweight and crossplatform (win/linux/mac).

It must be able to post information to DHT and retrieve it.


OpenDHT is a lightweight Kademlia DHT in C++11. The API is very simple :

dht::DhtRunner node;

// Launch a dht node on a new thread, using a
// generated RSA key pair, and listen on port 4222.
node.run(4222, dht::crypto::generateIdentity(), true);

// Join the network through any running node,
// here using a known bootstrap node.
node.bootstrap("bootstrap.jami.net", "4222");

// put some data on the dht
std::vector<uint8_t> some_data(5, 10);
node.put("unique_key", some_data);

It supports compiling with LLVM or GCC on OS X, Linux and Windows.


LibTorrent's Kademlia DHT is written in C++ and is well documented.
Here is example code with immutable and mutable get/put operations: https://github.com/arvidn/libtorrent/blob/master/tools/dht_put.cpp


What's wrong with maidsafe-dht ?


You could try bitdht used by retroshare.


I have found a BitTorrent DHT library, used by Transmission. It is written in pure C, but it can be easily used from C++.

I am using it in my C++ project. It works well but requires an external cryptographic hash and randomization functions.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜