扭曲的I2P绑定

txi2p的Python项目详细描述


traviscoveralls

txi2pTwisted的一组i2p绑定 10.1或更高。它目前需要python 2。

txi2p支持i2p的sam和bob api。默认api是sam。

安装

您可以从pypi安装txi2p

$ pip2 install txi2p

或者下载源并运行:

$ pip2 install .

在源目录中。

快速启动

如果您不熟悉使用端点或端点字符串,请阅读 Twisted endpoints文档。

使用端点类

连接到i2p站点:

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)

让服务器监听i2p目的地:

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)

使用端点字符串

需要Twisted14.0或更高版本。

连接到i2p站点:

from twisted.internet import reactor
from twisted.internet.endpoints import clientFromString

endpoint = clientFromString(reactor, 'i2p:stats.i2p')
d = endpoint.connect(factory)

让服务器监听i2p目的地:

from twisted.internet import reactor
from twisted.internet.endpoints import serverFromString

endpoint = serverFromString(reactor, 'i2p:/path/to/keyfile')
d = endpoint.listen(factory)

要使用特定的API进行连接:

from twisted.internet import reactor
from twisted.internet.endpoints import clientFromString

endpoint = clientFromString(reactor, 'i2p:stats.i2p:api=BOB')
d = endpoint.connect(factory)

使用非标准API主机或端口进行连接:

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)

端点字符串

clientFromString()serverFromString()的twisted插件将 仅适用于Twisted14.0或更高版本。

客户端和服务器字符串都支持以下关键字参数:

  • api=<apiName>-可以是SAMBOB
  • apiEndpoint=<endpointString>-转义的客户端终结点字符串指向 到api,例如tcp\:127.0.0.1\:2827

客户

客户端字符串格式:

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

支持的参数:

sam

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

bob

  • tunnelNick
  • inhost
  • inport
  • options

服务器

服务器字符串格式:

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

支持的参数:

sam

  • nickname
  • autoClose
  • options
  • sigType

bob

  • tunnelNick
  • outhost
  • outport
  • options

重要更改

0.3.2

  • 新目的地的默认签名类型为ed25519。
    • 如果山姆服务器不支持(JavaI2P0.916和更早),TXI2P 将返回ecdsa_sha256_p256,然后是旧的默认dsa_sha1。

0.3

  • sam api现在支持端口。
    • 以前的port选项不再被忽略。
    • 新的localPort选项,用于设置客户端的本地端口。
  • SAMI2PStreamServerEndpointapi已更改为不再需要 反应堆。

文档

api文档可在https://txi2p.readthedocs.org

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java搜索具有外键的JPA实体的约定是什么?   java事务没有使用事务和嵌套方法的2个实例回滚   SpringBootJavaMessageFormat。使用umlauts格式(ä/ö/ü)   java如何通过字符串在sqlite中搜索列   JAVAlang.ClassNotFoundException:org。冬眠Hibernate4的例外情况   java消息正文在Gmail中被弄乱了   java Apache Ignite未使用空值更新缓存   Java正则表达式未捕获组   java onBackPressed();除非我叫super否则不行。onBackPressed();两次密码   java CustomAlertDialog在删除数据库记录后未完成其进程   C++中的迭代器(Stl)与java,是否存在概念上的区别?   Java在不知道字符编码的情况下将字节[]转换为字符串   来自本地WSDL文件的java Web服务客户端   java工具可用于在一个位置聚合所有项目相关信息   java在Netbeans中的maven项目中设置依赖项