5

我正在寻找C/C++中Kademlia DHT 的开源实现。它必须是轻量级和跨平台的(win/linux/mac)。

它必须能够将信息发布到 DHT 并检索它。

4

5 回答 5

4

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 进行编译。

于 2015-04-06T21:03:14.730 回答
2

LibTorrent 的 Kademlia DHT 是用 C++ 编写的,并且有据可查。
这是具有不可变和可变 get/put 操作的示例代码: https ://github.com/arvidn/libtorrent/blob/master/tools/dht_put.cpp

于 2018-09-28T05:29:38.717 回答
1

你可以试试retroshare使用的bitdht

于 2011-08-17T08:11:57.800 回答
1

maidsafe-dht有什么问题?

于 2011-06-08T15:52:21.023 回答
1

我找到了传输使用的BitTorrent DHT 库。它是用纯 C 编写的,但可以很容易地从 C++ 中使用。

我在我的 C++ 项目中使用它。它运行良好,但需要外部加密哈希和随机化函数。

于 2016-10-12T18:36:57.183 回答