# Package org.klomp.snark.dht

Distributed Hash Table (DHT) implementation for BitTorrent.

See: Description

- Interface Summary
  Interface | Description
  --- | ---
  DHT | Stub for KRPC

- Class Summary
  Class | Description
  --- | ---
  DHTNodes | All the nodes we know about, stored as a mapping from node ID to a Destination and Port.
  DHTTracker | The tracker stores peers, i.e.
  InfoHash | Represents a BitTorrent info hash used for DHT operations.
  KBTrimmer | Kademlia bucket trimmer for DHT node management.
  KRPC | Kademlia Remote Procedure Call implementation for BitTorrent DHT (BEP 5) adapted for I2P.
  MsgID | Used for both incoming and outgoing message IDs
  NID | Node Identifier (NID) for Kademlia DHT operations.
  NodeInfo | Comprehensive node information container for DHT operations.
  NodeInfoComparator | Comparator for finding nodes closest to a target key in the DHT keyspace.
  Peer | Represents a single peer participating in a specific torrent within the DHT tracker.
  Peers | Thread-safe collection of all peers participating in a single torrent.
  PersistDHT | Retrieve / Store the local DHT in a file
  Token | DHT token management for secure peer verification.
  TokenKey | Indexing key for DHT tokens based on node ID and info hash combination.
  Torrents | Thread-safe collection of all torrents tracked by the DHT.

## Package org.klomp.snark.dht Description

Distributed Hash Table (DHT) implementation for BitTorrent.

This package provides a DHT implementation based on the Mainline DHT protocol, allowing I2PSnark to discover peers and find torrents without relying on centralized trackers. The DHT enables decentralized peer discovery and improved download performance.

Key components:

- DHT node management and routing
- Peer discovery and announcement
- Get_peers and announce_peer operations
- Node ID generation and maintenance
- Bucket management and node replacement
- Token-based security mechanisms

The DHT implementation follows the BEP 5 specification and integrates seamlessly with I2P's anonymous networking layer to provide private, decentralized peer discovery.