Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pinnaculum/ipfs-gwx
Async HTTP/HTTPS proxy for IPFS
https://github.com/pinnaculum/ipfs-gwx
gateway gateway-service ipfs
Last synced: 14 days ago
JSON representation
Async HTTP/HTTPS proxy for IPFS
- Host: GitHub
- URL: https://github.com/pinnaculum/ipfs-gwx
- Owner: pinnaculum
- License: gpl-3.0
- Created: 2019-12-22T11:53:24.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2019-12-22T11:59:21.000Z (almost 5 years ago)
- Last Synced: 2024-10-23T03:11:33.861Z (22 days ago)
- Topics: gateway, gateway-service, ipfs
- Language: Python
- Homepage:
- Size: 84 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.rst
- License: LICENSE
Awesome Lists containing this project
README
========
ipfs-gwx
========Simple IPFS <=> HTTP gw with virtual hosts support to serve content locally to
your network.It uses Python 3.5 and is built around the aiohttp_ asynchronous HTTP framework.
Installation
============PIP
---Assuming you have Python 3.5 installed:
.. code-block:: shell
pip install -r requirements.txt
python setup.py installDocker
------A Dockerfile is provided. By default the container assumes you have a
**go-ipfs** container reachable via the hostname **ipfs**, so just run a
**ipfs/go-ipfs** container, then fire the **ipfs-gwx** container and link them:.. code-block:: shell
docker pull ipfs/go-ipfs:latest
docker build -t ipfs-gwx .
docker run --name ipfs1 ipfs/go-ipfs
docker run -it --link ipfs1:ipfs ipfs-gwxUsage
=====.. code-block:: shell
ipfs-gwx --config ipfs-gwx.conf
Use **-d** to enable debug.
IPFS daemon configuration
-------------------------By default it will connect to **localhost**, port **5001**.
Use **--ipfsapihost** and **--ipfsapiport** to specify which IPFS daemon to
connect to, e.g:.. code-block:: shell
ipfs-gwx --config ipfs-gwx.conf --ipfsapihost 192.168.1.1 --ipfsapiport 5004
Configuration
=============Configuration is done via a simple JSON file, look in the **examples**
directory for simple examples. A configuration for relaying
**/ipns/ipfs.io** on port 80 would be:.. code-block:: json
{
"ipnscachepath": "/tmp/ipfsgwx-cache.json",
"listen": {
"0.0.0.0:80": {
"proto": "http"
}
},
"vhosts": {
".*": {
"ipns": "ipfs.io"
}
}
}HTTPS is supported:
.. code-block:: json
"listen": {
"0.0.0.0:443": {
"proto": "https",
"certificate": "/path/to/cert.pem",
"key": "/path/to/cert.key"
}
}Virtual hosts
-------------Virtual hosts support proxying from the IPNS or IPFS namespace. Define your
virtual hosts in the **vhosts** section. The virtual host key is a Python
regular expression that is matched against the HTTP **Host:** header. You can
use a **get-all** wildcard but always put it last:.. code-block:: json
"vhosts": {
"my-website.example.com": {
"ipns": "mykey"
},
".*": {
// default vhost if no match
}
}Proxying IPFS hashes
^^^^^^^^^^^^^^^^^^^^To serve **/ipfs/QmYNQJoKGNHTpPxCBPh9KkDpaExgd2duMa3aF6ytMpHdao** on
**localhost** for example, use:.. code-block:: json
"vhosts": {
"localhost": {
"ipfs": "/ipfs/QmYNQJoKGNHTpPxCBPh9KkDpaExgd2duMa3aF6ytMpHdao"
}
}or without the **/ipfs** prefix:
.. code-block:: json
"vhosts": {
"localhost": {
"ipfs": "QmYNQJoKGNHTpPxCBPh9KkDpaExgd2duMa3aF6ytMpHdao"
}
}Proxying IPNS hashes/names
^^^^^^^^^^^^^^^^^^^^^^^^^^The default TTL for entries in the IPNS cache is **10 minutes** but you should
always override it using the **cachettl** (time in seconds) key in the virtual
host config:.. code-block:: json
"vhosts": {
"localhost": {
"ipns": "ipfs.io",
"cachettl": "3600"
}
}Features
========- Virtual hosts
- Configurable IPNS cache when needed
- HTTPS and IPv6 support
- Directory listing (similar to go-ipfs_'s gateway, thanks to dir-index-html_).. _dir-index-html: https://github.com/ipfs/dir-index-html
.. _go-ipfs: https://github.com/ipfs/go-ipfsRequirements
============- Python >= 3.5
- aioipfs_
- aiohttp_.. _aiohttp: https://pypi.python.org/pypi/aiohttp
.. _aioipfs: https://gitlab.com/cipres/aioipfsThanks
======Many thanks to the IPFS community for this great project.
License
=======**ipfs-gwx** is offered under the GNU GPL3 license.