Skip to content
Snippets Groups Projects
Select Git revision
  • 3a67624b99854a73b138d9b3bb711c3e24e3ce8c
  • master default
  • dependabot/github_actions/actions/download-artifact-5
  • wheels
  • msvc_argon2
  • build_error
  • copilot/fix-776
  • vcpkg_cache
  • cmake_fixes
  • pulls/1772757862/750
  • copilot/fix-770
  • windows_ci_static
  • c_link
  • cpack
  • windows_ci
  • cert_pk_id
  • proxy_push_result
  • cnode_put_id
  • update-windows-build
  • proxy
  • resubscribe_on_token_change
  • v3.5.3rc3
  • v3.5.3rc2
  • v3.5.3rc1
  • v3.5.2
  • v3.5.1
  • v3.5.0
  • v3.5.0rc4
  • v3.5.0rc3
  • v3.5.0rc2
  • v3.5.0rc1
  • v3.4.0
  • v3.3.1
  • v3.3.1rc1
  • v3.3.1rc2
  • v3.3.0
  • v3.2.0
  • v3.1.11
  • v3.1.10
  • v3.1.9
  • v3.1.8.2
41 results

opendht

  • Open with
  • Download source code
  • Your workspaces

      A workspace is a virtual sandbox environment for your code in GitLab.

      No agents available to create workspaces. Please consult Workspaces documentation for troubleshooting.

  • user avatar
    Philippe Groarke authored
    3a67624b
    History

    DhtCpp

    A lightweight C++11 Distributed Hash Table implementation

    • Light C++11 Kademlia DHT library
    • Simple API
    • Support for arbitrary value types with common types built-in: simple blob (user data) or bittorrent-style "service announcement"
    • "Identity" layer with data signature and encryption (using GnuTLS)
    • Value edition authentified by the identity layer or with custom per-value-type hooks
    • Fast bootstrap and announce time
    • Originally based on https://github.com/jech/dht by Juliusz Chroboczek

    work in progress

    Dependencies

    • GnuTLS 3.1+, used to compute hashes and for the identity layer.

    TODO

    • Event listening
    • Documention
    • ...

    Examples

    dht::DhtRunner node;
    
    // Launch a new dht node using generated RSA keys,
    // and listen on port 4222.
    node.run(4222, dht::crypto::generateIdentity());
    
    // put some data on the dht
    std::vector<uint8_t> some_data(5, 10);
    node.put("unique_key", some_data);
    
    // get data from the dht
    node.get("other_unique_key", [](const std::vector<std::shared_ptr<Value>>& values) {
        // Callback called when values are found
        for (const auto& value : values)
            std::cout << "Found value: " << value << std::endl;
        return true; // return false to stop the search
    });