#include "socket.h"#include "krpc.h"#include <string>#include <vector>#include <array>#include <unordered_map>#include <unordered_set>#include <functional>#include <thread>#include <mutex>#include <atomic>#include <chrono>#include <memory>#include <condition_variable>Go to the source code of this file.
Classes | |
| struct | std::hash< librats::Peer > |
| struct | std::hash< array< uint8_t, 20 > > |
| struct | librats::DhtNode |
| DHT Node information Based on libtorrent's node_entry with fail_count and RTT tracking. More... | |
| struct | librats::DeferredCallbacks |
| Deferred callbacks structure for avoiding deadlock Callbacks are collected while holding the mutex, then invoked after releasing it. More... | |
| class | librats::DhtClient |
| DHT Kademlia implementation. More... | |
Namespaces | |
| namespace | std |
| STL namespace. | |
| namespace | librats |
| namespace | librats::SearchNodeFlags |
| Search node state flags (bitfield) Flags can be combined to track the full history of a node in a search. | |
Typedefs | |
| using | librats::NodeId = std::array< uint8_t, NODE_ID_SIZE > |
| using | librats::InfoHash = std::array< uint8_t, NODE_ID_SIZE > |
| using | librats::PeerDiscoveryCallback = std::function< void(const std::vector< Peer > &peers, const InfoHash &info_hash)> |
| Peer discovery callback. | |
| using | librats::SpiderAnnounceCallback = std::function< void(const InfoHash &info_hash, const Peer &peer)> |
| Spider mode callback Called when a peer announces they have a torrent (announce_peer request received) | |
Functions | |
| NodeId | librats::string_to_node_id (const std::string &str) |
| Utility functions. | |
| std::string | librats::node_id_to_string (const NodeId &id) |
| Convert NodeId to string. | |
| NodeId | librats::hex_to_node_id (const std::string &hex) |
| Convert hex string to NodeId. | |
| std::string | librats::node_id_to_hex (const NodeId &id) |
| Convert NodeId to hex string. | |
Variables | |
| constexpr size_t | librats::NODE_ID_SIZE = 20 |
| constexpr size_t | librats::K_BUCKET_SIZE = 8 |
| constexpr size_t | librats::ALPHA = 3 |
| constexpr int | librats::DHT_PORT = 6881 |
| constexpr uint8_t | librats::SearchNodeFlags::QUERIED = 1 << 0 |
| constexpr uint8_t | librats::SearchNodeFlags::SHORT_TIMEOUT = 1 << 1 |
| constexpr uint8_t | librats::SearchNodeFlags::RESPONDED = 1 << 2 |
| constexpr uint8_t | librats::SearchNodeFlags::TIMED_OUT = 1 << 3 |
| constexpr uint8_t | librats::SearchNodeFlags::ABANDONED = 1 << 4 |