Package: txi2p
txi2pis a set of I2P bindings forTwisted10.1 or greater. It currently requires Python 2.txi2psupports both the SAM and BOB APIs for I2P. The default API is SAM.InstallationYou can installtxi2pfrom PyPI:$ pip2 install txi2por by downloading the source and running:$ pip2 install .inside the source directory.QuickstartIf you are not familiar with using endpoints or endpoint strings, read theTwisted endpointsdocumentation.Using endpoint classesTo connect to an I2P site:from twisted.internet import reactor
from twisted.internet.endpoints import clientFromString
from txi2p.sam import SAMI2PStreamClientEndpoint

samEndpoint = clientFromString(reactor, 'tcp:127.0.0.1:7656')
endpoint = SAMI2PStreamClientEndpoint.new(samEndpoint, 'stats.i2p')
d = endpoint.connect(factory)To have a server listen on an I2P Destination:from twisted.internet import reactor
from twisted.internet.endpoints import clientFromString
from txi2p.sam import SAMI2PStreamServerEndpoint

samEndpoint = clientFromString(reactor, 'tcp:127.0.0.1:7656')
endpoint = SAMI2PStreamServerEndpoint.new(samEndpoint, '/path/to/keyfile')
d = endpoint.listen(factory)Using endpoint stringsRequiresTwisted14.0 or greater.To connect to an I2P site:from twisted.internet import reactor
from twisted.internet.endpoints import clientFromString

endpoint = clientFromString(reactor, 'i2p:stats.i2p')
d = endpoint.connect(factory)To have a server listen on an I2P Destination:from twisted.internet import reactor
from twisted.internet.endpoints import serverFromString

endpoint = serverFromString(reactor, 'i2p:/path/to/keyfile')
d = endpoint.listen(factory)To connect using a specific API:from twisted.internet import reactor
from twisted.internet.endpoints import clientFromString

endpoint = clientFromString(reactor, 'i2p:stats.i2p:api=BOB')
d = endpoint.connect(factory)To connect using a non-standard API host or port:from twisted.internet import reactor
from twisted.internet.endpoints import clientFromString

endpoint = clientFromString(reactor, 'i2p:stats.i2p:api=SAM:apiEndpoint=tcp\:127.0.0.1\:31337')
d = endpoint.connect(factory)Endpoint stringsThe Twisted plugin forclientFromString()andserverFromString()will
only work forTwisted14.0 or greater.Both client and server strings support the following keyword arguments:api=<apiName>- EitherSAMorBOB.apiEndpoint=<endpointString>- An escaped client endpoint string pointing
to the API, e.g.tcp\:127.0.0.1\:2827.ClientsClient string format:i2p:<host>[:port][:key=value]*Supported arguments:SAMnicknameautoClosekeyfilelocalPortoptionssigTypeBOBtunnelNickinhostinportoptionsServersServer string format:i2p:<keyfile>[:port][:key=value]*Supported arguments:SAMnicknameautoCloseoptionssigTypeBOBtunnelNickouthostoutportoptionsImportant changes0.3.2The default signature type for new Destinations is Ed25519.If the SAM server does not support that (Java I2P 0.9.16 and earlier), txi2p
will fall back on ECDSA_SHA256_P256, followed by the old default DSA_SHA1.0.3Ports are now supported on the SAM API.Previousportoptions are no longer ignored.NewlocalPortoption for setting the client’s local port.TheSAMI2PStreamServerEndpointAPI has changed to no longer require a
reactor.DocumentationAPI documentation is available athttps://txi2p.readthedocs.org