derpcat 0.0.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/LICENSE ADDED
@@ -0,0 +1,29 @@
1
+ BSD 3-Clause License
2
+
3
+ Copyright (c) 2026 Shayne
4
+ All rights reserved.
5
+
6
+ Redistribution and use in source and binary forms, with or without
7
+ modification, are permitted provided that the following conditions are met:
8
+
9
+ 1. Redistributions of source code must retain the above copyright notice, this
10
+ list of conditions and the following disclaimer.
11
+
12
+ 2. Redistributions in binary form must reproduce the above copyright notice,
13
+ this list of conditions and the following disclaimer in the documentation
14
+ and/or other materials provided with the distribution.
15
+
16
+ 3. Neither the name of the copyright holder nor the names of its
17
+ contributors may be used to endorse or promote products derived from
18
+ this software without specific prior written permission.
19
+
20
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
24
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package/README.md ADDED
@@ -0,0 +1,40 @@
1
+ # derpcat
2
+
3
+ `derpcat` is a standalone Go CLI for moving one bidirectional byte stream between two hosts using the public Tailscale DERP network for bootstrap and relay fallback, with direct UDP promotion when possible.
4
+
5
+ ## npm
6
+
7
+ The npm packaging and release workflow now exist.
8
+ The first `0.0.1` publish is still manual until npm trusted publishing is configured.
9
+ The install commands below are post-publish examples.
10
+
11
+ ### Production install example
12
+
13
+ ```bash
14
+ npx derpcat --version
15
+ ```
16
+
17
+ ### Dev channel install example
18
+
19
+ ```bash
20
+ npx derpcat@dev --version
21
+ ```
22
+
23
+ ## Build
24
+
25
+ ```bash
26
+ mise run build
27
+ ```
28
+
29
+ ## Test
30
+
31
+ ```bash
32
+ mise run test
33
+ mise run smoke-local
34
+ ```
35
+
36
+ ## Publishing
37
+
38
+ - Manual bootstrap runbook: [docs/releases/npm-bootstrap.md](docs/releases/npm-bootstrap.md)
39
+ - `main` publishes the npm `dev` dist-tag once trusted publishing is configured
40
+ - version tags like `v0.1.0` publish production releases through GitHub Actions once trusted publishing is configured
package/bin/derpcat.js ADDED
@@ -0,0 +1,66 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { spawn } from "node:child_process";
4
+ import { existsSync } from "node:fs";
5
+ import os from "node:os";
6
+ import path from "node:path";
7
+ import { fileURLToPath } from "node:url";
8
+
9
+ const __filename = fileURLToPath(import.meta.url);
10
+ const __dirname = path.dirname(__filename);
11
+
12
+ const triples = new Map([
13
+ ["linux:x64", "x86_64-unknown-linux-musl"],
14
+ ["linux:arm64", "aarch64-unknown-linux-musl"],
15
+ ["darwin:x64", "x86_64-apple-darwin"],
16
+ ["darwin:arm64", "aarch64-apple-darwin"],
17
+ ]);
18
+
19
+ const triple = triples.get(`${process.platform}:${process.arch}`);
20
+ if (!triple) {
21
+ console.error(`Unsupported platform: ${process.platform} (${process.arch})`);
22
+ process.exit(1);
23
+ }
24
+
25
+ const binaryName = process.platform === "win32" ? "derpcat.exe" : "derpcat";
26
+ const binaryPath = path.join(__dirname, "..", "vendor", triple, "derpcat", binaryName);
27
+ if (!existsSync(binaryPath)) {
28
+ console.error(`Missing vendored binary: ${binaryPath}`);
29
+ process.exit(1);
30
+ }
31
+
32
+ const child = spawn(binaryPath, process.argv.slice(2), {
33
+ stdio: "inherit",
34
+ env: { ...process.env, DERPCAT_MANAGED_BY_NPM: "1" },
35
+ });
36
+
37
+ child.on("error", (err) => {
38
+ const reason = err instanceof Error ? err.message : String(err);
39
+ console.error(`Failed to launch vendored binary: ${reason}`);
40
+ process.exit(1);
41
+ });
42
+
43
+ ["SIGINT", "SIGTERM", "SIGHUP"].forEach((sig) => {
44
+ process.on(sig, () => {
45
+ if (!child.killed) {
46
+ child.kill(sig);
47
+ }
48
+ });
49
+ });
50
+
51
+ const result = await new Promise((resolve) => {
52
+ child.on("exit", (code, signal) => {
53
+ if (signal) {
54
+ resolve({ signal });
55
+ return;
56
+ }
57
+ resolve({ code: code ?? 1 });
58
+ });
59
+ });
60
+
61
+ if (result.signal) {
62
+ const signalNumber = os.constants.signals[result.signal];
63
+ process.exit(typeof signalNumber === "number" ? 128 + signalNumber : 1);
64
+ } else {
65
+ process.exit(result.code);
66
+ }
package/package.json ADDED
@@ -0,0 +1,30 @@
1
+ {
2
+ "name": "derpcat",
3
+ "version": "0.0.1",
4
+ "license": "BSD-3-Clause",
5
+ "bin": {
6
+ "derpcat": "bin/derpcat.js"
7
+ },
8
+ "type": "module",
9
+ "os": [
10
+ "linux",
11
+ "darwin"
12
+ ],
13
+ "cpu": [
14
+ "x64",
15
+ "arm64"
16
+ ],
17
+ "engines": {
18
+ "node": ">=16"
19
+ },
20
+ "files": [
21
+ "bin",
22
+ "vendor",
23
+ "README.md",
24
+ "LICENSE"
25
+ ],
26
+ "repository": {
27
+ "type": "git",
28
+ "url": "git+https://github.com/shayne/derpcat.git"
29
+ }
30
+ }