java.lang.Object
net.i2p.router.web.helpers.ClientSKMDebugHelper

public class ClientSKMDebugHelperextends Object
Renders every client ratchet session key manager as one table, with a thead/tbody/tfoot section per client as on the update manager page, so the columns align across all clients. Inbound tag sets, outbound sessions and outbound tag sets share the column grid. Cells that do not apply to a row's kind show an em-dash. The tfoot carries the client's session counters. Clients whose SKM has no ratchet part (plain ElGamal) keep their own tag-status rendering below the table.
  • Field Details

  • Constructor Details

    • ClientSKMDebugHelper

      private ClientSKMDebugHelper()
      Static helpers only, no instances.
  • Method Details

    • columns

      private static String columns(RouterContext ctx)
      The column header row, translated.
      Parameters:
      ctx - the router context for the translation bundle
      Returns:
      the header row html
    • render

      public static void render(RouterContext ctx, Writer out) throws IOException
      Write the consolidated table, one section per distinct client ratchet SKM (unwrapping the muxed variants), plus the legacy status section for each client whose SKM has no ratchet part (plain ElGamal).
      Parameters:
      ctx - the router context
      out - where to write
      Throws:
      IOException - if writing to out fails
    • appendRatchet

      private static void appendRatchet(RouterContext ctx, StringBuilder sections, String title, RatchetSKM rskm)
      Appends one ratchet's debug rows under a title.
      Parameters:
      ctx - the router context
      sections - the page sections being built
      title - the heading for this ratchet
      rskm - the ratchet to report on
    • peerRenderer

      private static java.util.function.Function<String,String> peerRenderer()
      Turns a base64 key-hash cell into a destination reference: the peer of a client session is a destination, never a router, so no router-info markup (flag, bandwidth) applies and there is nothing to look up. Shows the short hash with the full hash as title. Falls back to the label itself when it is not a hash (e.g. the "null" key).
      Returns:
      a function mapping the cell text to html
    • legacySection

      private static void legacySection(Writer out, String title, SessionKeyManager skm) throws IOException
      Pre-ratchet SKMs keep their own tag-status rendering.
      Parameters:
      out - where the section HTML is written
      title - the client title, already HTML-escaped, used in the heading
      skm - the key manager that renders its own status HTML
      Throws:
      IOException - if the writer fails partway through the section
    • clientTitle

      private static String clientTitle(RouterContext ctx, Destination dest, Hash h)
      The client's nickname when its inbound tunnel has one, otherwise the base32 destination.
      Parameters:
      ctx - the router context whose tunnel manager is asked for the settings
      dest - the client's destination, shown as base32 when there is no nickname
      h - the client's hash, used to look up the inbound tunnel settings
      Returns:
      the escaped nickname, or the base32 destination wrapped in a span
    • buildSection

      static String buildSection(String title, List<String[]> rows, String summary)
      Build one thead/tbody/tfoot section with the default english columns and no peer rendering. Package-visible for testing.
      Parameters:
      title - the client title html
      rows - unified rows from RatchetSKM.getDebugRows()
      summary - the counters line, or null for no tfoot
      Returns:
      the section html, never null
    • buildSection

      static String buildSection(String title, List<String[]> rows, String summary, String columns, int peerCol, java.util.function.Function<String,String> peerRenderer)
      Build one thead/tbody/tfoot section. The title is pre-escaped html. The cell at peerCol is passed through peerRenderer (trusted html, e.g. a router-info reference) instead of being escaped. Package-visible for testing.
      Parameters:
      title - the client title html
      rows - unified rows from RatchetSKM.getDebugRows()
      summary - the counters line, or null for no tfoot
      columns - the translated header row html
      peerCol - index of the peer column, or -1 for none
      peerRenderer - renders the peer cell html, or null to escape it
      Returns:
      the section html, never null