# WEb3Pi Tunnel
PoC Python implementation of a basic TCP tunnel. Primary purpose: provide a public IP to clients behind NATs.
It was initially developed alongside the [Web3Pi Proxy](https://github.com/Web3-Pi/web3-reverse-proxy).
There are two parts of the tunnel: the server which accepts connections from external users and forwards
to the client, and the client which forwards connections further to a target service.
## Configure and Run
### Setup
Simply install `web3pi-tunnel` package using your Python package manager, using **pip** for example:
```bash
pip install web3pi-tunnel
```
### Configuration
Create the `.env` file or set the system environments with the following entries.
#### Server
- `SERVICE_PUBLIC_IP` - the network address of the tunnel server
- `SERVICE_PUBLIC_LISTEN_PORT` - the port of tunnel server for external web3 users
- `TUNNEL_ESTABLISH_PORT` - the port of the tunnel server for the tunnel client
- `PROXY_ESTABLISH_PORT` - the port of the tunnel server for stats
- `TUNNEL_SERVICE_AUTH_KEY` - the api key to authenticate the tunnel client, any random character string
- `USE_UPNP` - should the tunnel server use UPnP for the service, default value is `False`, may be set to `True`, optional
The example of the `.env` file
```text
SERVICE_PUBLIC_IP=127.0.0.1
SERVICE_PUBLIC_LISTEN_PORT=6512
TUNNEL_ESTABLISH_PORT=7634
PROXY_ESTABLISH_PORT=7835
TUNNEL_SERVICE_AUTH_KEY=aaa
```
#### Client
- `TUNNEL_SERVICE_HOST` - the network address of the tunnel server
- `CLIENT_SERVICE_HOST` - the network address of the client target service
- `CLIENT_SERVICE_PORT` - the port of the client target service
- `TUNNEL_ESTABLISH_PORT` - the port of the tunnel server
- `TUNNEL_SERVICE_AUTH_KEY` - the api key to authenticate the tunnel client, any random character string
The example of the `.env` file
```text
TUNNEL_SERVICE_HOST=127.0.0.1
CLIENT_SERVICE_HOST=127.0.0.1
CLIENT_SERVICE_PORT=8545
TUNNEL_ESTABLISH_PORT=7634
TUNNEL_SERVICE_AUTH_KEY=aaa
```
### Run
#### Server
Execute the command
```bash
web3pi_tunnel_server
```
#### Client
Execute the command
```bash
web3pi_tunnel_client
```
Raw data
{
"_id": null,
"home_page": "https://github.com/Web3-Pi/basic-tcp-tunnel",
"name": "web3pi-tunnel",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.10",
"maintainer_email": null,
"keywords": "web3pi, web3, tcp, tunnel, ethereum, proxy",
"author": null,
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/7e/9b/86e604c2f09479e9d10e0c04f0f35722fb1284d05ebc46cd71e5f9085bc5/web3pi_tunnel-0.1.tar.gz",
"platform": null,
"description": "# WEb3Pi Tunnel\n\nPoC Python implementation of a basic TCP tunnel. Primary purpose: provide a public IP to clients behind NATs.\n\nIt was initially developed alongside the [Web3Pi Proxy](https://github.com/Web3-Pi/web3-reverse-proxy).\nThere are two parts of the tunnel: the server which accepts connections from external users and forwards\nto the client, and the client which forwards connections further to a target service.\n\n## Configure and Run\n\n### Setup\n\nSimply install `web3pi-tunnel` package using your Python package manager, using **pip** for example:\n\n```bash\npip install web3pi-tunnel\n```\n\n### Configuration\n\nCreate the `.env` file or set the system environments with the following entries.\n\n#### Server\n\n- `SERVICE_PUBLIC_IP` - the network address of the tunnel server\n- `SERVICE_PUBLIC_LISTEN_PORT` - the port of tunnel server for external web3 users\n- `TUNNEL_ESTABLISH_PORT` - the port of the tunnel server for the tunnel client\n- `PROXY_ESTABLISH_PORT` - the port of the tunnel server for stats\n- `TUNNEL_SERVICE_AUTH_KEY` - the api key to authenticate the tunnel client, any random character string\n- `USE_UPNP` - should the tunnel server use UPnP for the service, default value is `False`, may be set to `True`, optional\n\nThe example of the `.env` file\n\n```text\nSERVICE_PUBLIC_IP=127.0.0.1\nSERVICE_PUBLIC_LISTEN_PORT=6512\nTUNNEL_ESTABLISH_PORT=7634\nPROXY_ESTABLISH_PORT=7835\nTUNNEL_SERVICE_AUTH_KEY=aaa\n```\n\n#### Client\n\n- `TUNNEL_SERVICE_HOST` - the network address of the tunnel server\n- `CLIENT_SERVICE_HOST` - the network address of the client target service\n- `CLIENT_SERVICE_PORT` - the port of the client target service\n- `TUNNEL_ESTABLISH_PORT` - the port of the tunnel server\n- `TUNNEL_SERVICE_AUTH_KEY` - the api key to authenticate the tunnel client, any random character string\n\nThe example of the `.env` file\n\n```text\nTUNNEL_SERVICE_HOST=127.0.0.1\nCLIENT_SERVICE_HOST=127.0.0.1\nCLIENT_SERVICE_PORT=8545\nTUNNEL_ESTABLISH_PORT=7634\nTUNNEL_SERVICE_AUTH_KEY=aaa\n```\n\n### Run\n\n#### Server\n\nExecute the command\n\n```bash\nweb3pi_tunnel_server\n```\n\n#### Client\n\nExecute the command\n\n```bash\nweb3pi_tunnel_client\n```\n",
"bugtrack_url": null,
"license": "GNU GENERAL PUBLIC LICENSE Version 3",
"summary": "Web3 Pi tunnel - a basic tcp reverse tunnel",
"version": "0.1",
"project_urls": {
"Homepage": "https://github.com/Web3-Pi/basic-tcp-tunnel",
"Repository": "https://github.com/Web3-Pi/basic-tcp-tunnel"
},
"split_keywords": [
"web3pi",
" web3",
" tcp",
" tunnel",
" ethereum",
" proxy"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "c242576701e9130d81128e7c273e3c441d3ed837e5ccd5c6338318319da89a31",
"md5": "9ac162f0a5dad44b66467d9498faa45d",
"sha256": "35e51804d8afabc98a64b322173a586f0cf471d3e980326235636e72b2128b7f"
},
"downloads": -1,
"filename": "web3pi_tunnel-0.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "9ac162f0a5dad44b66467d9498faa45d",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.10",
"size": 29332,
"upload_time": "2024-07-29T14:01:51",
"upload_time_iso_8601": "2024-07-29T14:01:51.182401Z",
"url": "https://files.pythonhosted.org/packages/c2/42/576701e9130d81128e7c273e3c441d3ed837e5ccd5c6338318319da89a31/web3pi_tunnel-0.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "7e9b86e604c2f09479e9d10e0c04f0f35722fb1284d05ebc46cd71e5f9085bc5",
"md5": "b4f820a7be25d148f901c2fbc9f2b328",
"sha256": "d4884dd1b107c1c6bb3eacf5f10bd024153faf44593ad48bd30414d255b1b41b"
},
"downloads": -1,
"filename": "web3pi_tunnel-0.1.tar.gz",
"has_sig": false,
"md5_digest": "b4f820a7be25d148f901c2fbc9f2b328",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.10",
"size": 22199,
"upload_time": "2024-07-29T14:01:52",
"upload_time_iso_8601": "2024-07-29T14:01:52.445180Z",
"url": "https://files.pythonhosted.org/packages/7e/9b/86e604c2f09479e9d10e0c04f0f35722fb1284d05ebc46cd71e5f9085bc5/web3pi_tunnel-0.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-07-29 14:01:52",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "Web3-Pi",
"github_project": "basic-tcp-tunnel",
"github_not_found": true,
"lcname": "web3pi-tunnel"
}