java.lang.Object
net.i2p.router.networkdb.reseed.ReseedBundler

public class ReseedBundlerextends Object
Copy a random selection of 'count' router infos from configDir/netDb to 'toDir'. Skip your own router info, and old, hidden, unreachable, and introduced routers, and those from bad countries.

Much easier than the one in installer/tools since we have a running router.

Caller must delete file when done.

  • Field Details

    • _context

      private final RouterContext _context
      The router building the bundle.
    • ROUTERINFO_PREFIX

      private static final String ROUTERINFO_PREFIX
      Start of a router info file's name.
      See Also:
    • ROUTERINFO_SUFFIX

      private static final String ROUTERINFO_SUFFIX
      End of a router info file's name.
      See Also:
    • MINIMUM

      private static final int MINIMUM
      Fewest routers that make a bundle worth reseeding with.
      See Also:
    • MIN_VERSION

      private static final String MIN_VERSION
      Oldest router version included in a bundle.
      See Also:
  • Constructor Details

    • ReseedBundler

      public ReseedBundler(RouterContext ctx)
      Holds the router context used for netDb lookups and temp file access.
      Parameters:
      ctx - the router context used to reach netDb, commSystem, and the temp directory
  • Method Details

    • createZip

      public File createZip(int count) throws IOException
      Create a zip file with a random selection of 'count' router infos from configDir/netDb to 'toDir'. Skip your own router info, and old, hidden, unreachable, and introduced routers, and those from bad countries.

      The file will be in the temp directory. Caller must move or delete.

      Parameters:
      count - how many router infos to bundle; at least MINIMUM are required unless fewer qualify
      Returns:
      the freshly written zip in the router temp directory, which the caller must move or delete
      Throws:
      IOException - if no eligible router infos were found, if fewer than the requested count qualified, or if the temp file could not be written
    • getRouterInfoName

      private static String getRouterInfoName(Hash hash)
      Copied/modded from PersistentDataStore.
      Parameters:
      hash - the router's hash
      Returns:
      the router info name