MCPcopy Index your code
hub / github.com/agrinman/tunnelto

github.com/agrinman/tunnelto @0.1.18

Chat with this repo
repository ↗ · DeepWiki ↗ · release 0.1.18 ↗ · + Follow
142 symbols 268 edges 24 files 10 documented · 7%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

BuildRelease crate GitHub Docker Registry crate

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
  2. Usage Instructions
  3. Host it yourself

Install

Brew (macOS)

brew install agrinman/tap/tunnelto

Cargo

cargo install tunnelto

Everywhere

Or Download a release for your target OS here: 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.14

USAGE:
    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 times

OPTIONS:
        --dashboard-address <dashboard-address>    Sets the address of the local introspection dashboard
    -k, --key <key>                                Sets an API authentication key to use for this tunnel
        --host <local-host>
            Sets the HOST (i.e. localhost) to forward incoming tunnel traffic to [default: localhost]

    -p, --port <port>
            Sets the port to forward incoming tunnel traffic to on the target host

        --scheme <scheme>
            Sets the SCHEME (i.e. http or https) to forward incoming tunnel traffic to [default: http]

    -s, --subdomain <sub-domain>                   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" `` Seetunnelto_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 is a proper distributed system running on the the fabulous fly.io service. In short, fly.io makes this super easy with their Private Networking feature. See tunnelto_server/src/network/mod.rs for the implementation details of our gossip mechanism.

Extension points exported contracts — how you extend this code

Core symbols most depended-on inside this repo

Shape

Function 49
Method 47
Class 32
Enum 13
Interface 1

Languages

Rust100%

Modules by API surface

tunnelto/src/introspect/mod.rs21 symbols
tunnelto_lib/src/lib.rs19 symbols
tunnelto_server/src/auth/mod.rs11 symbols
tunnelto_server/src/connected_clients.rs10 symbols
tunnelto_server/src/auth/auth_db.rs8 symbols
tunnelto_server/src/remote.rs7 symbols
tunnelto_server/src/control_server.rs7 symbols
tunnelto/src/config.rs7 symbols
tunnelto/src/main.rs6 symbols
tunnelto_server/src/network/mod.rs5 symbols
tunnelto_server/src/auth/reconnect_token.rs5 symbols
tunnelto_server/src/auth/client_auth.rs5 symbols

For agents

$ claude mcp add tunnelto \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page