This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
Help us improve Python packaging - Donate today!

I2P bindings for Twisted

Project Description

txi2p is a set of I2P bindings for Twisted 10.1 or greater. It currently requires Python 2.

txi2p supports both the SAM and BOB APIs for I2P. The default API is SAM.

Installation

You can install txi2p from PyPI:

$ pip2 install txi2p

or by downloading the source and running:

$ pip2 install .

inside the source directory.

Quickstart

If you are not familiar with using endpoints or endpoint strings, read the Twisted endpoints documentation.

Using endpoint classes

To 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 strings

Requires Twisted 14.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 strings

The Twisted plugin for clientFromString() and serverFromString() will only work for Twisted 14.0 or greater.

Both client and server strings support the following keyword arguments:

  • api=<apiName> - Either SAM or BOB.
  • apiEndpoint=<endpointString> - An escaped client endpoint string pointing to the API, e.g. tcp\:127.0.0.1\:2827.

Clients

Client string format:

i2p:<host>[:port][:key=value]*

Supported arguments:

SAM

  • nickname
  • autoClose
  • keyfile
  • localPort
  • options
  • sigType

BOB

  • tunnelNick
  • inhost
  • inport
  • options

Servers

Server string format:

i2p:<keyfile>[:port][:key=value]*

Supported arguments:

SAM

  • nickname
  • autoClose
  • options
  • sigType

BOB

  • tunnelNick
  • outhost
  • outport
  • options

Important changes

0.3.2

  • The 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.3

  • Ports are now supported on the SAM API.
    • Previous port options are no longer ignored.
    • New localPort option for setting the client’s local port.
  • The SAMI2PStreamServerEndpoint API has changed to no longer require a reactor.

Documentation

API documentation is available at https://txi2p.readthedocs.org

Release History

Release History

This version
History Node

0.3.2

History Node

0.3.1

History Node

0.3

History Node

0.2.1

History Node

0.2.post1

History Node

0.2

History Node

0.1.5

History Node

0.1.2

History Node

0.1.1

History Node

0.1.0

Download Files

Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
txi2p-0.3.2.tar.gz (33.1 kB) Copy SHA256 Checksum SHA256 Source Apr 3, 2017

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting