java.lang.Object
net.i2p.router.web.FormHandler
net.i2p.router.web.helpers.NetDbHelper

public class NetDbHelperextends FormHandler
Helper for network database page rendering and form processing. Handles router information searches, filtering, and display operations. Integrates with NetDbRenderer and SybilRenderer for output generation. Extends FormHandler for form submission handling since 0.9.38.
  • Field Details

    • _routerPrefix

      private String _routerPrefix
      Router hash prefix to filter on.
    • _version

      private String _version
      Version string to filter on.
    • _country

      private String _country
      Country code to filter on.
    • _family

      private String _family
      Family name to filter on.
    • _caps

      private String _caps
      Capability string to filter on.
    • _ip

      private String _ip
      IP address to filter on.
    • _sybil

      private String _sybil
      Sybil classification to filter on.
    • _mtu

      private String _mtu
      MTU value to filter on.
    • _ssucaps

      private String _ssucaps
      SSU capability string to filter on.
    • _ipv6

      private String _ipv6
      IPv6 flag to filter on.
    • _transport

      private String _transport
      Transport name to filter on.
    • _hostname

      private String _hostname
      Hostname to filter on.
    • _sort

      private String _sort
      Column name to sort by.
    • _full

      private int _full
      Nonzero to show the full summary view.
    • _port

      private int _port
      Port number to filter on.
    • _cost

      private int _cost
      Cost value to filter on.
    • _page

      private int _page
      Page number being displayed.
    • _mode

      private int _mode
      Display mode of the peer list.
    • _highPort

      private int _highPort
      Nonzero to filter on high ports.
    • _icount

      private int _icount
      Intro key count to filter on.
    • _date

      private long _date
      Publication date to filter on.
    • _limit

      private int _limit
      Rows shown per page.
    • _lease

      private boolean _lease
      True to include lease sets in the search.
    • _clientOnly

      private boolean _clientOnly
      True to show client-capable routers only.
    • _debug

      private boolean _debug
      True for extra search logging.
    • _type

      private SigType _type
      Signature type to filter on.
    • _etype

      private EncType _etype
      Encryption type to filter on.
    • _postOK

      private boolean _postOK
      True when the POST values parsed cleanly.
    • DEFAULT_LIMIT

      private static final int DEFAULT_LIMIT
      Default rows shown per page.
    • titles

      private static final String[] titles
      Column titles of the netdb peer list.
  • Constructor Details

    • NetDbHelper

      public NetDbHelper()
      Create the helper; all state arrives per request through the form handlers.
  • Method Details

    • isFloodfill

      public boolean isFloodfill()
      Whether the router is a floodfill router.
      Returns:
      true if this router is a floodfill
    • setRouter

      public void setRouter(String r)
      Set the router hash prefix for lookup.
      Parameters:
      r - the router hash prefix
    • setVersion

      public void setVersion(String v)
      Set the router version filter.
      Parameters:
      v - the version string
    • setCountry

      public void setCountry(String c)
      Set the country filter.
      Parameters:
      c - the country code
    • setFamily

      public void setFamily(String c)
      Set the family filter.
      Parameters:
      c - the family string
    • setCaps

      public void setCaps(String c)
      Set the capabilities filter.
      Parameters:
      c - the capabilities string
    • setIp

      public void setIp(String c)
      Set the IP address filter.
      Parameters:
      c - the IP address
    • setSybil

      public void setSybil(String c)
      Set the Sybil analysis filter.
      Parameters:
      c - the Sybil analysis target
    • setSybil2

      public void setSybil2(String c)
      For form, same as above but with a length check.
      Parameters:
      c - the Sybil analysis target
    • setPort

      public void setPort(String f)
      Set the port filter (single port or range).
      Parameters:
      f - the port string
    • setType

      public void setType(String f)
      Set the signature type filter.
      Parameters:
      f - the signature type string
    • setEtype

      public void setEtype(String f)
      Set the encryption type filter.
      Parameters:
      f - the encryption type string
    • setMtu

      public void setMtu(String f)
      Set the MTU filter.
      Parameters:
      f - the MTU string
    • setIpv6

      public void setIpv6(String f)
      Set the IPv6 prefix filter.
      Parameters:
      f - the IPv6 prefix
    • setSsucaps

      public void setSsucaps(String f)
      Set the SSU capabilities filter.
      Parameters:
      f - the SSU capabilities string
    • setTransport

      public void setTransport(String f)
      Set the transport filter.
      Parameters:
      f - the transport string
    • setCost

      public void setCost(String f)
      Set the cost filter.
      Parameters:
      f - the cost string
    • setMode

      public void setMode(String f)
      Set the mode filter.
      Parameters:
      f - the mode string
    • setDate

      public void setDate(String f)
      Set the date filter.
      Parameters:
      f - the date string
    • setFull

      public void setFull(String f)
      Set the full display mode.
      Parameters:
      f - the mode value
    • setShow

      public void setShow(String show)
      Set by show= param (alternative to f=N). Overrides _full if present.
      Parameters:
      show - the keyword selecting which entries to show, overriding setFull: "all", "all_debug", "sybils", "lookup", "client", "client_debug", "local", "ls_remote", "ls_debug" or "ls_local"; an unrecognized or null value changes nothing
    • setLease

      public void setLease(String l)
      Set the lease display mode.
      Parameters:
      l - the lease mode value
    • setLeaseset

      public void setLeaseset(String f)
      Set the leaseset hostname for lookup.
      Parameters:
      f - the hostname or b32
    • setLimit

      public void setLimit(String f)
      Set the result limit.
      Parameters:
      f - the limit as a string
    • setPage

      public void setPage(String f)
      Set the page number.
      Parameters:
      f - the page as a string
    • setSort

      public void setSort(String f)
      Set the sort field.
      Parameters:
      f - the sort field
    • setIntros

      public void setIntros(String f)
      Set the intro count filter.
      Parameters:
      f - the intro count string
    • setClientPage

      public void setClientPage(String f)
      Set the client page.
      Parameters:
      f - the page value
    • getNonce

      private String getNonce()
      Get a session-bound nonce for forms in this page.
      Returns:
      the nonce to embed in this page's forms
    • processForm

      protected void processForm()
      Now we're a FormHandler.
      Specified by:
      processForm in class FormHandler
    • getFloodfillNetDbSummary

      public String getFloodfillNetDbSummary()
      Render the floodfill-filtered netdb summary; storeWriter() must be called previously.
      Returns:
      the netdb summary HTML
    • getNetDbSummary

      public String getNetDbSummary()
      Render the full netdb summary; storeWriter() must be called previously.
      Returns:
      the net db summary
    • renderFragment

      public void renderFragment(String id)
      Render a single named element for the contentonly fragment mode of the netdb page. Only the remote and local leasesets listings are currently fragmentable.
      Parameters:
      id - the element id to render
    • getTab

      private int getTab()
      Return the currently selected NetDb tab index.
      Returns:
      the index into the navigation bar's title and link arrays for the tab this request belongs to, or 0 if it belongs to none
    • renderNavBar

      private String renderNavBar()
      Render the NetDb navigation bar.
      Returns:
      the navigation bar HTML
    • getNavBarHtml

      public String getNavBarHtml()
      Get the navigation bar HTML.
      Returns:
      the nav bar HTML
    • renderLookupForm

      private void renderLookupForm() throws IOException
      Render the NetDb search/lookup form.
      Throws:
      IOException - if writing to the console output fails
    • renderCompactLookupForm

      private void renderCompactLookupForm() throws IOException
      Creates a simplified search form: a select element listing all original fields as options with grouped signature, encryption and transport types, a single text input for the search value, and a submit button. Includes tooltips and option groups for signatures, encryption types and transport.
      Throws:
      IOException - on write error