@hahahhh/sshx 0.0.2 → 0.0.3-rc.1
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 +16 -23
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
- 🔄 **Reverse command bridge** — run `sshx local <cmd>` *on the remote* to execute commands on your local machine, with stdout, stderr, exit code, and stdin all propagated.
|
|
8
8
|
- 🔌 **Automatic port forwarding** — remote loopback listeners (e.g., a dev server on `localhost:8080`) are automatically detected and forwarded to your local machine.
|
|
9
9
|
- 🌐 **Local domain binding** — access forwarded ports as `<host>.<your-user>.sshx:<port>` in your local browser, no manual `-L` flags needed.
|
|
10
|
-
- 🐳 **Docker container support** — target running containers by name or ID: `sshx my-container`.
|
|
10
|
+
- 🐳 **Docker container support** — target running containers by name or ID: `sshx my-container`. Command bridge support works inside containers via `docker exec`.
|
|
11
11
|
|
|
12
12
|
## Why sshx?
|
|
13
13
|
|
|
@@ -39,7 +39,7 @@ When the target doesn't match any SSH host, sshx falls back to resolving it as a
|
|
|
39
39
|
- `sshx <container-name>` — opens a shell in the container via `docker exec`.
|
|
40
40
|
- `sshx <container-id-prefix>` — matches by container ID prefix.
|
|
41
41
|
- Explicit SSH targets (`user@host`, IP addresses, hostnames with dots/colons) are never treated as Docker containers.
|
|
42
|
-
-
|
|
42
|
+
- Command bridge support works inside containers.
|
|
43
43
|
- Requires `docker` CLI available on the local machine — gracefully falls back to SSH if Docker isn't found or the container isn't running.
|
|
44
44
|
|
|
45
45
|
### 🔄 Remote-to-Local Command Bridge
|
|
@@ -62,15 +62,15 @@ sshx local pbcopy < /tmp/some-data
|
|
|
62
62
|
When a process on the remote starts listening on `127.0.0.1` (e.g., `npm run dev` on port 3000), sshx detects it and:
|
|
63
63
|
|
|
64
64
|
1. Broadcasts the port to the local daemon.
|
|
65
|
-
2.
|
|
66
|
-
3.
|
|
65
|
+
2. Assigns the SSH target its own loopback IP.
|
|
66
|
+
3. Exposes a TCP proxy at the target domain, e.g. `debian.<your-user>.sshx:3000`.
|
|
67
67
|
|
|
68
|
-
|
|
68
|
+
The URL port is the remote port. sshx does not bind `127.0.0.1:<port>`; it binds the target's private loopback IP instead, so `debian.<your-user>.sshx:8080` and `ubuntu.<your-user>.sshx:8080` can point at different hosts at the same time. Run `sshx forward` to see the active mappings.
|
|
69
69
|
|
|
70
70
|
### 🌐 Local Domains (macOS, Linux)
|
|
71
71
|
|
|
72
|
-
- A local DNS responder on `127.0.0.1:53` resolves
|
|
73
|
-
-
|
|
72
|
+
- A local DNS responder on `127.0.0.1:53` resolves active target names dynamically.
|
|
73
|
+
- Each target domain resolves to a private loopback IP; the URL port selects the remote listener.
|
|
74
74
|
- On macOS, `/etc/resolver/<suffix>` is configured once (with `sudo` when needed).
|
|
75
75
|
- All terminals on the same host share one DNS resolver and forwarding daemon.
|
|
76
76
|
|
|
@@ -79,7 +79,9 @@ sshx first tries to use the same local port as the remote listener. If that loca
|
|
|
79
79
|
- One **server daemon** per client target alias, installed under `~/.sshx_server/<uuid>` on the remote and shared by that client's concurrent SSH sessions.
|
|
80
80
|
- Client connects via a hidden `socket-proxy` SSH channel.
|
|
81
81
|
- Server manages port sniffing, forwarding state, and command bridge routing centrally.
|
|
82
|
-
-
|
|
82
|
+
- Clients renew local and remote leases every 5 seconds. A daemon expires a client after 15 seconds without a heartbeat.
|
|
83
|
+
- The local daemon exits when its last client lease closes. The remote server drains briefly and exits after its last bridge lease closes.
|
|
84
|
+
- Application or protocol version changes drain the existing daemon before the current binary starts a replacement.
|
|
83
85
|
|
|
84
86
|
---
|
|
85
87
|
|
|
@@ -177,13 +179,12 @@ On your **local** machine, open:
|
|
|
177
179
|
http://my-server.<your-user>.sshx:8080
|
|
178
180
|
```
|
|
179
181
|
|
|
180
|
-
No `-L` flags, no manual forwarding.
|
|
181
|
-
|
|
182
|
-
If local port `8080` is already occupied, sshx will try `8081`, then `8082`, and so on. Check the chosen port with:
|
|
182
|
+
No `-L` flags, no manual forwarding. Since each target gets its own loopback IP, another target can expose its own `8080` at the same time:
|
|
183
183
|
|
|
184
184
|
```sh
|
|
185
185
|
sshx forward
|
|
186
|
-
# 8080 -> my-server:8080
|
|
186
|
+
# http://my-server.<your-user>.sshx:8080 -> my-server:8080
|
|
187
|
+
# http://other-server.<your-user>.sshx:8080 -> other-server:8080
|
|
187
188
|
```
|
|
188
189
|
|
|
189
190
|
---
|
|
@@ -201,17 +202,9 @@ features:
|
|
|
201
202
|
# Remote-to-local command bridge (`sshx local <cmd>` on the remote)
|
|
202
203
|
commandBridge: true
|
|
203
204
|
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
# Future: also detect 0.0.0.0 listeners.
|
|
208
|
-
# bindAll: false
|
|
209
|
-
|
|
210
|
-
domains:
|
|
211
|
-
# Enable local domain binding (<host>.<user>.sshx:<port>).
|
|
212
|
-
enabled: true
|
|
213
|
-
# Custom domain suffix. Default: <local-user>.sshx
|
|
214
|
-
suffix: user.sshx
|
|
205
|
+
# Auto-detect remote loopback TCP listeners and expose them via
|
|
206
|
+
# <host>.<user>.sshx:<remote-port>.
|
|
207
|
+
autoForward: true
|
|
215
208
|
|
|
216
209
|
commands:
|
|
217
210
|
# Commands blocked from bridge execution.
|