简体   繁体   English

DHT的C++实现

[英]C++ implementation of DHT

I am looking for opensource implementations of Kademlia DHT in C/C++.我正在寻找 C/C++ 中Kademlia DHT 的开源实现。 It must be lightweight and crossplatform (win/linux/mac).它必须是轻量级和跨平台的(win/linux/mac)。

It must be able to post information to DHT and retrieve it.它必须能够将信息发布到 DHT 并检索它。

OpenDHT is a lightweight Kademlia DHT in C++11. OpenDHT是 C++11 中的轻量级 Kademlia DHT。 The API is very simple: 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);

It supports compiling with LLVM or GCC on OS X, Linux and Windows.它支持在 OS X、Linux 和 Windows 上使用 LLVM 或 GCC 编译。

LibTorrent's Kademlia DHT is written in C++ and is well documented. LibTorrent 的 Kademlia DHT 是用 C++ 编写的,并且有据可查。
Here is example code with immutable and mutable get/put operations: https://github.com/arvidn/libtorrent/blob/master/tools/dht_put.cpp这是具有不可变和可变 get/put 操作的示例代码: https://github.com/arvidn/libtorrent/blob/master/tools/dht_put.cpp

I have found a BitTorrent DHT library , used by Transmission.我找到了传输使用的BitTorrent DHT 库 It is written in pure C, but it can be easily used from C++.它是用纯 C 编写的,但可以从 C++ 轻松使用。

I am using it in my C++ project.我在我的 C++ 项目中使用它。 It works well but requires an external cryptographic hash and randomization functions.它运行良好,但需要外部加密 hash 和随机化功能。

What's wrong with maidsafe-dht ? maidsafe-dht有什么问题?

You could try bitdht used by retroshare.你可以试试retroshare使用的bitdht

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM