DHT的C ++实现

问题描述 投票:4回答:5

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

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

c++ cross-platform dht
5个回答
1
投票

maidsafe-dht有什么问题?


3
投票

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.ring.cx", "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进行编译。


2
投票

LibTorrent的Kademlia DHT是用C ++编写的,并且有很好的文档记录。 以下是具有不可变和可变get / put操作的示例代码:https://github.com/arvidn/libtorrent/blob/master/tools/dht_put.cpp


1
投票

您可以尝试retroshare使用的bitdht


1
投票

我找到了一个BitTorrent DHT library,由Transmission使用。它是用纯C编写的,但它可以很容易地从C ++中使用。

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

© www.soinside.com 2019 - 2024. All rights reserved.