DEV Community

Diyarbek
Diyarbek

Posted on

I built Tunn - a tunneling tool in Rust (ngrok alternative)

Hey r/rust! I've been working on Tunn, a tunneling tool that exposes your localhost to the internet. Think ngrok, but built in Rust on top of QUIC.

Why I built it:
I was using ngrok for webhook testing and got frustrated with the latency and session time limits. TCP-based tunneling felt like it could be better, so I decided to try QUIC (using quinn).

Results:
Benchmarked against ngrok with 500 requests (keep-alive, 10 concurrent):

  • Tunn: 135ms avg, 65.9 req/s
  • ngrok: 663ms avg, 15.0 req/s

QUIC multiplexing makes a big difference β€” one connection handles all requests, no per-request TLS handshakes.

Features:

  • HTTP, TCP, and UDP tunneling
  • Built-in web request inspector (localhost:4040)
  • QR code in terminal for quick mobile access
  • 0-RTT reconnect on network changes
  • Single binary, no dependencies

Tech stack:

  • quinn for QUIC transport
  • axum for the inspector web server
  • clap for CLI
  • tokio for async runtime
  • rustls (no native-tls, for easy cross-compilation)

GitHub: https://github.com/Diyarbekoralbaev/tunn

Install:

curl -s https://tunn.uz/install | bash
tunn http 3000
Enter fullscreen mode Exit fullscreen mode

Would love feedback on the architecture and any rough edges you find. The QUIC implementation was the most interesting part to build β€” happy to discuss the details.

Top comments (0)