java.lang.Object
net.i2p.router.ClientManagerFacade
All Implemented Interfaces:
Service
Direct Known Subclasses:
ClientManagerFacadeImpl, DummyClientManagerFacade

public abstract class ClientManagerFacadeextends Object implements Service
Manages client connections and LeaseSet operations for I2P applications. Handles client registration, lease authorization, and session management for local services.
  • Field Details

  • Constructor Details

    • ClientManagerFacade

      protected ClientManagerFacade()
      Package-private constructor for abstract class.
  • Method Details

    • requestLeaseSet

      public abstract void requestLeaseSet(Destination dest, LeaseSet set, long timeout, Job onCreateJob, Job onFailedJob)
      Request that a particular client authorize the Leases contained in the LeaseSet, after which the onCreateJob is queued up. If that doesn't occur within the timeout specified, queue up the onFailedJob. This call does not block.
      Parameters:
      dest - Destination from which the LeaseSet's authorization should be requested
      set - LeaseSet with requested leases - this object must be updated to contain the signed version (as well as any changed/added/removed Leases)
      timeout - ms to wait before failing
      onCreateJob - Job to run after the LeaseSet is authorized
      onFailedJob - Job to run after the timeout passes without receiving authorization
    • requestLeaseSet

      public abstract void requestLeaseSet(Hash dest, LeaseSet set)
      Request that the client authorize the Leases contained in the LeaseSet, identified by destination hash.
      Parameters:
      dest - Hash of the destination
      set - LeaseSet with requested leases
    • reportAbuse

      public abstract void reportAbuse(Destination dest, String reason, int severity)
      Instruct the client (or all clients) that they are under attack. This call does not block.
      Parameters:
      dest - Destination under attack, or null if all destinations are affected
      reason - Why the router thinks that there is abusive behavior
      severity - How severe the abuse is, with 0 being not severe and 255 is the max
    • isLocal

      public abstract boolean isLocal(Destination dest)
      Determine if the destination specified is managed locally. This call DOES block.
      Parameters:
      dest - Destination to be checked
      Returns:
      true if the destination is local
    • isLocal

      public abstract boolean isLocal(Hash destHash)
      Determine if the destination hash specified is managed locally. This call DOES block.
      Parameters:
      destHash - Hash of Destination to be checked
      Returns:
      true if the destination hash is local
    • messageDeliveryStatusUpdate

      public abstract void messageDeliveryStatusUpdate(Destination fromDest, MessageId id, long messageNonce, int status)
      Update the delivery status of a message.
      Parameters:
      fromDest - the source destination of the message
      id - the router's ID for this message
      messageNonce - the client's ID for this message
      status - see I2CP MessageStatusMessage for success/failure codes
    • messageReceived

      public abstract void messageReceived(ClientMessage msg)
      Receive a message from the network for a local client.
      Parameters:
      msg - the received client message
    • verifyClientLiveliness

      public boolean verifyClientLiveliness()
      Verify that the client manager is still alive and responding.
      Returns:
      true if the client manager is alive
    • isAlive

      public boolean isAlive()
      Check whether this service is alive.
      Returns:
      true if alive
    • shouldPublishLeaseSet

      public boolean shouldPublishLeaseSet(Hash destinationHash)
      Does the client specified want their leaseSet published?
      Parameters:
      destinationHash - the destination hash to check
      Returns:
      true if the leaseSet should be published
    • listClients

      public Set<Destination> listClients()
      Return the list of locally connected clients.
      Returns:
      set of Destination objects
    • getClientSessionConfig

      public abstract SessionConfig getClientSessionConfig(Destination dest)
      Return the client's current config, or null if not connected.
      Parameters:
      dest - the client destination
      Returns:
      the client session config, or null
    • getClientSessionKeyManager

      public abstract SessionKeyManager getClientSessionKeyManager(Hash dest)
      The session key manager for a given client.
      Parameters:
      dest - the destination hash
      Returns:
      the session key manager
    • renderStatusHTML

      public void renderStatusHTML(Writer out) throws IOException
      Render the client status HTML.
      Specified by:
      renderStatusHTML in interface Service
      Parameters:
      out - the writer to write to
      Throws:
      IOException - if an error occurs writing
    • shutdown

      public abstract void shutdown(String msg)
      Shut down the client manager with a reason message.
      Parameters:
      msg - the shutdown reason
    • registerMetaDest

      public void registerMetaDest(Destination dest) throws I2PSessionException
      Declare that we're going to publish a meta LS for this destination. Must be called before publishing the leaseset.
      Parameters:
      dest - the destination to register
      Throws:
      I2PSessionException - on duplicate dest
    • unregisterMetaDest

      public void unregisterMetaDest(Destination dest)
      Declare that we're no longer going to publish a meta LS for this destination.
      Parameters:
      dest - the destination to unregister
    • getClientFloodfillNetworkDatabaseFacade

      public abstract FloodfillNetworkDatabaseFacade getClientFloodfillNetworkDatabaseFacade(Hash destHash)
      The FloodfillNetworkDatabaseFacade associated with a particular client destination. This is inside the runner, so it won't be there if the runner isn't ready.
      Parameters:
      destHash - destination hash associated with the client who's subDb we're looking for
      Returns:
      non-null FloodfillNetworkDatabaseFacade
    • getPrimaryHashes

      public abstract Set<Hash> getPrimaryHashes()
      A set of all primary hashes.
      Returns:
      non-null set of Hashes