untun
Version, currently 0.1.34 versions
- 0.1.3latestSep 21, 2025
- 0.1.2not indexedSep 21, 2025
- 0.1.1not indexedSep 21, 2025
- 0.1.0not indexedSep 21, 2025
github.com/krthr/untun.cr
Tunnel your local HTTP(s) server to the world! A Crystal port of untun, powered by Cloudflare Quick Tunnels. Crystal port of https://github.com/unjs/untun
Installation
# Add this to your shard.yml
dependencies:
untun:
github: krthr/untun.cr
version: ~> 0.1.3Then run:
shards installshard.yml
- Crystal
>= 1.17.1- License
- MIT
- Author
- Wilson Tovar
- Target
untunfrom src/cli.cr
Dependencies
Runtime Dependencies
- crest*github: mamantoha/crest
README
untun
๐ Tunnel your local HTTP(s) server to the world! Powered by ๐ฅ Cloudflare Quick Tunnels.
A Crystal port of unjs/untun.
Overview
untun allows you to expose your local HTTP(s) server to the internet using Cloudflare's free Quick Tunnels service. No account required!
Installation
From Source
-
Clone the repository:
git clone https://github.com/krthr/untun cd untun -
Build the project:
shards build --release -
The binary will be available at
./bin/untun
As a Dependency
Add this to your application's shard.yml:
dependencies:
untun:
github: krthr/untun
Usage
CLI
Start a tunnel to your local server:
# Tunnel a local server running on port 3000 (default)
./bin/untun
# Tunnel a specific port
./bin/untun --port 8080
# Tunnel a specific URL
./bin/untun --url http://localhost:4000
# Tunnel with HTTPS
./bin/untun --protocol https --port 443
# Show help
./bin/untun --help
Programmatic Usage
require "untun"
# Start a tunnel with default settings
tunnel = Untun.start_tunnel
# Start a tunnel with custom settings
tunnel = Untun.start_tunnel(
port: 8080,
hostname: "localhost",
protocol: "http",
accept_cloudflare_notice: true
)
if tunnel
# Get the public URL (blocks until ready)
spawn do
url = tunnel.url.receive
puts "Tunnel ready at: #{url}"
end
# Keep the tunnel running
sleep
# Or stop it manually
tunnel.stop
end
Options
CLI Options
-u, --url URL- The URL to tunnel (overrides port/hostname/protocol)-p, --port PORT- The port to tunnel (default: 3000)--hostname HOST- The hostname to tunnel (default: localhost)--protocol PROTO- The protocol to use: http or https (default: http)-v, --version- Show version-h, --help- Show help
Environment Variables
UNTUN_ACCEPT_CLOUDFLARE_NOTICE- Set to any value to automatically accept Cloudflare's termsLOG_LEVEL- Set the log level (e.g., DEBUG, INFO, WARN, ERROR)CLOUDFLARED_VERSION- Override the cloudflared version to download
Features
- ๐ Zero Configuration - Just run and get a public URL
- ๐ Secure - All tunnels use HTTPS on the public side
- ๐ฆ Self-contained - Automatically downloads cloudflared binary if needed
- ๐ Graceful Shutdown - Handles Ctrl+C and cleanup properly
- ๐ง Flexible - Use via CLI or as a library in your Crystal application
How It Works
untun uses Cloudflare's Quick Tunnels feature through the cloudflared binary. When you start a tunnel:
- It checks if
cloudflaredis installed, and downloads it if necessary - Starts the tunnel process pointing to your local server
- Extracts and returns the public HTTPS URL
- Keeps the tunnel running until you stop it
Development
- Clone the repository
- Install dependencies:
shards install - Run tests:
crystal spec - Build for development:
shards build
Contributing
- Fork it (https://github.com/krthr/untun/fork)
- Create your feature branch (
git checkout -b my-new-feature) - Commit your changes (
git commit -am 'Add some feature') - Push to the branch (
git push origin my-new-feature) - Create a new Pull Request
Acknowledgments
This is a Crystal port of the excellent unjs/untun project. All credit for the concept goes to the original authors.
License
MIT License - see LICENSE for details.
Note: Your use of the cloudflared binary is subject to the Cloudflare Terms of Service and Privacy Policy.
Contributors
- Wilson Tovar - creator and maintainer
Documentation
Built from the current release. The first visit to a release nobody has asked for starts its build.
Links
This release
- Version
0.1.3- Tagged
- Sep 21, 2025
- Commit
4daf761d4cc1- Crystal
>= 1.17.1- Indexed
- yes
Dependents
No indexed shard depends on this one yet.
Repository
github.com/krthr/untun.cr
Metadata
- Created
- Aug 12, 2026
- Updated
- Aug 15, 2026
- Synced
- Aug 15, 2026
- Versions
- 4