{"id":13826098,"url":"https://github.com/codepr/aiotunnel","last_synced_at":"2026-01-29T12:08:09.728Z","repository":{"id":78233918,"uuid":"152994440","full_name":"codepr/aiotunnel","owner":"codepr","description":"HTTP tunnel on top of aiohttp and asyncio","archived":false,"fork":false,"pushed_at":"2020-07-07T16:13:17.000Z","size":33,"stargazers_count":32,"open_issues_count":1,"forks_count":6,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-07-08T23:39:13.925Z","etag":null,"topics":["asyncio","http","http-tunnel","https","port-forward","port-forwarding","python","tunnel"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/codepr.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGES.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2018-10-14T16:26:19.000Z","updated_at":"2025-07-03T19:02:38.000Z","dependencies_parsed_at":"2023-04-13T22:51:17.045Z","dependency_job_id":null,"html_url":"https://github.com/codepr/aiotunnel","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/codepr/aiotunnel","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codepr%2Faiotunnel","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codepr%2Faiotunnel/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codepr%2Faiotunnel/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codepr%2Faiotunnel/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/codepr","download_url":"https://codeload.github.com/codepr/aiotunnel/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codepr%2Faiotunnel/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28877127,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-29T10:31:27.438Z","status":"ssl_error","status_checked_at":"2026-01-29T10:31:01.017Z","response_time":59,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["asyncio","http","http-tunnel","https","port-forward","port-forwarding","python","tunnel"],"created_at":"2024-08-04T09:01:32.069Z","updated_at":"2026-01-29T12:08:09.676Z","avatar_url":"https://github.com/codepr.png","language":"Python","funding_links":[],"categories":["\u003ca id=\"01e6651181d405ecdcd92a452989e7e0\"\u003e\u003c/a\u003e工具"],"sub_categories":["\u003ca id=\"9d6789f22a280f5bb6491d1353b02384\"\u003e\u003c/a\u003e隧道\u0026\u0026穿透"],"readme":"Aiotunnel\n=========\n\n[![Python 3.7](https://img.shields.io/badge/python-3.7-blue.svg)](https://www.python.org/downloads/release/python-370/)\n\nYet another HTTP tunnel, supports two modes; a direct one which open a local\nport on the host machine and redirect all TCP data to the remote side of the\ntunnel, which actually connect to the desired URL. A second one which require\nthe client part to run on the target system we want to expose, the server side\non a (arguably) public machine (e.g. an AWS EC2) which expose a port to\ncommunicate to our target system through HTTP.\n\n\n## Quickstart\n\nLet's suppose we have a machine located at `10.5.0.240` that we want to expose\nSSH access and a server on which we have free access located at `10.5.0.10`; we\nreally don't know if port 22 on `10.5.0.240` is already exposed or if the IP\naddress will change, we actually don't care because once set the server\naddress, it will retrieve all incoming commands via HTTP GET requests to\nour known server.\n\n```\n    10.0.50.15 \u003c----\u003e (TCP) 8888:10.5.0.10:8080 (HTTP) \u003c----\u003e 10.5.0.240:22\n```\n\nSo just run the `tunneld` on the server at `10.5.0.10` (you probably want to\ndaemonize it through NOHUP or by creating a systemd service) in reverse mode:\n\n```sh\ndoe@10.5.0.10:~$ aiotunnel server -r\n======== Running on http://0.0.0.0:8080 ========\n(Press CTRL+C to quit)\n```\n\nOn the target machine at `10.5.0.240` run the client bound to the service we\nwant to expose (SSH in this case but could be anything):\n\n```sh\ndoe@10.5.0.240:~$ aiotunnel client --server-addr 10.5.0.10 --server-port 8080 -A localhost -P 22 -r\n[2018-10-14 22:20:45,806] Opening a connection with 127.0.0.1:22 and 0.0.0.0:8888 over HTTP\n[2018-10-14 22:20:45,831] 0.0.0.0:8888 over HTTP to http://10.5.0.10:8080/aiotunnel\n[2018-10-14 22:20:45,832] Obtained a client id: aeb7cfc6-3de3-4bc1-b769-b81641d496eb\n```\n\nNow we're ready to open an SSH session to `10.5.0.10` even in the case of a\nclosed 22 port or a different IP address.\n\n```sh\ndoe@10.5.0.15:~$ ssh doe@10.5.0.10 -p 8888\n\nWelcome to Linux 4.19.0-1-MANJARO\nLast login: Thu Feb 11 17:28:20 2016\ndoe@10.5.0.240:~$\n```\n\nA more common approach is to use the tunnel without `-r`/`--reverse` flag. In\nthis case we actually have the port 22 exposed on the target system, but our\nnetwork do not permit traffic over SSH. In this case we use a known server as a\nproxy to demand the actual SSH connection to him, while we communicate with him\nby using HTTP requests:\n\n- `POST` to establish the connection\n- `PUT` to send data\n- `GET` to read responses\n- `DELETE` to close the connection\n\nSo on our known server located at `10.5.0.10` we start a `tunneld` process\n\n```sh\ndoe@10.5.0.10:~$ aiotunnel server\n======== Running on http://0.0.0.0:8080 ========\n(Press CTRL+C to quit)\n```\n\nOn the network-constrainted machine we start a `tunnel` instance\n\n```sh\ndoe@10.5.0.5:~$ aiotunnel -A 10.0.5.240 -P 22\n[2018-10-15 00:58:41,744] Opening local port 8888 and 10.0.5.240:22 over HTTP\n```\nAnd we're good to go.\n\nIt's possible to use the `Dockerfile` to build an image and run it in a container, default start\nwith a command `aiotunnel server -r`, easily overridable.\n\n```sh\ndoe@10.5.0.240:~$ docker build -t aiotunnel /path/to/aiotunnel\ndoe@10.5.0.240:~$ docker run --rm --network host aiotunnel aiotunnel client --server-addr 10.5.0.10 --server-port 8080 -A localhost -p 22 -r\n```\n\n### Security\n\n`SSL/TLS` is supported, just set certificates cain and ca in the configuration or by the CLI process\nto encrypt the communication and use HTTPS (defaulting on port 8443 instead of 8080)\n\n```sh\ndoe@10.5.0.10:~$ aiotunnel server -r --ca /path/to/ca.crt --cert /path/to/cert.crt --key\n/path/to/keyfile.key\n======== Running on https://0.0.0.0:8443 ========\n```\n\nAnd client side\n\n```sh\ndoe@10.5.0.240:~$ aiotunnel client -A 127.0.0.1 -P 22 --ca /path/to/ca.crt --cert\n/path/to/cert.crt --key /path/to/keyfile.key\n[2018-10-18 22:20:45,806] Opening a connection with 127.0.0.1:22 and 0.0.0.0:8888 over HTTPS\n[2018-10-18 22:20:45,831] 0.0.0.0:8888 over HTTPS to https://10.5.0.10:8443/aiotunnel\n[2018-10-18 22:20:45,832] Obtained a client id: aeb7dfc4-3da3-4wc1-b769-n81621db96eb\n```\n\n## Installation\n\nClone the repository and install it locally or play with it using `python -i` or `ipython`.\n\n```\n$ git clone https://github.com/codepr/aiotunnel.git\n$ cd aiotunnel\n$ pip install .\n```\n\nor, to skip cloning part\n\n```\n$ pip install git+https://github.com/codepr/aiotunnel.git@master#egg=aiotunnel\n```\n\n## Changelog\n\nSee the [CHANGES](CHANGES.md) file.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodepr%2Faiotunnel","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodepr%2Faiotunnel","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodepr%2Faiotunnel/lists"}