ComparisonsSelf-Hosting

rustunnel vs ngrok — Pricing, Architecture, and Why We Built an Alternative

A side-by-side comparison of tunneling services: pricing models, self-hosting, architecture, and performance. Includes a billing infographic and a technical diagram of how rustunnel works under the hood.

João Henrique··12 min read

ngrok has been the default tool for exposing local servers to the internet for over a decade. If you've ever tested a Stripe webhook, debugged an OAuth flow, or shared a work-in-progress with a client, you've probably used it.

But the tunneling space has changed. Pricing structures feel increasingly misaligned with how developers actually work. Vendor lock-in is a growing concern. And the demand for self-hosted, open-source alternatives has never been higher.

That's why we built rustunnel. Here's how the two compare — not just on features, but on the economics and architecture behind them.

Pricing: Flat Fee vs Pay-as-you-go

The biggest difference isn't a feature — it's the billing model.

ngrok charges a fixed monthly fee per plan tier. You pay the same amount whether your tunnels are actively proxying traffic or sitting idle over the weekend. rustunnel meters the only thing that has a real infrastructure cost: bandwidth.

BILLING COMPARISONPay for timeor pay for what you useNGROKFixed Monthly PlansLaptop closed? Still $8–25/mo.Weekend off? Still $8–25/mo.Tunnel idle? Still $8–25/mo.Actual usage ~12%88% wasted$8–25/month, always+$10 for custom domains+Enterprise for self-hostingRUSTUNNELPay Only for UsageLaptop closed? $0Weekend off? $0Tunnel idle? $0Value per dollar100%$3min/mo + $0.10/GBMinimum credited to usage — not a feeSave up to 70% for light users

The math is straightforward. With ngrok's $8/month Personal plan, you're paying $96/year regardless of how much you actually use the tunnels. With rustunnel, a developer who proxies 20 GB in a month pays $3 — because 20 GB falls within the 30 GB floor. Proxy 50 GB, and the bill is $5.

max($3, actual_usage × $0.10) — that's the entire pricing formula. No per-request charges, no per-tunnel fees, no games.

Feature Comparison

rustunnelngrok
Pricing$0 / $3+pay-as-you-go / Free self-host$0 (limited) / $8 / $20 / $35+
Billing modelMetered bandwidthFlat monthly per plan
Self-hostingYes, free forever (AGPL)Enterprise plan only
Open sourceYesNo
Custom subdomainsYes (PAYG & self-host)Yes ($20+/mo plans)
Custom domainsYes (self-host, your DNS)Yes ($20+/mo plans)
TLS terminationAutomatic (Let's Encrypt)Automatic
HTTP + TCP tunnelsYesYes
WebSocket supportYesYes
Spend capYesNo
Multi-regionYes (eu, us, ap)Yes
Client binary~5 MB (Rust)~25 MB (Go)

How rustunnel Works

rustunnel's architecture is intentionally simple. A lightweight client on your machine establishes a WebSocket connection to a relay server. That single multiplexed connection carries all your tunnel traffic — HTTP requests, TCP streams, WebSocket upgrades — through one persistent pipe.

HOW IT WORKSrustunnel ArchitectureSingle multiplexed WebSocket · End-to-end encrypted · Automatic TLSINTERNETHTTPS Requests*.edge.rustunnel.comTLSEDGE RELAY SERVERTLS Termination + RoutingRust · Tokio · WebSocket muxDEMUXStream ID → Tunnel Mappingeach frame tagged with tunnel_idws frameNAT / FIREWALLoutbound WebSocket (port 443)localhost:3000CONNECTION FLOW1. Client → Relay (WSS)2. Register tunnel_id3. Request arrives (HTTPS)4. Relay → Client (muxed)5. Client → localhostMULTIPLEXINGSingle TCP connectionMultiple tunnel streams~5 MB binary · ~8 MB RAMPERFORMANCERegion latency: ~12msAuto-reconnect w/ backoff

Here's what's happening at each step:

  1. Client connects — the rustunnel binary on your machine opens a WebSocket (WSS) connection to the nearest edge relay. This is a single outbound connection on port 443, so it works through NATs and firewalls without any configuration.

  2. Tunnel registration — the client sends a registration frame with a tunnel_id, the protocol (HTTP or TCP), and the local port. The relay stores this mapping.

  3. TLS termination — when a request hits https://your-subdomain.edge.rustunnel.com, the relay terminates TLS. Your local server never needs HTTPS — it can serve plain HTTP on localhost.

  4. Multiplexed proxying — the relay wraps the incoming request in a WebSocket frame tagged with the correct tunnel_id and sends it down the shared connection. The client demuxes it and forwards to localhost:PORT. The response travels back the same way.

  5. Automatic reconnect — if the connection drops, the client reconnects with exponential backoff (1s → 2s → 4s → ... → 60s max) with random jitter to prevent thundering-herd reconnections.

The key architectural decision is multiplexing. Instead of opening a new TCP connection per tunnel, rustunnel shares a single WebSocket across all tunnels. This means running 10 tunnels has the same connection overhead as running 1.

Self-Hosting: Full Control or Zero Hassle

This is where the comparison gets interesting. ngrok reserves self-hosting for their Enterprise plan, which requires contacting sales. rustunnel makes self-hosting the default — the server is open-source under AGPL, and you can deploy it on any VPS with a single command.

curl -fsSL https://install.rustunnel.dev | sh
rustunnel-server init --domain tunnel.yourdomain.com
rustunnel-server start --tls --email admin@yourdomain.com

That's it. You're running your own tunnel infrastructure with automatic Let's Encrypt TLS. No monthly bills, no usage caps, no vendor dependency.

The managed service at rustunnel.com exists for developers who don't want to manage infrastructure — same client binary, same features, pay for bandwidth. But the self-hosted path is always there, always free, always fully functional.

The practical difference: If your company requires data sovereignty (healthcare, finance, government), or you need custom branding on tunnel URLs, or you want to avoid recurring SaaS charges entirely — self-hosted rustunnel is the only option that gives you all of this without an Enterprise contract.

Performance: Rust vs Go

Both tools are built on modern compiled languages, but the runtime characteristics differ.

Metricrustunnel (Rust)ngrok (Go)
Client binary size~5 MB~25 MB
Memory usage~8 MB (idle)~30 MB (idle)
Connection setup1 TCP round-trip1 TCP round-trip
Concurrency modelTokio async (epoll/io_uring)Go goroutines
MultiplexingWebSocket streamsHTTP/2 or WebSocket

In practice, both are fast enough for development tunneling. The difference shows up at scale — rustunnel's lower memory footprint means you can run more tunnels per relay server, and Rust's zero-cost abstractions mean there's less GC pressure under sustained load.

When to Stick with ngrok

rustunnel isn't the right choice for everyone. If you're a solo developer who occasionally needs a quick tunnel for an hour and doesn't want to think about infrastructure, ngrok's free tier or $8 Personal plan is convenient. The managed experience is polished — no server setup, no DNS configuration, no monitoring to worry about.

But if any of these apply to you, rustunnel is worth a serious look:

  • You're paying $20+/month for tunnel features you don't always use
  • You need self-hosting for compliance or data sovereignty
  • You want predictable, usage-based billing instead of flat fees
  • You're running tunnels in CI/CD pipelines where costs can spike unpredictably
  • You want the option to self-host without losing access to a managed service

Getting Started

Install rustunnel and create your first tunnel in under a minute:

brew tap joaoh82/rustunnel
brew install rustunnel
rustunnel setup
rustunnel http 3000

The Hobby plan is free (2 tunnels, random subdomains). The pay-as-you-go plan starts at $3/month. Or deploy the self-hosted server on your own infrastructure — it's free forever.

# Self-host on any VPS
curl -fsSL https://install.rustunnel.dev | sh
rustunnel-server init --domain tunnel.yourdomain.com
rustunnel-server start --tls --email admin@yourdomain.com

Check out the documentation for the full setup guide, or explore the source code on GitHub.