tailscale-proxy 1.2.0 → 1.4.0

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.
Files changed (2) hide show
  1. package/README.md +67 -3
  2. package/package.json +7 -7
package/README.md CHANGED
@@ -3,8 +3,23 @@
3
3
  [![ci](https://github.com/meabed/tailscale-proxy/actions/workflows/ci.yml/badge.svg)](https://github.com/meabed/tailscale-proxy/actions/workflows/ci.yml)
4
4
  [![release](https://github.com/meabed/tailscale-proxy/actions/workflows/release.yml/badge.svg)](https://github.com/meabed/tailscale-proxy/actions/workflows/release.yml)
5
5
  [![npm](https://img.shields.io/npm/v/tailscale-proxy)](https://www.npmjs.com/package/tailscale-proxy)
6
+ [![docs](https://img.shields.io/badge/docs-tailscaleproxy.vercel.app-blue)](https://tailscaleproxy.vercel.app)
6
7
 
7
- 📖 **Docs:** https://tailscaleproxy.vercel.app · sources in [`website/`](website)
8
+ ## Start in one command
9
+
10
+ ```bash
11
+ npx tailscale-proxy
12
+ ```
13
+
14
+ That's it — no install, no config. It discovers your running dev servers and shares
15
+ them all through one Tailscale URL. (First time? Run `npx tailscale-proxy doctor` to
16
+ check Tailscale is set up — see [Requirements](#requirements).)
17
+
18
+ ```bash
19
+ brew install meabed/tap/tsp && tsp # or install the binary, then run `tsp`
20
+ ```
21
+
22
+ ---
8
23
 
9
24
  An open-source, **self-hosted [ngrok](https://ngrok.com) alternative** built on
10
25
  [Tailscale](https://tailscale.com). Discover your local dev servers by **port**,
@@ -85,6 +100,18 @@ Supported: **macOS, Linux, Windows, WSL** (amd64 + arm64).
85
100
  Update later with **`tsp update`** — it self-updates a standalone binary, or prints
86
101
  `brew upgrade tsp` / `npm i -g tailscale-proxy@latest` for managed installs.
87
102
 
103
+ ### Desktop app (menu bar / tray)
104
+
105
+ Prefer clicking to typing? There's a tray-first desktop app (Wails) that drives the
106
+ same engine in-process — start/stop, switch Funnel/Serve, open service URLs, and
107
+ **start at login** — sharing the same `~/.tailscale-proxy/config.json` as the CLI.
108
+
109
+ ```bash
110
+ cd desktop && go build -o tsp-app . && ./tsp-app
111
+ ```
112
+
113
+ Build/packaging details: [`desktop/README.md`](desktop/README.md).
114
+
88
115
  ---
89
116
 
90
117
  ## Commands
@@ -116,6 +143,7 @@ Run `tsp start --help` for all flags. Global: `-h/--help`, `-v/--version`.
116
143
  | `--https-port <n>` | `443` | Public/tailnet HTTPS port (Funnel: `443`/`8443`/`10000`) |
117
144
  | `--deregister-cycles <n>` | `5` | Missing scans before a gone service is removed |
118
145
  | `--forward-host` | off | Forward the public host to apps via `X-Forwarded-Host/Proto`. Default presents a **local** request so apps behave exactly like `localhost` |
146
+ | `--accept-dns <bool>` | unset | Optionally `tailscale set --accept-dns=<true\|false>` on start. Unset = leave it alone. `false` lets a tailnet host resolve the **public** funnel name (persists after exit) |
119
147
  | `--bg` | off | Run detached (logs → `./tsp.log`) |
120
148
  | `--proxy-only` | off | Run the proxy only; print the `tailscale` command |
121
149
  | `--log-requests` | on | Log each proxied request |
@@ -146,7 +174,7 @@ use). Flags override config at runtime; the file is the source of defaults.
146
174
  {
147
175
  "ports": "3000-5000", "all": false, "runtimes": "", "private": false,
148
176
  "bind": "127.0.0.1", "port": 8443, "interval": 20, "httpsPort": 443,
149
- "logRequests": true, "deregisterCycles": 5, "forwardHost": false
177
+ "logRequests": true, "deregisterCycles": 5, "forwardHost": false, "acceptDns": ""
150
178
  }
151
179
  ```
152
180
 
@@ -177,6 +205,26 @@ Step-by-step with screenshots-worth-of-detail: **[docs/EXAMPLES.md](docs/EXAMPLE
177
205
 
178
206
  ## How it works
179
207
 
208
+ ```mermaid
209
+ flowchart LR
210
+ C["Caller<br/>internet or tailnet"]
211
+ C -->|"https://node.ts.net/web/foo"| TS
212
+ subgraph machine["your machine"]
213
+ direction TB
214
+ TS["tailscale funnel | serve<br/>TLS · :443 / 8443 / 10000"]
215
+ P["tsp proxy<br/>net/http · :8443"]
216
+ SCAN["discovery loop<br/>lsof·ps / netstat·tasklist"]
217
+ D1["127.0.0.1:4983<br/>web · bun"]
218
+ D2["127.0.0.1:3000<br/>api · node"]
219
+ TS -->|plain HTTP| P
220
+ P -->|"/web/foo → strip → /foo<br/>Host → localhost:4983"| D1
221
+ P --> D2
222
+ SCAN -->|"slug → port map"| P
223
+ SCAN -.->|"scan every --interval"| D1
224
+ SCAN -.-> D2
225
+ end
226
+ ```
227
+
180
228
  1. Every `--interval` seconds, `tsp` lists listening TCP sockets in the range
181
229
  (macOS/Linux via `lsof`+`ps`, Windows via `netstat`+`tasklist`), classifies the
182
230
  runtime, and derives a slug from the nearest project-root folder
@@ -187,7 +235,23 @@ Step-by-step with screenshots-worth-of-detail: **[docs/EXAMPLES.md](docs/EXAMPLE
187
235
  3. `tailscale serve|funnel --bg <proxy-port>` exposes the proxy. On exit the entry
188
236
  is reset.
189
237
 
190
- More in [docs/HOW-IT-WORKS.md](docs/HOW-IT-WORKS.md).
238
+ **Request routing:**
239
+
240
+ ```mermaid
241
+ flowchart TD
242
+ R["Request /seg/rest?query"] --> M{"first segment<br/>matches a slug?"}
243
+ M -->|yes| H["strip segment · Host → localhost:port<br/>set tsp_route cookie"]
244
+ M -->|"no (prefix-less asset/HMR)"| CK{"tsp_route<br/>cookie set?"}
245
+ CK -->|yes| FF["forward full path to the cookie's backend"]
246
+ CK -->|no| NF["404 + list of services"]
247
+ H --> UP{"backend up?"}
248
+ FF --> UP
249
+ UP -->|yes| OK["stream response<br/>(SSE · WebSocket)"]
250
+ UP -->|no| E502["502"]
251
+ ```
252
+
253
+ More — including the discovery pipeline and lifecycle sequence diagrams — in
254
+ [docs/HOW-IT-WORKS.md](docs/HOW-IT-WORKS.md).
191
255
 
192
256
  ---
193
257
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tailscale-proxy",
3
- "version": "1.2.0",
3
+ "version": "1.4.0",
4
4
  "description": "Discover local dev servers by port and expose them through one Tailscale Serve/Funnel entry, routed by project name.",
5
5
  "keywords": [
6
6
  "tailscale",
@@ -74,12 +74,12 @@
74
74
  "semantic-release": "^25.0.3"
75
75
  },
76
76
  "optionalDependencies": {
77
- "tailscale-proxy-darwin-arm64": "1.2.0",
78
- "tailscale-proxy-darwin-x64": "1.2.0",
79
- "tailscale-proxy-linux-x64": "1.2.0",
80
- "tailscale-proxy-linux-arm64": "1.2.0",
81
- "tailscale-proxy-win32-x64": "1.2.0",
82
- "tailscale-proxy-win32-arm64": "1.2.0"
77
+ "tailscale-proxy-darwin-arm64": "1.4.0",
78
+ "tailscale-proxy-darwin-x64": "1.4.0",
79
+ "tailscale-proxy-linux-x64": "1.4.0",
80
+ "tailscale-proxy-linux-arm64": "1.4.0",
81
+ "tailscale-proxy-win32-x64": "1.4.0",
82
+ "tailscale-proxy-win32-arm64": "1.4.0"
83
83
  },
84
84
  "packageManager": "bun@1.3.14",
85
85
  "engines": {