Convert Figma logo to code with AI

agrinman logotunnelto

Expose your local web server to the internet with a public URL.

2,091
113
2,091
47

Top Related Projects

Cloudflare Tunnel client (formerly Argo Tunnel)

expose yourself

Minimal, self-hosted, 0-config alternative to ngrok. Caddy+OpenSSH+50 lines of Python.

84,231

A fast reverse proxy to help you expose a local server behind a NAT or firewall to the internet.

24,128

Unified ingress for developers

27,614

Easily and securely send things from one computer to another :crocodile: :package:

Quick Overview

tunnelto is a command-line tool that allows you to expose your local development server to the internet, making it accessible to anyone with the provided URL. It acts as a secure reverse proxy, tunneling your local traffic through a remote server and providing a public URL for easy sharing and testing.

Pros

  • Easy Setup: tunnelto is a single binary that can be easily installed and configured, with no additional dependencies required.
  • Secure Connections: The tool uses end-to-end encryption to secure the connection between your local server and the public URL, ensuring the privacy and integrity of your data.
  • Cross-Platform Compatibility: tunnelto is available for Windows, macOS, and Linux, making it accessible to developers across different operating systems.
  • Customizable Subdomains: You can choose a custom subdomain for your public URL, making it easier to remember and share with others.

Cons

  • Reliance on Third-Party Server: The tool requires a connection to a remote server, which introduces a potential single point of failure and dependence on the service provider.
  • Limited Free Usage: The free version of tunnelto has some usage limitations, such as a maximum number of concurrent connections or a time limit for the tunnel.
  • Potential Privacy Concerns: Since the traffic is routed through a remote server, there may be privacy concerns for users who are sensitive about their data passing through a third-party service.
  • Lack of Advanced Features: Compared to some other reverse proxy tools, tunnelto may lack more advanced features, such as load balancing, custom domain mapping, or integration with other services.

Getting Started

To get started with tunnelto, follow these steps:

  1. Download the appropriate binary for your operating system from the GitHub repository.
  2. Extract the downloaded file and move the tunnelto binary to a directory in your system's PATH.
  3. Open a terminal or command prompt and run the following command to start the tunnel:
tunnelto --subdomain=your-custom-subdomain --port=8000

Replace your-custom-subdomain with the subdomain you want to use for your public URL, and 8000 with the port number of your local development server.

  1. The tool will display the public URL you can use to access your local server. Share this URL with others to allow them to access your development environment.

  2. When you're done, you can stop the tunnel by pressing Ctrl+C in the terminal.

That's it! With just a few simple steps, you can use tunnelto to expose your local development server to the internet and share it with others.

Competitor Comparisons

Cloudflare Tunnel client (formerly Argo Tunnel)

Pros of cloudflared

  • Backed by Cloudflare's robust infrastructure, offering high reliability and performance
  • Supports a wider range of protocols and services, including TCP, UDP, and HTTP/HTTPS
  • Integrates seamlessly with other Cloudflare services like Access and Workers

Cons of cloudflared

  • More complex setup and configuration process
  • Requires a Cloudflare account and domain to use
  • May have limitations on free tier usage

Code Comparison

tunnelto:

let tunnel = TunnelBuilder::new()
    .with_port(8000)
    .with_subdomain("myapp")
    .build()?;

tunnel.start().await?;

cloudflared:

tunnel: my-tunnel
credentials-file: /path/to/credentials.json
ingress:
  - hostname: example.com
    service: http://localhost:8000
  - service: http_status:404

The tunnelto example shows a simple Rust code snippet for creating and starting a tunnel, while the cloudflared example demonstrates a YAML configuration file for defining tunnel settings and ingress rules.

expose yourself

Pros of localtunnel

  • Longer history and more established project with a larger community
  • Simpler setup and usage, requiring fewer configuration steps
  • Supports custom subdomains for easier sharing and remembering URLs

Cons of localtunnel

  • Less actively maintained, with fewer recent updates
  • Limited built-in security features compared to tunnelto
  • May experience occasional stability issues with high traffic

Code Comparison

localtunnel:

const localtunnel = require('localtunnel');

(async () => {
  const tunnel = await localtunnel({ port: 3000 });
  console.log(tunnel.url);
})();

tunnelto:

use tunnelto::Tunnel;

let tunnel = Tunnel::new("https://tunnelto.dev")
    .port(3000)
    .connect()
    .await?;
println!("Tunnel URL: {}", tunnel.url());

Both projects aim to provide easy local tunneling solutions, but they differ in implementation languages and features. localtunnel offers a more straightforward JavaScript-based approach, while tunnelto provides a Rust implementation with additional security features. The choice between the two depends on specific project requirements, desired features, and preferred programming language ecosystem.

Minimal, self-hosted, 0-config alternative to ngrok. Caddy+OpenSSH+50 lines of Python.

Pros of SirTunnel

  • Simpler implementation with fewer dependencies
  • Self-hosted solution, offering more control over the infrastructure
  • Designed for personal use, potentially easier to set up for individual developers

Cons of SirTunnel

  • Less actively maintained compared to tunnelto
  • Fewer features and less robust than tunnelto
  • Limited documentation and community support

Code Comparison

SirTunnel (Python):

async def handle_client(reader, writer):
    data = await reader.read(100)
    message = data.decode()
    addr = writer.get_extra_info('peername')
    print(f"Received {message!r} from {addr!r}")

tunnelto (Rust):

async fn handle_client(mut stream: TcpStream) -> Result<(), Box<dyn Error>> {
    let mut buffer = [0; 1024];
    let bytes_read = stream.read(&mut buffer).await?;
    let request = String::from_utf8_lossy(&buffer[..bytes_read]);
    println!("Received request: {}", request);
}

Both projects aim to provide tunneling solutions, but SirTunnel focuses on simplicity and personal use, while tunnelto offers a more feature-rich and actively maintained option. The code snippets demonstrate the different languages used (Python vs. Rust) and the basic approach to handling client connections in each project.

84,231

A fast reverse proxy to help you expose a local server behind a NAT or firewall to the internet.

Pros of frp

  • More comprehensive feature set, including TCP/UDP forwarding, HTTP/HTTPS tunneling, and load balancing
  • Supports multiple protocols and custom plugins for extended functionality
  • Active development with frequent updates and a larger community

Cons of frp

  • More complex setup and configuration process
  • Requires both client and server components to be installed and configured
  • Steeper learning curve for beginners

Code Comparison

frp configuration example:

[common]
server_addr = x.x.x.x
server_port = 7000

[ssh]
type = tcp
local_ip = 127.0.0.1
local_port = 22
remote_port = 6000

tunnelto command-line usage:

tunnelto --port 8000

Summary

frp offers a more feature-rich and flexible solution for reverse proxying and tunneling, suitable for complex networking scenarios. It supports multiple protocols and custom plugins but requires more setup and configuration.

tunnelto provides a simpler, more user-friendly approach focused on quickly exposing local servers to the internet. It's easier to use for beginners but offers fewer advanced features compared to frp.

Choose frp for more advanced networking needs and greater customization options, or tunnelto for quick and easy local server exposure with minimal configuration.

24,128

Unified ingress for developers

Pros of ngrok

  • More established and widely used, with a larger community and ecosystem
  • Offers additional features like request inspection and replay
  • Supports multiple protocols beyond HTTP, including TCP and UDP

Cons of ngrok

  • Closed-source, which may limit customization and self-hosting options
  • Free tier has limitations on concurrent tunnels and connections
  • Can be more complex to set up and configure for advanced use cases

Code Comparison

ngrok:

ngrok http 8080

tunnelto:

tunnelto --port 8080

Both tools provide simple command-line interfaces for creating tunnels, but ngrok offers more advanced configuration options through its config file and command-line flags.

Key Differences

  • tunnelto is open-source, allowing for greater transparency and potential customization
  • ngrok has a more feature-rich paid tier, including team collaboration and custom domains
  • tunnelto focuses primarily on HTTP tunneling, while ngrok supports a broader range of protocols
  • ngrok provides a web interface for managing tunnels, while tunnelto is primarily command-line based

Overall, ngrok offers a more comprehensive solution with additional features and protocols, while tunnelto provides a simpler, open-source alternative focused on HTTP tunneling.

27,614

Easily and securely send things from one computer to another :crocodile: :package:

Pros of croc

  • Designed for secure file transfer between computers
  • Supports end-to-end encryption and code phrase-based authentication
  • Works across different networks and platforms (Windows, macOS, Linux)

Cons of croc

  • Limited to file transfer functionality
  • Requires installation on both sender and receiver machines
  • May have slower transfer speeds for large files compared to tunnelto

Code comparison

croc:

func main() {
    flag.Parse()
    if len(os.Args) == 1 {
        println("croc version " + Version)
        return
    }
    // ... (additional code)
}

tunnelto:

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let opt = Opt::from_args();
    let config = Config::from_opt(opt)?;
    // ... (additional code)
}

Summary

croc focuses on secure file transfer between computers, offering end-to-end encryption and cross-platform support. It requires installation on both sender and receiver machines and may have slower transfer speeds for large files.

tunnelto, on the other hand, is primarily designed for exposing local servers to the internet, providing a different set of features and use cases. The code comparison shows that croc is written in Go, while tunnelto is implemented in Rust, reflecting their different approaches and target functionalities.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

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

tunnelto --port 8000

The above command opens a tunnel and forwards traffic to localhost:8000.

More Options:

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

# 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 '<subdomain>.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 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.