【问题标题】:C++ implementation of DHTDHT的C++实现
【发布时间】:2011-06-08 15:44:19
【问题描述】:

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

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

【问题讨论】:

    标签: c++ cross-platform dht


    【解决方案1】:

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

    【讨论】:

      【解决方案2】:

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

      【讨论】:

        【解决方案3】:

        maidsafe-dht 有什么问题?

        【讨论】:

        • 谢谢!我 git 克隆了源代码,它看起来非常优质且易于理解。
        【解决方案4】:

        你可以试试retroshare使用的bitdht

        【讨论】:

        • 太糟糕了,它不完全完整。
        【解决方案5】:

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

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

        【讨论】:

          猜你喜欢
          • 2016-01-16
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2019-05-10
          • 1970-01-01
          相关资源
          最近更新 更多