[英]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.