@dpkrn/nodetunnel 1.0.9 → 1.1.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.
- package/CHANGELOG.md +63 -0
- package/README.md +34 -11
- package/cmd/test-lib/main.js +15 -0
- package/internal/inspector/index.js +1012 -0
- package/internal/inspector/inspector.css +1085 -0
- package/internal/inspector/inspector.html +263 -0
- package/internal/inspector/inspector.js +601 -0
- package/internal/{tunnel → inspector}/logstore.js +13 -0
- package/internal/inspector/theme-postman.css +38 -0
- package/internal/inspector/theme-terminal.css +38 -0
- package/internal/tunnel/tunnel.js +15 -12
- package/package.json +3 -1
- package/pkg/tunnel/tunnel.js +1 -1
- package/internal/tunnel/inspector-page.html +0 -482
- package/internal/tunnel/inspector.js +0 -266
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project are documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
6
|
+
|
|
7
|
+
## [Unreleased]
|
|
8
|
+
|
|
9
|
+
Nothing unreleased yet.
|
|
10
|
+
|
|
11
|
+
## [1.0.10] - 2026-04-12
|
|
12
|
+
|
|
13
|
+
### Changed
|
|
14
|
+
|
|
15
|
+
- Expanded README with clearer coverage of what nodetunnel does and how to use it.
|
|
16
|
+
|
|
17
|
+
## [1.0.9] - 2026-04-12
|
|
18
|
+
|
|
19
|
+
### Added
|
|
20
|
+
|
|
21
|
+
- Makefile with `pkg` (publish) and `test` targets for maintainers.
|
|
22
|
+
- Contributor Covenant Code of Conduct.
|
|
23
|
+
- Local traffic inspector: HTTP UI plus WebSocket streaming of request/response logs (via `ws`).
|
|
24
|
+
- Structured logging store for tunneled HTTP exchanges.
|
|
25
|
+
|
|
26
|
+
### Changed
|
|
27
|
+
|
|
28
|
+
- Refactor of the published tunnel package layout and dependencies.
|
|
29
|
+
- Clearer logging during tunnel setup and while forwarding requests.
|
|
30
|
+
|
|
31
|
+
## [1.0.8] - 2026-04-12
|
|
32
|
+
|
|
33
|
+
### Changed
|
|
34
|
+
|
|
35
|
+
- Maintenance release (version alignment).
|
|
36
|
+
|
|
37
|
+
## [1.0.7] - 2026-04-12
|
|
38
|
+
|
|
39
|
+
### Changed
|
|
40
|
+
|
|
41
|
+
- Default tunnel server host set to `clickly.cv`.
|
|
42
|
+
- Public URL string returned by the tunnel client updated for consistency with the server.
|
|
43
|
+
- Tunnel handshake and messaging updated (connection UUID and success-line formatting for the assigned URL).
|
|
44
|
+
|
|
45
|
+
## [1.0.4] - 2026-04-03
|
|
46
|
+
|
|
47
|
+
### Added
|
|
48
|
+
|
|
49
|
+
- Node.js tunnel library: expose a local HTTP server through a gotunnel/yamux-compatible remote (`startTunnel` and related APIs).
|
|
50
|
+
|
|
51
|
+
## [1.0.2] - 2026-04-03
|
|
52
|
+
|
|
53
|
+
### Added
|
|
54
|
+
|
|
55
|
+
- Initial `@dpkrn/nodetunnel` package scaffold.
|
|
56
|
+
|
|
57
|
+
[Unreleased]: https://github.com/DpkRn/nodetunnel/compare/v1.0.10...HEAD
|
|
58
|
+
[1.0.10]: https://github.com/DpkRn/nodetunnel/compare/v1.0.9...v1.0.10
|
|
59
|
+
[1.0.9]: https://github.com/DpkRn/nodetunnel/compare/v1.0.8...v1.0.9
|
|
60
|
+
[1.0.8]: https://github.com/DpkRn/nodetunnel/compare/v1.0.7...v1.0.8
|
|
61
|
+
[1.0.7]: https://github.com/DpkRn/nodetunnel/compare/v1.0.4...v1.0.7
|
|
62
|
+
[1.0.4]: https://github.com/DpkRn/nodetunnel/compare/v1.0.2...v1.0.4
|
|
63
|
+
[1.0.2]: https://github.com/DpkRn/nodetunnel/releases/tag/v1.0.2
|
package/README.md
CHANGED
|
@@ -1,6 +1,37 @@
|
|
|
1
1
|
# @dpkrn/nodetunnel
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Package **nodetunnel** exposes a local HTTP server on a public URL by establishing a persistent outbound TCP connection to a tunnel server.
|
|
4
|
+
|
|
5
|
+
It creates an outbound connection to a tunnel server and forwards incoming requests to your local application (e.g., `localhost:8080`).
|
|
6
|
+
|
|
7
|
+
From **Node.js**, you get a **public URL** for webhooks, demos, sharing a dev server, or testing from another device — without a separate tunnel daemon.
|
|
8
|
+
|
|
9
|
+
## Introduction
|
|
10
|
+
|
|
11
|
+
### Benefits
|
|
12
|
+
|
|
13
|
+
- Sharing your local server with others
|
|
14
|
+
- Testing webhooks (Stripe, GitHub, etc.)
|
|
15
|
+
- Remote debugging without deployment
|
|
16
|
+
- No port forwarding or firewall configuration needed
|
|
17
|
+
- Works behind NAT or private networks
|
|
18
|
+
- Simple integration with existing Node.js HTTP servers (Express, Fastify, plain `http`, etc.)
|
|
19
|
+
- Traffic inspector: capture traffic, replay, and modify requests as many times as you need
|
|
20
|
+
|
|
21
|
+
Incoming traffic reaches the public URL, is forwarded through the tunnel, and is proxied to your local HTTP server (e.g., `localhost:8080`).
|
|
22
|
+
|
|
23
|
+
This enables exposing local development servers without port forwarding, firewall changes, or public hosting.
|
|
24
|
+
|
|
25
|
+
### Requirements
|
|
26
|
+
|
|
27
|
+
- **Node.js 18+**
|
|
28
|
+
- A **tunnel server** must be running and reachable (configure `host` / `serverPort` — see **Options** under [API](#api) below).
|
|
29
|
+
- The port passed to `startTunnel` must match your local HTTP server port.
|
|
30
|
+
- Your local server must be running **before** or **concurrently** with `startTunnel`.
|
|
31
|
+
|
|
32
|
+
## Overview
|
|
33
|
+
|
|
34
|
+
**nodetunnel** exposes a local HTTP server on a public URL by connecting to a tunnel server you run separately. Traffic hits the tunnel first, then your app on `localhost`.
|
|
4
35
|
|
|
5
36
|
---
|
|
6
37
|
|
|
@@ -13,14 +44,6 @@ Give your **local** HTTP server a **public URL** from Node.js — useful for web
|
|
|
13
44
|
|
|
14
45
|
---
|
|
15
46
|
|
|
16
|
-
## Requirements
|
|
17
|
-
|
|
18
|
-
- **Node.js 18+**
|
|
19
|
-
- Your app listening on a port (e.g. `8080`)
|
|
20
|
-
- A **tunnel server** reachable from your machine (default: `localhost:9000`)
|
|
21
|
-
|
|
22
|
-
---
|
|
23
|
-
|
|
24
47
|
## Install
|
|
25
48
|
|
|
26
49
|
```bash
|
|
@@ -129,7 +152,7 @@ server.listen(PORT, async () => {
|
|
|
129
152
|
});
|
|
130
153
|
|
|
131
154
|
// console.log("Public:", url);
|
|
132
|
-
// Open the Inspector URL from stderr in a browser (e.g. http://
|
|
155
|
+
// Open the Inspector URL from stderr in a browser (e.g. http://localhost:4040)
|
|
133
156
|
|
|
134
157
|
process.once("SIGINT", () => {
|
|
135
158
|
stop();
|
|
@@ -204,7 +227,7 @@ Errors **reject** the promise — use `try/catch`.
|
|
|
204
227
|
| `inspector` | `boolean` | `true` | If `true`, start the local traffic inspector UI (see [Traffic inspector](#traffic-inspector-local-dashboard)). If `false`, no extra HTTP server and no Inspector line in the banner. |
|
|
205
228
|
| `themes` | `string` | `'dark'` | Inspector palette: `'dark'`, `'terminal'`, or `'light'`. |
|
|
206
229
|
| `logs` | `number` | `100` | Maximum number of request/response captures kept in memory for the inspector. |
|
|
207
|
-
| `inspectorAddr` | `string` | `':4040'` | Listen address for the inspector (e.g. `':4040'`, `'
|
|
230
|
+
| `inspectorAddr` | `string` | `':4040'` | Listen address for the inspector (e.g. `':4040'`, `'localhost:9090'`). Display URL follows the same rules as the public banner. |
|
|
208
231
|
|
|
209
232
|
---
|
|
210
233
|
|
package/cmd/test-lib/main.js
CHANGED
|
@@ -4,6 +4,7 @@ import { startTunnel } from "../../pkg/tunnel/tunnel.js";
|
|
|
4
4
|
|
|
5
5
|
const app = express();
|
|
6
6
|
app.set("etag", false);
|
|
7
|
+
app.use(express.json());
|
|
7
8
|
const PORT = process.env.PORT || 8080;
|
|
8
9
|
/** Random id per process — if this doesn’t match your terminal on each restart, another process is bound to the port. */
|
|
9
10
|
const INSTANCE = Math.random().toString(36).slice(2, 10);
|
|
@@ -26,6 +27,20 @@ app.get("/", async (req, res) => {
|
|
|
26
27
|
res.send("Backend is running");
|
|
27
28
|
});
|
|
28
29
|
|
|
30
|
+
/**
|
|
31
|
+
* POST echo: path params (`:category`, `:itemId`), query string, and JSON body.
|
|
32
|
+
* Example: POST /test/widgets/42?verbose=1&tag=a with body `{"name":"x"}`
|
|
33
|
+
*/
|
|
34
|
+
app.post("/test/:category/:itemId", (req, res) => {
|
|
35
|
+
console.log("server received request");
|
|
36
|
+
console.log("req.body",req.body);
|
|
37
|
+
res.status(200).json({
|
|
38
|
+
pathParams: req.params,
|
|
39
|
+
query: req.query,
|
|
40
|
+
body: req.body,
|
|
41
|
+
});
|
|
42
|
+
});
|
|
43
|
+
|
|
29
44
|
app.listen(PORT, async () => {
|
|
30
45
|
console.log(`listening on http://localhost:${PORT}`);
|
|
31
46
|
try {
|