1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198
|
===========
txi2p-tahoe
===========
This is a hopefully temporary fork of txi2p_, to help Tahoe-LAFS_
project to get unstuck in Python 3 porting efforts.
.. _txi2p: https://pypi.org/project/txi2p/
.. _Tahoe-LAFS: https://pypi.org/project/tahoe-lafs/
.. image:: https://api.travis-ci.org/str4d/txi2p.svg?branch=master
:target: https://www.travis-ci.org/str4d/txi2p
:alt: travis
.. image:: https://coveralls.io/repos/github/str4d/txi2p/badge.svg?branch=master
:target: https://coveralls.io/github/str4d/txi2p?branch=master
:alt: coveralls
|txi2p| is a set of I2P bindings for `Twisted <https://twistedmatrix.com/>`_
10.1 or greater. It currently requires Python 2.
|txi2p| will run on Python 3.3+ (requiring `Twisted`_ 15.4 or greater).
|txi2p| supports both the SAM and BOB APIs for I2P. The default API is SAM.
Installation
============
You can install |txi2p| from PyPI::
$ pip install txi2p-tahoe
or by downloading the source and running::
$ pip install .
inside the source directory.
Quickstart
==========
If you are not familiar with using endpoints or endpoint strings, read the
`Twisted endpoints`_ documentation.
.. _Twisted endpoints: https://twistedmatrix.com/documents/current/core/howto/endpoints.html
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``.
* ``options=keyOne\:valueOne,keyTwo\:valueTwo`` - I2CP options as a
comma-separated key:value list. See the `I2CP specification` for available
options.
.. _I2CP specification: https://geti2p.net/en/docs/protocol/i2cp
Clients
-------
Client string format::
i2p:<host>[:port][:key=value]*
Supported arguments:
**SAM**
* ``nickname``
* ``autoClose``
* ``keyfile``
* ``localPort``
* ``sigType``
**BOB**
* ``tunnelNick``
* ``inhost``
* ``inport``
Servers
-------
Server string format::
i2p:<keyfile>[:port][:key=value]*
Supported arguments:
**SAM**
* ``nickname``
* ``autoClose``
* ``sigType``
**BOB**
* ``tunnelNick``
* ``outhost``
* ``outport``
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
.. |txi2p| replace:: ``txi2p``
.. |clientFromString| replace:: ``clientFromString()``
.. |serverFromString| replace:: ``serverFromString()``
|