diff --git a/i2p2www/pages/site/docs/applications/embedding.html b/i2p2www/pages/site/docs/applications/embedding.html index e6db6cc6..cae5a352 100644 --- a/i2p2www/pages/site/docs/applications/embedding.html +++ b/i2p2www/pages/site/docs/applications/embedding.html @@ -1,14 +1,16 @@ {% extends "global/layout.html" %} {% block title %}{% trans %}Embedding I2P in your Application{% endtrans %}{% endblock %} -{% block lastupdated %}2019-11{% endblock %} -{% block accuratefor %}0.9.44{% endblock %} +{% block lastupdated %}2023-01{% endblock %} +{% block accuratefor %}2.1.0{% endblock %} {% block content %}

{% trans %}Overview{% endtrans %}

{% trans -%} This page is about bundling the entire I2P router binary with your application. It is not about writing an application to work with I2P (either bundled or external). -{%- endtrans %}

+{%- endtrans %} +However, many of the guidelines may be useful even if not bundling a router. +

{% trans -%} Lots of projects are bundling, or talking about bundling, I2P. That's great if done right. @@ -17,8 +19,10 @@ The I2P router is complex, and it can be a challenge to hide all the complexity This page discusses some general guidelines. {%- endtrans %}

- - +

+Most of these guidelines apply equally to Java I2P or i2pd. +However, some guidelines are specific to Java I2P and are noted below. +

{% trans %}Talk to us{% endtrans %}

{% trans -%} @@ -125,8 +129,53 @@ Be aware of possible blocking by hostile governments. +

Use Shared Clients

+

+Java I2P i2ptunnel supports shared clients, where clients may be configured to use a single pool. +If you require multiple clients, and if consistent with your security goals, +configure the clients to be shared. +

+ + + +

Limit Tunnel Quantity

+

+Specify tunnel quantity explicitly with the options inbound.quantity and outbound.quantity. +The default in Java I2P is 2; the default in i2pd is higher. +Specify in the SESSION CREATE line using SAM to get consistent settings with both routers. +Two each in/out is sufficient for most low-to-medium bandwidth and low-to-medium fanout applications. +Servers and high-fanout P2P applications may need more. +See this forum post for guidance on calculating requirements +for high-traffic servers and applications. +

+ + + + +

Limit SAM Sessions

+

+Most applications will only need one SAM session. +SAM provides the ability to quickly overwhelm the local router, or even the broader network, +if a large number of sessions are created. +If multiple sub-services can use a single session, set them up with +a PRIMARY session and SUBSESSIONS (not currently supported on i2pd). +A reasonable limit to sessions is 3 or 4 total, or maybe up to 10 for rare situations. +If you do have multiple sessions, be sure to specify a low tunnel quantity for each, see above. +

+In almost no situation should you require a unique session per-connection. +Without careful design, this could quickly DDoS the network. +Carefully consider if your security goals require unique sessions. +Please consult with the Java I2P or i2pd developers before implementing per-connection sessions. +

+ +

{% trans %}Reduce Network Resource Usage{% endtrans %}

+

+Note that these options are not currently supported on i2pd. +These options are supported via I2CP and SAM (except delay-open, which is via i2ptunnel only). +See the I2CP documentation (and, for delay-open, the i2ptunnel configuration documentation) for details. +

{% trans -%} Consider setting your application tunnels to delay-open, reduce-on-idle and/or close-on-idle. This is straightforward if using i2ptunnel but you'll have to implement some of it yourself if using I2CP directly. @@ -207,6 +256,9 @@ and talk to the people who are running them to make sure it's ok.

{% trans %}Time / NTP Issues{% endtrans %}

+

+Note: This section refers to Java I2P. i2pd does not include an SNTP client. +

{% trans -%} I2P includes an SNTP client. I2P requires correct time to operate. It will compensate for a skewed system clock but this may delay startup. You may disable I2P's SNTP queries, @@ -216,6 +268,9 @@ but this isn't advised unless your application makes sure the system clock is co

{% trans %}Choose What and How you Bundle{% endtrans %}

+

+Note: This section refers to Java I2P only. +

{% trans -%} At a minimum you will need i2p.jar, router.jar, streaming.jar, and mstreaming.jar. You may omit the two streaming jars for a datagram-only app. @@ -243,15 +298,18 @@ License requirements may require you to include the LICENSES.txt file and the li

  • {% trans -%} You may also wish to bundle a hosts.txt file. {%- endtrans %}
  • -
  • {% trans -%} -Be sure to specify a Java 7 bootclasspath if compiling with Java 8. -{%- endtrans %}
  • +
  • +Be sure to specify a bootclasspath if you are compiling Java I2P for your release, rather than taking our binaries. +
  • {% trans %}Android considerations{% endtrans %}

    +

    +Note: This section refers to Java I2P only. +

    {% trans -%} Our Android router app may be shared by multiple clients. If it is not installed, the user will be prompted when he starts a client app. @@ -269,6 +327,9 @@ If you require assistance, please contact us.

    {% trans %}Maven jars{% endtrans %}

    +

    +Note: This section refers to Java I2P only. +

    {% trans -%} We have a limited number of our jars on Maven Central. There are numerous trac tickets for us to address that will improve and expand the released jars on Maven Central. @@ -326,6 +387,9 @@ Other examples are: Vuze, the Nightweb Android app, iMule, TAILS, iCloak, and Mo

    {% trans %}Code Example{% endtrans %}

    +

    +Note: This section refers to Java I2P only. +

    {% trans -%} None of the above actually tells you how to write your code to bundle the Java router, so following is a brief example.