opentunnel-cli 1.0.19 → 1.0.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +142 -5
- package/dist/cli/index.js +419 -65
- package/dist/cli/index.js.map +1 -1
- package/dist/server/TunnelServer.d.ts +3 -0
- package/dist/server/TunnelServer.d.ts.map +1 -1
- package/dist/server/TunnelServer.js +186 -51
- package/dist/server/TunnelServer.js.map +1 -1
- package/dist/shared/types.d.ts +1 -0
- package/dist/shared/types.d.ts.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -15,6 +15,8 @@
|
|
|
15
15
|
- [Configuration File](#-configuration-file) - opentunnel.yml reference
|
|
16
16
|
- [Environment Variables](#environment-variables) - Docker-style ${VAR:-default} syntax
|
|
17
17
|
- [Commands Reference](#-commands-reference)
|
|
18
|
+
- [Expose Local (expl)](#expose-local-command-expl) - Fastest way to expose a port
|
|
19
|
+
- [Domain Configuration](#domain-configuration) - Set default domain
|
|
18
20
|
|
|
19
21
|
---
|
|
20
22
|
|
|
@@ -34,12 +36,31 @@ npx opentunnel-cli quick 3000 -s example.com
|
|
|
34
36
|
|
|
35
37
|
## Quick Start
|
|
36
38
|
|
|
37
|
-
### Option 1:
|
|
39
|
+
### Option 1: Expose Local (Recommended for Home Use)
|
|
38
40
|
|
|
39
|
-
The fastest way to expose a port:
|
|
41
|
+
The fastest way to expose a port with your own domain:
|
|
40
42
|
|
|
41
43
|
```bash
|
|
44
|
+
# First, set your default domain (one time only)
|
|
45
|
+
opentunnel setdomain yourdomain.com
|
|
46
|
+
|
|
47
|
+
# Then expose any port with a single command
|
|
48
|
+
opentunnel expl 3000
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
This starts a local server and exposes your port. Requires your domain to point to your machine (with port forwarding if behind NAT).
|
|
52
|
+
[Check this](#-home-use-behind-routernat) - Run from home network
|
|
53
|
+
|
|
54
|
+
### Option 2: Quick Command
|
|
55
|
+
|
|
56
|
+
Connect to an existing OpenTunnel server:
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
# Connect to a remote OpenTunnel server
|
|
42
60
|
opentunnel quick 3000 -s example.com
|
|
61
|
+
|
|
62
|
+
# Or start your own local server
|
|
63
|
+
opentunnel quick 3000 -s yourdomain.com --local-server
|
|
43
64
|
```
|
|
44
65
|
|
|
45
66
|
Your local port 3000 is now accessible from the internet:
|
|
@@ -59,9 +80,10 @@ opentunnel quick 3000 -s example.com -t SECRET # With auth token
|
|
|
59
80
|
opentunnel quick 3000 -s example.com --insecure # Self-signed cert
|
|
60
81
|
opentunnel quick 3000 -s example.com -b "" # No basePath (direct domain)
|
|
61
82
|
opentunnel quick 3000 -s yourdomain.com --local-server # Start server + tunnel in one terminal
|
|
83
|
+
#
|
|
62
84
|
```
|
|
63
85
|
|
|
64
|
-
### Option
|
|
86
|
+
### Option 3: HTTP/TCP Commands
|
|
65
87
|
|
|
66
88
|
More control with specific commands:
|
|
67
89
|
|
|
@@ -78,7 +100,7 @@ opentunnel tcp 5432 -s example.com -r 15432
|
|
|
78
100
|
opentunnel tcp 5432 --domain example.com --remote-port 15432
|
|
79
101
|
```
|
|
80
102
|
|
|
81
|
-
### Option
|
|
103
|
+
### Option 4: Using Config File
|
|
82
104
|
|
|
83
105
|
Create `opentunnel.yml`:
|
|
84
106
|
|
|
@@ -330,7 +352,14 @@ opentunnel quick 3000 -s yourdomain.duckdns.org
|
|
|
330
352
|
For the simplest setup, expose a local port while running the server:
|
|
331
353
|
|
|
332
354
|
```bash
|
|
333
|
-
#
|
|
355
|
+
# Easiest: set default domain once, then use expl
|
|
356
|
+
opentunnel setdomain yourdomain.duckdns.org
|
|
357
|
+
opentunnel expl 3000
|
|
358
|
+
|
|
359
|
+
# Or specify domain each time
|
|
360
|
+
opentunnel expl 3000 -s yourdomain.duckdns.org
|
|
361
|
+
|
|
362
|
+
# Alternative with quick command
|
|
334
363
|
opentunnel quick 3000 -s yourdomain.duckdns.org --local-server
|
|
335
364
|
|
|
336
365
|
# Or with config file
|
|
@@ -421,6 +450,47 @@ server:
|
|
|
421
450
|
basePath: op
|
|
422
451
|
```
|
|
423
452
|
|
|
453
|
+
## Domains Without Wildcard Support (DuckDNS)
|
|
454
|
+
|
|
455
|
+
Some DNS providers like **DuckDNS** don't support wildcard subdomains (`*.domain`). OpenTunnel automatically detects DuckDNS domains and uses **port-based routing** instead of subdomains.
|
|
456
|
+
|
|
457
|
+
**Auto-detection:** Domains ending in `.duckdns.org` automatically use port-based mode.
|
|
458
|
+
|
|
459
|
+
**Important:** DuckDNS domains cannot use `basePath` - it will throw an error:
|
|
460
|
+
|
|
461
|
+
```yaml
|
|
462
|
+
# ❌ WRONG - Will throw an error
|
|
463
|
+
server:
|
|
464
|
+
domains:
|
|
465
|
+
- domain: myapp.duckdns.org
|
|
466
|
+
basePath: op # Error! DuckDNS doesn't support subdomains
|
|
467
|
+
|
|
468
|
+
# ✅ CORRECT
|
|
469
|
+
server:
|
|
470
|
+
domains:
|
|
471
|
+
- domain: fjrg2007.com
|
|
472
|
+
basePath: op # Subdomain-based: *.op.fjrg2007.com
|
|
473
|
+
- domain: myapp.duckdns.org
|
|
474
|
+
# Port-based: myapp.duckdns.org:<port>
|
|
475
|
+
```
|
|
476
|
+
|
|
477
|
+
**Manual configuration:** Use `wildcard: false` for other domains without wildcard support:
|
|
478
|
+
|
|
479
|
+
```yaml
|
|
480
|
+
server:
|
|
481
|
+
domains:
|
|
482
|
+
- domain: fjrg2007.com
|
|
483
|
+
basePath: op # Subdomain-based: *.op.fjrg2007.com
|
|
484
|
+
- domain: other-no-wildcard.com
|
|
485
|
+
wildcard: false # Manual: port-based
|
|
486
|
+
```
|
|
487
|
+
|
|
488
|
+
**How it works:**
|
|
489
|
+
- **Wildcard domains:** `https://myapp.op.fjrg2007.com`
|
|
490
|
+
- **Non-wildcard domains:** `https://myapp.duckdns.org:10001`
|
|
491
|
+
|
|
492
|
+
Clients connecting to non-wildcard domains receive port-based URLs automatically.
|
|
493
|
+
|
|
424
494
|
## SSL Certificates
|
|
425
495
|
|
|
426
496
|
When using self-signed certificates with multiple domains, OpenTunnel automatically generates a **SAN (Subject Alternative Name) certificate** that covers all configured domains and their wildcards.
|
|
@@ -664,6 +734,13 @@ opentunnel up # Starts server + all tunnels
|
|
|
664
734
|
|
|
665
735
|
**Quick hybrid start (no config file):**
|
|
666
736
|
```bash
|
|
737
|
+
# Easiest way (with default domain set)
|
|
738
|
+
opentunnel expl 3000
|
|
739
|
+
|
|
740
|
+
# Or with explicit domain
|
|
741
|
+
opentunnel expl 3000 -s yourdomain.com
|
|
742
|
+
|
|
743
|
+
# Alternative
|
|
667
744
|
opentunnel quick 3000 -s yourdomain.com --local-server
|
|
668
745
|
```
|
|
669
746
|
|
|
@@ -684,6 +761,7 @@ opentunnel ps # Show running processes
|
|
|
684
761
|
|
|
685
762
|
| Command | Description |
|
|
686
763
|
|---------|-------------|
|
|
764
|
+
| `opentunnel expl <port>` | Expose local port via local server (uses default domain) |
|
|
687
765
|
| `opentunnel quick <port> -s <domain>` | Quick tunnel to a server |
|
|
688
766
|
| `opentunnel http <port>` | HTTP tunnel with options |
|
|
689
767
|
| `opentunnel tcp <port>` | TCP tunnel with options |
|
|
@@ -694,6 +772,65 @@ opentunnel ps # Show running processes
|
|
|
694
772
|
| `opentunnel stop` | Stop server |
|
|
695
773
|
| `opentunnel ps` | List running processes |
|
|
696
774
|
| `opentunnel init` | Create config file |
|
|
775
|
+
| `opentunnel setdomain <domain>` | Set default domain for expl command |
|
|
776
|
+
| `opentunnel getdomain` | Show current default domain |
|
|
777
|
+
| `opentunnel cleardomain` | Remove default domain configuration |
|
|
778
|
+
|
|
779
|
+
## Expose Local Command (expl)
|
|
780
|
+
|
|
781
|
+
The simplest way to expose a local port. Starts a local server and creates a tunnel automatically.
|
|
782
|
+
|
|
783
|
+
```bash
|
|
784
|
+
opentunnel expl <port> [options]
|
|
785
|
+
|
|
786
|
+
Options:
|
|
787
|
+
-s, --domain <domain> Server domain (uses default if not specified)
|
|
788
|
+
-b, --base-path <path> Server base path (default: op)
|
|
789
|
+
-n, --subdomain <name> Request specific subdomain
|
|
790
|
+
-p, --protocol <proto> http, https, or tcp (default: http)
|
|
791
|
+
-h, --host <host> Local host (default: localhost)
|
|
792
|
+
-t, --token <token> Authentication token
|
|
793
|
+
--insecure Skip SSL verification
|
|
794
|
+
--server-port <port> Port for local server (default: 443)
|
|
795
|
+
```
|
|
796
|
+
|
|
797
|
+
**Examples:**
|
|
798
|
+
```bash
|
|
799
|
+
# With default domain configured
|
|
800
|
+
opentunnel expl 3000
|
|
801
|
+
|
|
802
|
+
# With explicit domain
|
|
803
|
+
opentunnel expl 3000 -s example.com
|
|
804
|
+
|
|
805
|
+
# With subdomain
|
|
806
|
+
opentunnel expl 3000 -n myapp
|
|
807
|
+
```
|
|
808
|
+
|
|
809
|
+
## Domain Configuration
|
|
810
|
+
|
|
811
|
+
Set a default domain so you don't need to specify `-s` every time:
|
|
812
|
+
|
|
813
|
+
```bash
|
|
814
|
+
# Set default domain
|
|
815
|
+
opentunnel setdomain example.com
|
|
816
|
+
opentunnel setdomain example.com -b op # with custom base path
|
|
817
|
+
|
|
818
|
+
# View current configuration
|
|
819
|
+
opentunnel getdomain
|
|
820
|
+
|
|
821
|
+
# Remove default domain
|
|
822
|
+
opentunnel cleardomain
|
|
823
|
+
```
|
|
824
|
+
|
|
825
|
+
Configuration is stored in `~/.opentunnel/config.json`:
|
|
826
|
+
```json
|
|
827
|
+
{
|
|
828
|
+
"defaultDomain": {
|
|
829
|
+
"domain": "example.com",
|
|
830
|
+
"basePath": "op"
|
|
831
|
+
}
|
|
832
|
+
}
|
|
833
|
+
```
|
|
697
834
|
|
|
698
835
|
## Quick Command
|
|
699
836
|
|