opentunnel-cli
v1.0.25
Published
Self-hosted tunnel solution to expose local ports to the internet via custom domains, ngrok, or Cloudflare Tunnel
Maintainers
Readme
Quick Start
Installation
npm install -g opentunnel-cliAs a Client
Connect to an existing OpenTunnel server:
# Quick tunnel
opentunnel quick 3000 -s example.com
# With authentication
opentunnel quick 3000 -s example.com -t YOUR_TOKEN
# Custom subdomain
opentunnel quick 3000 -s example.com -n myapp
# → https://myapp.op.example.comAs a Server
Host your own tunnel server:
# Public server
opentunnel server -d --domain example.com --letsencrypt --email [email protected]
# Private server (with auth)
opentunnel server -d --domain example.com --letsencrypt --email [email protected] --auth-tokens "SECRET"DNS Setup: Point op.example.com and *.op.example.com to your server IP.
Home Use (Hybrid Mode)
Run server + tunnel in one terminal:
# Set default domain (one time)
opentunnel setdomain yourdomain.com
# Expose any port
opentunnel expl 3000Using ngrok or Cloudflare Tunnel
Don't have a server? Use third-party tunnel providers:
# With Cloudflare Tunnel (free, no account needed for quick tunnels)
opentunnel http 3000 --cloudflare
opentunnel http 3000 --cf
# With ngrok
opentunnel http 3000 --ngrok
opentunnel http 3000 --ngrok --region euAuthentication & Named Tunnels
Store credentials securely and manage Cloudflare named tunnels:
# Login to providers
opentunnel login cloudflare # Opens browser for OAuth
opentunnel login ngrok --token YOUR_TOKEN
# Create and manage named tunnels
opentunnel create my-tunnel --cf
opentunnel tunnels --cf
opentunnel route my-tunnel app.example.com
opentunnel delete my-tunnel --cf
# Use named tunnel with -n flag
opentunnel http 3000 --cf -n my-tunnel
# View stored credentials
opentunnel config listDocumentation
| Guide | Description | |-------|-------------| | Client Guide | Complete client usage and options | | Server Guide | Server deployment and configuration | | Commands Reference | All CLI commands and options | | Configuration File | opentunnel.yml reference | | Home Use Guide | Running from home with port forwarding | | Domain Setup | DNS and SSL configuration | | DuckDNS & Free DNS | Free DNS services setup | | Cloudflare Tunnel | Cloudflare Tunnel & named tunnels | | Multi-Domain | Multiple domains on one server | | Authentication | Token-based authentication | | IP Access Control | Allow/deny IP ranges (cross-provider) | | Firewall (Dymo API) | Fraud detection and bot protection |
Architecture
┌─────────────────────────────────────────────────────────────────┐
│ INTERNET │
│ Users access: https://myapp.op.example.com │
└──────────────────────────────┬──────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────────┐
│ OpenTunnel Server │
│ (op.example.com) │
│ - Routes by subdomain │
│ - Forwards via WebSocket │
└──────────────────────────────┬──────────────────────────────────┘
│ WebSocket
▼
┌─────────────────────────────────────────────────────────────────┐
│ Your Computer │
│ (behind NAT/firewall) │
│ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ │
│ │ Web App │ │ API Server │ │ Database │ │
│ │ :3000 │ │ :4000 │ │ :5432 │ │
│ └──────────────┘ └──────────────┘ └──────────────┘ │
└─────────────────────────────────────────────────────────────────┘License
Proprietary License - All rights reserved.
- ✅ Personal, educational, and commercial use allowed
- ❌ No forks or redistribution without permission
- ❌ No reselling without explicit consent
Contact FJRG2007 for licensing questions.
