java.lang.Object
org.klomp.snark.dht.KRPC
org.klomp.snark.dht.TorrentKRPC
All Implemented Interfaces:
I2PSessionListener, I2PSessionMuxedListener, DHT

public class TorrentKRPCextends KRPC
A DHT instance for one or more torrents on a shared transient I2P session and destination. Shares the main instance's routing table, tracker, and blacklist, but generates its own NID, query ports, and token maps, so that tokens issued for one destination can never authorize an announce from another, which would make remote nodes store the wrong peer hash for a torrent. Serves tracker queries only for its assigned torrents' infohashes, so probing this destination never reveals torrents hosted elsewhere on the router.
  • Constructor Details

    • TorrentKRPC

      public TorrentKRPC(I2PAppContext ctx, KRPC shared, I2PSession session, Collection<InfoHash> ihs)
      Create a DHT instance on a torrent's transient destination.
      Parameters:
      ctx - the application context owning the session and logging
      shared - the main DHT instance, whose routing table, tracker, and blacklist are shared; must be started already
      session - the transient session of the torrents' destination
      ihs - the infohashes of the torrents served on this destination
  • Method Details

    • start

      public void start()
      Registers the datagram listeners on this instance's own session and ports, without loading the DHT file or starting the cleaner, explorer, tracker, and routing table, which remain the job of the main instance.
      Overrides:
      start in class KRPC
    • stop

      public void stop()
      Unregisters the datagram listeners, leaving the shared routing table, tracker, and blacklist running for the main instance.
      Specified by:
      stop in interface DHT
      Overrides:
      stop in class KRPC