java.lang.Object
net.i2p.client.impl.I2PClientImpl
- All Implemented Interfaces:
I2PClient
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final I2PAppContextThe router context the client runs in.private static final intBytes of random data behind the padding pattern.Fields inherited from interface I2PClient
DEFAULT_LISTEN_PORT, DEFAULT_SIGTYPE, PROP_ENABLE_SSL, PROP_FAST_RECEIVE, PROP_GZIP, PROP_PW, PROP_RELIABILITY, PROP_RELIABILITY_BEST_EFFORT, PROP_RELIABILITY_GUARANTEED, PROP_RELIABILITY_NONE, PROP_SIGTYPE, PROP_TCP_HOST, PROP_TCP_PORT, PROP_TUNNEL_BUILD_TIMEOUT, PROP_USER, PROTOCOL_BYTEModifier and TypeFieldDescriptionstatic final int7654.static final SigTypeDefault signature type.static final StringEnable SSL for I2CP connection.static final StringFor router->client payloads.static final StringEnable gzip compression for I2CP messages.static final StringPassword for I2CP authentication.static final StringReliability property.static final StringReliability value: best effort.static final StringReliability value: guaranteed.static final StringReliability value: none.static final StringDestination signature type property.static final StringStandard host property, defaulting to localhost if not specified.static final StringStandard port number property.static final StringHow many minutes to wait for the first lease set (tunnels) during session connect before failing.static final StringUsername for I2CP authentication.static final intProtocol flag that must be sent when opening the i2cp connection to the router.Constructor Summary
ConstructorsConstructorDescriptionConstruct a client bound to the global application context.Construct a client bound to a specific application context.Method Summary
All MethodsModifier and TypeMethodDescriptioncreateDestination(OutputStream destKeyStream) Create a destination with a DSA 1024/160 signature type and a null certificate.createDestination(OutputStream destKeyStream, SigType type) Create a destination with the given signature type.createDestination(OutputStream destKeyStream, Certificate cert) Create the destination with the given payload and write it out along with the PrivateKey and SigningPrivateKey to the destKeyStreamcreateSession(InputStream destKeyStream, Properties options) Create a new session (though do not connect it yet).createSession(I2PAppContext context, InputStream destKeyStream, Properties options) Create a new session (though do not connect it yet).
Field Details
PADDING_ENTROPY
private static final int PADDING_ENTROPYBytes of random data behind the padding pattern.- See Also:
_context
The router context the client runs in.
Constructor Details
I2PClientImpl
public I2PClientImpl()Construct a client bound to the global application context.I2PClientImpl
Construct a client bound to a specific application context.- Parameters:
ctx- the context the sessions created here will belong to
Method Details
createDestination
Create a destination with a DSA 1024/160 signature type and a null certificate. This is not bound to the I2PClient, you must supply the data back again increateSession(InputStream, Properties).Caller must close stream.
- Specified by:
createDestinationin interfaceI2PClient- Parameters:
destKeyStream- location to write out the destination, PrivateKey, and SigningPrivateKey, format is specified inPrivateKeyFile- Returns:
- the new destination, whose keys have been written to the stream
- Throws:
I2PException- on I2P protocol errorIOException- on IO error
createDestination
public Destination createDestination(OutputStream destKeyStream, SigType type) throws I2PException, IOException Create a destination with the given signature type. It will have a null certificate for DSA 1024/160 and KeyCertificate otherwise. This is not bound to the I2PClient, you must supply the data back again in createSession().Caller must close stream.
- Specified by:
createDestinationin interfaceI2PClient- Parameters:
destKeyStream- location to write out the destination, PrivateKey, and SigningPrivateKey, format is specified inPrivateKeyFiletype- the signature type for the destination- Returns:
- the new destination, whose keys have been written to the stream
- Throws:
I2PException- on I2P protocol errorIOException- on IO error
createDestination
public Destination createDestination(OutputStream destKeyStream, Certificate cert) throws I2PException, IOException Create the destination with the given payload and write it out along with the PrivateKey and SigningPrivateKey to the destKeyStreamIf cert is a KeyCertificate, the signing keypair will be of the specified type. The KeyCertificate data must be ............................. The padding if any will be randomized. The extra key data if any will be set in the key cert.
Caller must close stream.
- Specified by:
createDestinationin interfaceI2PClient- Parameters:
destKeyStream- location to write out the destination, PrivateKey, and SigningPrivateKey, format is specified inPrivateKeyFilecert- certificate to tie to the destination- Returns:
- newly created destination
- Throws:
I2PException- on I2P protocol errorIOException- on IO error
createSession
public I2PSession createSession(InputStream destKeyStream, Properties options) throws I2PSessionException Create a new session (though do not connect it yet).- Specified by:
createSessionin interfaceI2PClient- Parameters:
destKeyStream- location from which to read the Destination, PrivateKey, and SigningPrivateKey from, format is specified inPrivateKeyFileoptions- set of options to configure the router with, if null will use System properties- Returns:
- new session allowing a Destination to receive all of its messages and send messages to any other Destination.
- Throws:
I2PSessionException- if there is a problem creating the session
createSession
public I2PSession createSession(I2PAppContext context, InputStream destKeyStream, Properties options) throws I2PSessionException Create a new session (though do not connect it yet).- Parameters:
context- the I2PAppContext to usedestKeyStream- location from which to read the Destination, PrivateKey, and SigningPrivateKey from, format is specified inPrivateKeyFileoptions- set of options to configure the router with, if null will use System properties- Returns:
- the newly created session, not yet logged in
- Throws:
I2PSessionException- if the stream does not hold a valid Destination, PrivateKey and SigningPrivateKey