n8n-nodes-speedtest-net 0.2.1 → 0.2.2
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
CHANGED
|
@@ -3,11 +3,11 @@ TypeScript n8n community node with its own wrapper around the **official Ookla S
|
|
|
3
3
|
|
|
4
4
|
## Requirements
|
|
5
5
|
- Self-hosted n8n and Node.js 22 or newer. Not a verified n8n Cloud node.
|
|
6
|
-
-
|
|
7
|
-
- The
|
|
8
|
-
-
|
|
9
|
-
-
|
|
10
|
-
-
|
|
6
|
+
- **No manual CLI installation is needed on Linux x64 or arm64**, including n8n containers. After explicit consent, the first execution downloads the official Ookla CLI 1.2.0 over HTTPS, verifies a pinned SHA-256, and caches it for later runs. No root privileges, package manager, native npm dependencies, or install scripts are required.
|
|
7
|
+
- The worker needs outbound HTTPS access to `install.speedtest.net` and a writable cache. The default is the visible `binaries` directory alongside the installed node. Administrators can set `N8N_SPEEDTEST_CACHE_DIR` to a writable persistent directory, particularly for read-only container filesystems. Concurrent executions share setup within a worker; files are installed atomically.
|
|
8
|
+
- Administrators can instead set `N8N_SPEEDTEST_BINARY` to an existing executable's absolute path; this bypasses downloads. Other operating systems/architectures currently require this override. Restart n8n after environment changes.
|
|
9
|
+
- The official Linux release is musl-based. Actual execution still depends on the container's architecture and security policy (for example, executable mounts must not be `noexec`).
|
|
10
|
+
- Do not install the unrelated Python `speedtest-cli`: it has different flags and output. Ookla terms and licensing still apply to the automatically downloaded binary.
|
|
11
11
|
|
|
12
12
|
Tests measure the **n8n worker/container connection**, not your browser. They consume bandwidth and may use significant data. Tests are sequential within one node execution, but separate workflows/workers can still overlap. One input item causes one test.
|
|
13
13
|
|
|
@@ -22,7 +22,7 @@ npm run build
|
|
|
22
22
|
npm pack
|
|
23
23
|
```
|
|
24
24
|
|
|
25
|
-
Install the generated `n8n-nodes-speedtest-net-0.2.
|
|
25
|
+
Install the generated `n8n-nodes-speedtest-net-0.2.2.tgz` into your self-hosted n8n community-package directory (typically `~/.n8n/nodes`) with npm, using the n8n file owner's account, then restart n8n. Install on all workers in queue mode. Each worker automatically provisions its CLI when first needed.
|
|
26
26
|
|
|
27
27
|
For local development, point `N8N_CUSTOM_EXTENSIONS` at the built `dist/nodes` directory and make the project's dependencies available alongside it. Real n8n discovery and real Ookla requests still require verification in your environment.
|
|
28
28
|
|
|
@@ -67,13 +67,14 @@ The wrapper preserves raw stdout/stderr, exit code, and termination signal when
|
|
|
67
67
|
|
|
68
68
|
**A direct CLI wrapper cannot expose hidden HTTP response headers.** If Ookla does not print a retry duration, it remains `null`. `retryAt` is currently always `null`; a log timestamp is never treated as a quota reset. No fabricated cooldown, automatic retries, or rate-limit bypass is implemented. A rate-limit/licensing error can require more than simply waiting.
|
|
69
69
|
|
|
70
|
-
Error codes include `RATE_LIMITED`, `TIMEOUT`, `BINARY_NOT_FOUND`, `SPAWN_ERROR`, `CLI_ERROR`, `INVALID_RESULT`, `OUTPUT_LIMIT`, and `INVALID_CONFIGURATION`.
|
|
70
|
+
Error codes include `RATE_LIMITED`, `TIMEOUT`, `BINARY_NOT_FOUND`, `BINARY_SETUP_ERROR`, `UNSUPPORTED_PLATFORM`, `SPAWN_ERROR`, `CLI_ERROR`, `INVALID_RESULT`, `OUTPUT_LIMIT`, and `INVALID_CONFIGURATION`. Initial binary setup has a separate 60-second download timeout and a 16 MiB archive limit; the configured test timeout starts after setup.
|
|
71
71
|
|
|
72
72
|
Timeout and output-limit failures kill the direct child and wait for process termination before returning. Captured stdout/stderr is limited to 1 MiB total. Diagnostics can contain network addresses or other sensitive information: restrict access to execution data and avoid publishing raw logs.
|
|
73
73
|
|
|
74
74
|
## Tests and layout
|
|
75
75
|
- `nodes/Speedtest/Speedtest.node.ts`: n8n UI and per-item integration.
|
|
76
76
|
- `nodes/Speedtest/runSpeedtest.ts`: shell-free CLI execution, timeout, output bounds, and result conversion.
|
|
77
|
+
- `nodes/Speedtest/resolveBinary.ts`: automatic official CLI provisioning, SHA-256 verification, safe extraction, and executable caching.
|
|
77
78
|
- `nodes/Speedtest/speedtestError.ts`: structured diagnostics and rate-limit classification.
|
|
78
79
|
- `tests/`: mocked process tests, n8n integration unit tests, and local fixture-process tests; no real Ookla requests.
|
|
79
80
|
|
|
@@ -4,6 +4,7 @@ exports.runSpeedtest = runSpeedtest;
|
|
|
4
4
|
const node_child_process_1 = require("node:child_process");
|
|
5
5
|
const node_net_1 = require("node:net");
|
|
6
6
|
const speedtestError_1 = require("./speedtestError");
|
|
7
|
+
const resolveBinary_1 = require("./resolveBinary");
|
|
7
8
|
// Bound process output so a faulty executable cannot exhaust the worker's memory.
|
|
8
9
|
const MAX_OUTPUT_BYTES = 1024 * 1024;
|
|
9
10
|
async function runSpeedtest(options, timeoutSeconds) {
|
|
@@ -24,9 +25,11 @@ async function runSpeedtest(options, timeoutSeconds) {
|
|
|
24
25
|
args.push('--server-id=' + options.serverId);
|
|
25
26
|
if (options.sourceIp)
|
|
26
27
|
args.push('--ip=' + options.sourceIp);
|
|
28
|
+
const resolved = (0, resolveBinary_1.resolveBinary)();
|
|
29
|
+
const binary = typeof resolved === 'string' ? resolved : await resolved;
|
|
27
30
|
return new Promise((resolve, reject) => {
|
|
28
31
|
// Deliberately not configurable by workflow input: executable selection belongs to the administrator.
|
|
29
|
-
const child = (0, node_child_process_1.spawn)(
|
|
32
|
+
const child = (0, node_child_process_1.spawn)(binary, args, {
|
|
30
33
|
shell: false, windowsHide: true, stdio: ['ignore', 'pipe', 'pipe'],
|
|
31
34
|
});
|
|
32
35
|
let stdout = '';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runSpeedtest.js","sourceRoot":"","sources":["../../../nodes/Speedtest/runSpeedtest.ts"],"names":[],"mappings":";;;AAAA,2DAA2C;AAC3C,uCAAgC;AAEhC,qDAAkD;
|
|
1
|
+
{"version":3,"file":"runSpeedtest.js","sourceRoot":"","sources":["../../../nodes/Speedtest/runSpeedtest.ts"],"names":[],"mappings":";;;A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