gpt4 book ai didi

DHT的C++实现

转载 作者:塔克拉玛干 更新时间:2023-11-03 01:25:17 31 4
gpt4 key购买 nike

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

它必须能够将信息发布到 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 进行编译。

关于DHT的C++实现,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6281543/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com