class ClientManager extends Object
Modifier and Type | Field and Description |
---|---|
protected RouterContext |
_ctx |
protected boolean |
_isStarted |
protected List<ClientListenerRunner> |
_listeners |
protected int |
_port |
static SessionId |
UNKNOWN_SESSION_ID
65535
|
Constructor and Description |
---|
ClientManager(RouterContext context,
int port)
Does not start the listeners.
|
Modifier and Type | Method and Description |
---|---|
int |
destinationEstablished(ClientConnectionRunner runner,
Destination dest)
Add to the clients list.
|
(package private) void |
distributeMessage(Destination fromDest,
Destination toDest,
Payload payload,
MessageId msgId,
long messageNonce,
long expiration,
int flags)
Distribute message to a local or remote destination.
|
SessionConfig |
getClientSessionConfig(Destination dest)
Return the client's current config, or null if not connected
|
SessionKeyManager |
getClientSessionKeyManager(Hash dest)
Return the client's SessionKeyManager
Use this instead of the RouterContext.sessionKeyManager()
to prevent correlation attacks across destinations
|
(package private) ClientConnectionRunner |
getRunner(Destination dest)
Unsynchronized
|
(package private) Set<Destination> |
getRunnerDestinations() |
I2CPMessageQueue |
internalConnect()
The InternalClientManager interface.
|
boolean |
isAlive() |
boolean |
isLocal(Destination dest)
Unsynchronized.
|
boolean |
isLocal(Hash destHash)
Unsynchronized.
|
Set<Destination> |
listClients()
Unsynchronized.
|
void |
messageDeliveryStatusUpdate(Destination fromDest,
MessageId id,
long messageNonce,
int status) |
void |
messageReceived(ClientMessage msg) |
void |
registerConnection(ClientConnectionRunner runner) |
boolean |
registerEncryptedDestination(ClientConnectionRunner runner,
Hash hash)
Call after destinationEstablished(),
when an encrypted leaseset is created, so we know it's local.
|
void |
registerMetaDest(Destination dest)
Declare that we're going to publish a meta LS for this destination.
|
void |
renderStatusHTML(Writer out)
Deprecated.
unused
|
void |
reportAbuse(Destination dest,
String reason,
int severity)
Unused
|
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.
|
void |
requestLeaseSet(Hash dest,
LeaseSet ls)
Request that a particular client authorize the Leases contained in the
LeaseSet.
|
void |
restart() |
boolean |
shouldPublishLeaseSet(Hash destHash) |
void |
shutdown(String msg) |
void |
start() |
protected void |
startListeners()
Call from synchronized method
Todo: Start a 3rd listener for IPV6?
|
void |
unregisterConnection(ClientConnectionRunner runner)
Remove all sessions for this runner.
|
void |
unregisterEncryptedDestination(ClientConnectionRunner runner,
Hash hash)
Remove the hash for the encrypted LS.
|
void |
unregisterMetaDest(Destination dest)
Declare that we're no longer going to publish a meta LS for this destination.
|
void |
unregisterSession(SessionId id,
Destination dest)
Remove only the following session.
|
protected final List<ClientListenerRunner> _listeners
protected final RouterContext _ctx
protected final int _port
protected volatile boolean _isStarted
public static final SessionId UNKNOWN_SESSION_ID
public ClientManager(RouterContext context, int port)
public void start()
protected void startListeners()
public void restart()
public void shutdown(String msg)
msg
- message to send to the clientspublic I2CPMessageQueue internalConnect() throws I2PSessionException
I2PSessionException
- if the router isn't readypublic boolean isAlive()
public void registerConnection(ClientConnectionRunner runner)
public void unregisterConnection(ClientConnectionRunner runner)
public void unregisterSession(SessionId id, Destination dest)
public void unregisterEncryptedDestination(ClientConnectionRunner runner, Hash hash)
public int destinationEstablished(ClientConnectionRunner runner, Destination dest)
public boolean registerEncryptedDestination(ClientConnectionRunner runner, Hash hash)
hash
- the location of the encrypted LS, will change every daypublic void registerMetaDest(Destination dest) throws I2PSessionException
I2PSessionException
- on duplicate destpublic void unregisterMetaDest(Destination dest)
void distributeMessage(Destination fromDest, Destination toDest, Payload payload, MessageId msgId, long messageNonce, long expiration, int flags)
msgId
- the router's ID for this messagemessageNonce
- the client's ID for this messageflags
- ignored for localpublic void requestLeaseSet(Destination dest, LeaseSet set, long timeout, Job onCreateJob, Job onFailedJob)
dest
- Destination from which the LeaseSet's authorization should be requestedset
- LeaseSet with requested leases - this object must be updated to contain the
signed version (as well as any changed/added/removed Leases).
The LeaseSet contains Leases only; it is unsigned and does not have the destination set.timeout
- ms to wait before failingonCreateJob
- Job to run after the LeaseSet is authorizedonFailedJob
- Job to run after the timeout passes without receiving authorizationpublic void requestLeaseSet(Hash dest, LeaseSet ls)
dest
- Destination from which the LeaseSet's authorization should be requestedls
- LeaseSet with requested leases - this object must be updated to contain the
signed version (as well as any changed/added/removed Leases).
The LeaseSet contains Leases only; it is unsigned and does not have the destination set.public boolean isLocal(Destination dest)
public boolean isLocal(Hash destHash)
public boolean shouldPublishLeaseSet(Hash destHash)
public Set<Destination> listClients()
ClientConnectionRunner getRunner(Destination dest)
public SessionConfig getClientSessionConfig(Destination dest)
public SessionKeyManager getClientSessionKeyManager(Hash dest)
public void messageDeliveryStatusUpdate(Destination fromDest, MessageId id, long messageNonce, int status)
id
- the router's ID for this messagemessageNonce
- the client's ID for this messagestatus
- see I2CP MessageStatusMessage for success/failure codesSet<Destination> getRunnerDestinations()
public void reportAbuse(Destination dest, String reason, int severity)
dest
- null for all local destinations@Deprecated public void renderStatusHTML(Writer out) throws IOException
IOException
public void messageReceived(ClientMessage msg)