- All Known Implementing Classes:
I2PClientImpl, I2PSimpleClient
public interface I2PClient
Define the standard means of interacting with the I2P system
An I2PClient contains no state, it is just a facility for creating private key files and generating sessions from existing private key files.
Field Summary
FieldsModifier 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.Method Summary
All MethodsModifier and TypeMethodDescriptioncreateDestination(OutputStream destKeyStream) Create a new destination with the default certificate creation properties and store it, along with the private encryption and signing keys at the specified location.createDestination(OutputStream destKeyStream, SigType type) Create a destination with the given signature type.createDestination(OutputStream destKeyStream, Certificate cert) Create a new destination with the given certificate and store it, along with the private encryption and signing keys at the specified location.createSession(InputStream destKeyStream, Properties options) Create a new client session for the Destination stored at the destKeyStream using the specified options to both connect to the router, to instruct the router how to handle the new session, and to configure the end to end encryption.
Field Details
PROP_TCP_HOST
Standard host property, defaulting to localhost if not specified.- See Also:
PROP_TCP_PORT
PROP_RELIABILITY
PROP_RELIABILITY_BEST_EFFORT
Reliability value: best effort.- See Also:
PROP_RELIABILITY_GUARANTEED
Reliability value: guaranteed.- See Also:
PROP_RELIABILITY_NONE
Reliability value: none. @since 0.8.1.- See Also:
PROP_SIGTYPE
Destination signature type property. @since 0.9.12.- See Also:
DEFAULT_SIGTYPE
Default signature type. @since 0.9.12.PROP_FAST_RECEIVE
For router->client payloads.If false, the router will send the MessageStatus, the client must respond with a ReceiveMessageBegin, the router will send the MessagePayload, and the client respond with a ReceiveMessageEnd.
If true, the router will send the MessagePayload immediately, and will not send a MessageStatus. The client will not send ReceiveMessageBegin or ReceiveMessageEnd.
Default false, but the implementation in this package sets to true.
- See Also:
PROP_ENABLE_SSL
Enable SSL for I2CP connection. @since 0.9.44, was protected in I2PSessionImpl.- See Also:
PROP_USER
Username for I2CP authentication. @since 0.9.44, was protected in I2PSessionImpl.- See Also:
PROP_PW
Password for I2CP authentication. @since 0.9.44, was protected in I2PSessionImpl.- See Also:
PROP_GZIP
Enable gzip compression for I2CP messages. @since 0.9.46.- See Also:
PROP_TUNNEL_BUILD_TIMEOUT
How many minutes to wait for the first lease set (tunnels) during session connect before failing. Integer; 0 or unparsable values fall back to the default of 60. @since 0.9.71+.- See Also:
DEFAULT_LISTEN_PORT
PROTOCOL_BYTE
static final int PROTOCOL_BYTEProtocol flag that must be sent when opening the i2cp connection to the router.- See Also:
Method Details
createSession
Create a new client session for the Destination stored at the destKeyStream using the specified options to both connect to the router, to instruct the router how to handle the new session, and to configure the end to end encryption.As of 0.9.19, defaults in options are honored.
- 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
createDestination
Create a new destination with the default certificate creation properties and store it, along with the private encryption and signing keys at the specified location.Caller must close stream.
- Parameters:
destKeyStream- stream to write the destination and keys to- Returns:
- the new destination, whose keys have been written to the stream
- Throws:
I2PException- on I2P protocol errorIOException- on IO error
createDestination
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 increateSession(InputStream, Properties).Caller must close stream.
- 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
Destination createDestination(OutputStream destKeyStream, Certificate cert) throws I2PException, IOException Create a new destination with the given certificate and store it, along with the private encryption and signing keys at the specified location.Caller must close stream.
- Parameters:
destKeyStream- stream to write the destination and keys tocert- certificate to tie to the destination- Returns:
- newly created destination
- Throws:
I2PException- on I2P protocol errorIOException- on IO error