Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/agrinman/tunnelto
Expose your local web server to the internet with a public URL.
https://github.com/agrinman/tunnelto
async-io expose localhost rust tunnel
Last synced: 20 days ago
JSON representation
Expose your local web server to the internet with a public URL.
- Host: GitHub
- URL: https://github.com/agrinman/tunnelto
- Owner: agrinman
- License: mit
- Created: 2020-03-22T05:39:49.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2022-09-24T21:28:44.000Z (about 2 years ago)
- Last Synced: 2024-10-06T23:45:19.830Z (28 days ago)
- Topics: async-io, expose, localhost, rust, tunnel
- Language: Rust
- Homepage: https://tunnelto.dev
- Size: 298 KB
- Stars: 2,098
- Watchers: 29
- Forks: 113
- Open Issues: 47
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-starred-test - agrinman/tunnelto - Expose your local web server to the internet with a public URL. (Rust)
- awesome-repositories - agrinman/tunnelto - Expose your local web server to the internet with a public URL. (Rust)
- awesome-list - tunnelto
- awesome-starred - agrinman/tunnelto - Expose your local web server to the internet with a public URL. (rust)
README
# `tunnelto`
`tunnelto` lets you expose your locally running web server via a public URL.
Written in Rust. Built completely with async-io on top of tokio.1. [Install](#install)
2. [Usage Instructions](#usage)
3. [Host it yourself](#host-it-yourself)# Install
## Brew (macOS)
```bash
brew install agrinman/tap/tunnelto
```## Cargo
```bash
cargo install tunnelto
```## Everywhere
Or **Download a release for your target OS here**: [tunnelto/releases](https://github.com/agrinman/tunnelto/releases)# Usage
## Quick Start
```shell script
tunnelto --port 8000
```
The above command opens a tunnel and forwards traffic to `localhost:8000`.## More Options:
```shell script
tunnelto 0.1.14USAGE:
tunnelto [FLAGS] [OPTIONS] [SUBCOMMAND]FLAGS:
-h, --help Prints help information
-V, --version Prints version information
-v, --verbose A level of verbosity, and can be used multiple timesOPTIONS:
--dashboard-address Sets the address of the local introspection dashboard
-k, --key Sets an API authentication key to use for this tunnel
--host
Sets the HOST (i.e. localhost) to forward incoming tunnel traffic to [default: localhost]-p, --port
Sets the port to forward incoming tunnel traffic to on the target host--scheme
Sets the SCHEME (i.e. http or https) to forward incoming tunnel traffic to [default: http]-s, --subdomain Specify a sub-domain for this tunnel
SUBCOMMANDS:
help Prints this message or the help of the given subcommand(s)
set-auth Store the API Authentication key
```# Host it yourself
1. Compile the server for the musl target. See the `musl_build.sh` for a way to do this trivially with Docker!
2. See `Dockerfile` for a simple alpine based image that runs that server binary.
3. Deploy the image where ever you want.## Testing Locally
```shell script
# Run the Server: xpects TCP traffic on 8080 and control websockets on 5000
ALLOWED_HOSTS="localhost" cargo run --bin tunnelto_server# Run a local tunnelto client talking to your local tunnelto_server
CTRL_HOST="localhost" CTRL_PORT=5000 CTRL_TLS_OFF=1 cargo run --bin tunnelto -- -p 8000# Test it out!
# Remember 8080 is our local tunnelto TCP server
curl -H '.localhost' "http://localhost:8080/some_path?with=somequery"
```
See `tunnelto_server/src/config.rs` for the environment variables for configuration.## Caveats for hosting it yourself
The implementation does not support multiple running servers (i.e. centralized coordination).
Therefore, if you deploy multiple instances of the server, it will only work if the client connects to the same instance
as the remote TCP stream.The [version hosted by us](https://tunnelto.dev) is a proper distributed system running on the the fabulous [fly.io](https://fly.io) service.
In short, fly.io makes this super easy with their [Private Networking](https://fly.io/docs/reference/privatenetwork/) feature.
See `tunnelto_server/src/network/mod.rs` for the implementation details of our gossip mechanism.