Skip to main content

InterPlanetary Tunnel Toolkit

Project description

InterPlanetary Tunnel Toolkit

https://gitlab.com/galacteek/iptt/iptt/-/raw/master/media/img/iptt-256.png

Provides tools to communicate with existing network protocols over IPFS tunnels (libp2p streams).

  • iphttp: Command-line iphttp client (supports SSL)

  • iphttpd: iphttp server (can serve aiohttp apps or just forward to an existing HTTP service)

pip install -U iptt

Checkout the documentation here.

iphttp

iphttp is the command-line client. To make a simple GET request, pass the PeerId with the HTTP path. Use –ssl (or -s) to use SSL encryption:

iphttp QmQPeNsJPyVWPFDVHb77w8G42Fvo15z4bG2X8D2GhfbSXc/doc.txt

iphttp -s QmQPeNsJPyVWPFDVHb77w8G42Fvo15z4bG2X8D2GhfbSXc/doc.txt

Use –maddr to pass the RPC API multiaddr of your kubo node (the default multiaddr is /ip4/127.0.0.1/tcp/5001) :

iphttp --maddr /dns4/localhost/tcp/5010 \
    QmQPeNsJPyVWPFDVHb77w8G42Fvo15z4bG2X8D2GhfbSXc/summary.html

Interactive mode: just pass a PeerId and all requests in the CLI session will be based on that peer.

iphttp -i QmQPeNsJPyVWPFDVHb77w8G42Fvo15z4bG2X8D2GhfbSXc

The following commands are supported in interactive mode:

  • get(path: str, q={}, h={}): HTTP GET request on path path with query q and HTTP headers h (dict)

  • post(path: str, q={}, data={}, h={}): HTTP POST request on path with post data data, HTTP query q (dict) and HTTP headers h (dict)

get('/')
get('/', q={'arg1': 4})
get('/', h={'X-Important-Header': 'some-value'})

post('/form', q={'arg1': 2}, data={'message': 'Form field data'})
post('/form', data={'message': 'Form field data'})

iphttpd

iphttpd allows you to register an IPFS P2P service for an already running HTTP server, and can also serve an HTTP application from a Python module (only aiohttp apps are supported right now).

Example 1

Serve http://localhost:7000 for the P2P protocol /x/ipfs-http/80/1.0

iphttpd -l localhost:80:7080

Example 2

Serve http://localhost:8080 for the P2P protocol /x/ipfs-http/8000/1.0

iphttpd -l localhost:8000:8080

Example 3

Serve an aiohttp application from Python module iphttpd_apps.helloworld:

iphttpd --serve-aiohttp iphttpd_apps.helloworld

Your module should implement the coroutine create_app(args) and return an aiohttp.web.Application instance that will be used to run the service (see the helloworld service).

Example 4

Serve an application with SSL on port 8200:

iphttpd -s --serve-aiohttp iphttpd_apps.helloworld --cert iphttpd.io.pem --key iphttpd.io-key.pem -l localhost:443:8200

Projects using iptt

License

God bless HTTP, and God bless IPFS license.

Project details


Download files

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

Source Distribution

iptt-1.0.5.tar.gz (9.5 kB view details)

Uploaded Source

Built Distribution

iptt-1.0.5-py3-none-any.whl (10.9 kB view details)

Uploaded Python 3

File details

Details for the file iptt-1.0.5.tar.gz.

File metadata

  • Download URL: iptt-1.0.5.tar.gz
  • Upload date:
  • Size: 9.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.7.3

File hashes

Hashes for iptt-1.0.5.tar.gz
Algorithm Hash digest
SHA256 a1473f9f0762a2910fb3b8f0ea329f97b7c8a180d9a1dd862b8df3af598d6b85
MD5 932e1b74730c7865e7d137c6275fd9cc
BLAKE2b-256 5380c592c4377606b2c2ecc93a905ee894c72d3aa973c50fce862a24e3d1c1eb

See more details on using hashes here.

File details

Details for the file iptt-1.0.5-py3-none-any.whl.

File metadata

  • Download URL: iptt-1.0.5-py3-none-any.whl
  • Upload date:
  • Size: 10.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.7.3

File hashes

Hashes for iptt-1.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 29b6b053f5c35c891c76843df9c30bef3c320e80f91abb361206b45c6a9803e5
MD5 7d21cf5ddbce20c8aa9bfe629f495732
BLAKE2b-256 3ca0e1b601cca75f5acf15405f011d5532c669b8e252ce4ddba7d7c1235f5064

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page