{"id":17676366,"url":"https://github.com/stylet/mytunnel-server","last_synced_at":"2025-05-12T21:25:41.662Z","repository":{"id":53564847,"uuid":"340351014","full_name":"StyleT/mytunnel-server","owner":"StyleT","description":"Expose localhost to the world","archived":false,"fork":false,"pushed_at":"2021-04-11T00:42:13.000Z","size":508,"stargazers_count":18,"open_issues_count":2,"forks_count":18,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-20T17:40:51.644Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/StyleT.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-02-19T11:37:53.000Z","updated_at":"2024-09-06T00:50:38.000Z","dependencies_parsed_at":"2022-09-11T13:22:41.591Z","dependency_job_id":null,"html_url":"https://github.com/StyleT/mytunnel-server","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StyleT%2Fmytunnel-server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StyleT%2Fmytunnel-server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StyleT%2Fmytunnel-server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StyleT%2Fmytunnel-server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/StyleT","download_url":"https://codeload.github.com/StyleT/mytunnel-server/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253824232,"owners_count":21969983,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":[],"created_at":"2024-10-24T07:25:23.026Z","updated_at":"2025-05-12T21:25:41.616Z","avatar_url":"https://github.com/StyleT.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# mytunnel-server\n\nmytunnel exposes your localhost to the world for easy testing and sharing! No need to mess with DNS or deploy just to have others test out your changes.\n\nThis repo is the server component. If you are just looking for the CLI mytunnel app, see (https://github.com/StyleT/mytunnel).\n\n## Overview\n\nYou can easily set up and run your own server. In order to run your own mytunnel server you must ensure that your server can meet the following requirements:\n\n* You can set up DNS entries for your `domain.tld` and `*.domain.tld` (or `sub.domain.tld` and `*.sub.domain.tld`).\n* The server can accept incoming TCP connections for any non-root TCP port (i.e. ports over 1000).\n\nThe above are important as the client will ask the server for a subdomain under a particular domain. The server will listen on any OS-assigned TCP port for client connections.\n\n## Setup\n\n```shell\n# pick a place where the files will live\ngit clone git://github.com/StyleT/mytunnel-server.git\ncd mytunnel-server\nnpm install\n\n# server set to run on port 1234\nbin/server.js --port 1234\n```\n\nThe mytunnel server is now running and waiting for client requests on port 1234. You will most likely want to set up a reverse proxy to listen on port 80 (or start mytunnel on port 80 directly).\n\n**NOTE** By default, mytunnel will use subdomains for clients, if you plan to host your mytunnel server itself on a subdomain you will need to use the _--domain_ option and specify the domain name behind which you are hosting mytunnel. (i.e. my-tunnel-server.example.com)\n\n### Systemd config\n\nSample systemd config file:\n```\n[Unit]\nDescription=MyTunnel service\nAfter=network.target\nStartLimitIntervalSec=0\n\n[Service]\nType=simple\nRestart=always\nRestartSec=1\nUser=ec2-user\nEnvironment=DEBUG=*\nExecStart=/usr/bin/node /home/ec2-user/codebase/bin/server.js --port 80 --domain tunnel.example.com\n\n[Install]\nWantedBy=multi-user.target\n```\n\nSetup flow:\n```bash\nsudo setcap CAP_NET_BIND_SERVICE=+eip /usr/bin/node # allow non root access to bind below port number 1024\nsudo vi /etc/systemd/system/mytunnel.service\nsudo systemctl start mytunnel\nsudo systemctl enable mytunnel # Add to autoload\njournalctl -f -u mytunnel # See logs\n```\n\n## Use your server\n\nYou can now use your domain with the `--host` flag for the `lt` client.\n\n```shell\nnpx mytunnel --host http://tunnel.example.com --port 9000\n```\n\nYou will be assigned a URL similar to `http://heavy-puma-9.tunnel.example.com`.\n\nIf your server is acting as a reverse proxy (i.e. nginx) and is able to listen on port 80, then you do not need the `:1234` part of the hostname for the `lt` client.\n\n## REST API\n\n### POST /api/tunnels\n\nCreate a new tunnel. A MyTunnel client posts to this enpoint to request a new tunnel with a specific name or a randomly assigned name.\n\n### GET /api/status\n\nGeneral server information.\n\n## Deploy\n\nYou can deploy your own mytunnel server using the prebuilt docker image.\n\n**Note** This assumes that you have a proxy in front of the server to handle the http(s) requests and forward them to the mytunnel server on port 3000. You can use our [localtunnel-nginx](https://github.com/localtunnel/nginx) to accomplish this.\n\nIf you do not want ssl support for your own tunnel (not recommended), then you can just run the below with `--port 80` instead.\n\n```\ndocker run -d \\\n    --restart always \\\n    --name mytunnel \\\n    --net host \\\n    defunctzombie/localtunnel-server:latest --port 3000\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstylet%2Fmytunnel-server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstylet%2Fmytunnel-server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstylet%2Fmytunnel-server/lists"}