[英]C++ implementation of DHT
OpenDHT是 C++11 中的轻量级 Kademlia DHT。 API 非常简单:
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);
它支持在 OS X、Linux 和 Windows 上使用 LLVM 或 GCC 编译。
LibTorrent 的 Kademlia DHT 是用 C++ 编写的,并且有据可查。
这是具有不可变和可变 get/put 操作的示例代码: https://github.com/arvidn/libtorrent/blob/master/tools/dht_put.cpp
我找到了传输使用的BitTorrent DHT 库。 它是用纯 C 编写的,但可以从 C++ 轻松使用。
我在我的 C++ 项目中使用它。 它运行良好,但需要外部加密 hash 和随机化功能。
maidsafe-dht有什么问题?
你可以试试retroshare使用的bitdht 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.