pinggy 0.5.9 → 0.6.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/ARCHITECTURE.md +1 -0
- package/dist/{TunnelManager-ZSVX7U3Z.js → TunnelManager-EHMPIQDZ.js} +2 -2
- package/dist/{TunnelTui-S35BNVPO.js → TunnelTui-GBRJDOQD.js} +2 -2
- package/dist/{chunk-4J5YBB4H.js → chunk-7F67A6LY.js} +7 -7
- package/dist/{chunk-YWXADADB.js → chunk-DJ5WX37D.js} +1 -1
- package/dist/{chunk-P7WNBN7F.js → chunk-JQAQRJPE.js} +1 -1
- package/dist/{chunk-PQSLSIDA.js → chunk-LV3J6TAV.js} +10 -5
- package/dist/{chunk-2HAVQORM.js → chunk-QVV3MRKY.js} +3 -3
- package/dist/{configStore-2AZRILVC.js → configStore-XRWOTTA4.js} +2 -2
- package/dist/{daemonChild-MT6TRMRR.js → daemonChild-VX7SCGVS.js} +5 -5
- package/dist/index.cjs +9 -4
- package/dist/index.js +5 -5
- package/dist/{main-KY2O5KNA.js → main-GXPUTY6N.js} +5 -5
- package/dist/workers/file_serve_worker.js +1 -1
- package/package.json +2 -2
package/ARCHITECTURE.md
CHANGED
|
@@ -502,6 +502,7 @@ No em-dashes. Short phrases. Present tense. See `CLAUDE.md` § "English Style" b
|
|
|
502
502
|
- The first CLI run on a fresh install will spawn the daemon and pay an 8-second worst-case latency. Subsequent runs reuse the daemon.
|
|
503
503
|
- `daemon.json` writes are atomic (write tmp, rename). Direct partial reads should not happen, but `getDaemonInfo()` still tolerates malformed JSON by returning `null` and triggering a respawn.
|
|
504
504
|
- The IPC server only listens on `127.0.0.1`. Do not change to `0.0.0.0` without adding authentication. The current design assumes loopback isolation.
|
|
505
|
+
- Every tunnel reconnects without limit. `_createTunnelWithProcessedConfig()` in `TunnelManager.ts` sets `maxReconnectAttempts` to 0 and ignores the value the caller sends. Create, restart and update all pass through it, so the rule covers the CLI, the app, autostart, crash recovery and remote management. libpinggy counts reconnects over the whole tunnel lifetime and does not reset the count after a successful reconnect. Any limit, including the libpinggy default of 20 for an omitted value, stops a long-running tunnel permanently.
|
|
505
506
|
|
|
506
507
|
## 18. Quick diagrams
|
|
507
508
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
TunnelAlreadyRunningError,
|
|
3
3
|
TunnelManager
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-LV3J6TAV.js";
|
|
5
5
|
import "./chunk-UB26QJ4T.js";
|
|
6
|
-
import "./chunk-
|
|
6
|
+
import "./chunk-JQAQRJPE.js";
|
|
7
7
|
import "./chunk-GBYF2H4H.js";
|
|
8
8
|
export {
|
|
9
9
|
TunnelAlreadyRunningError,
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
TunnelManager
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-LV3J6TAV.js";
|
|
4
4
|
import "./chunk-UB26QJ4T.js";
|
|
5
5
|
import {
|
|
6
6
|
logger
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-JQAQRJPE.js";
|
|
8
8
|
import "./chunk-GBYF2H4H.js";
|
|
9
9
|
|
|
10
10
|
// src/tui/blessed/TunnelTui.ts
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
startDaemon,
|
|
14
14
|
startRemoteManagement,
|
|
15
15
|
stopDaemon
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-QVV3MRKY.js";
|
|
17
17
|
import {
|
|
18
18
|
readDaemonConfig
|
|
19
19
|
} from "./chunk-MT44NAXX.js";
|
|
@@ -40,7 +40,7 @@ import {
|
|
|
40
40
|
updateConfigAutoStart,
|
|
41
41
|
updateTunnelConfig,
|
|
42
42
|
validateName
|
|
43
|
-
} from "./chunk-
|
|
43
|
+
} from "./chunk-DJ5WX37D.js";
|
|
44
44
|
import {
|
|
45
45
|
TunnelManager,
|
|
46
46
|
detachAllTunnelLoggers,
|
|
@@ -52,14 +52,14 @@ import {
|
|
|
52
52
|
isValidPort,
|
|
53
53
|
printer_default,
|
|
54
54
|
setTunnelLoggingEnabled
|
|
55
|
-
} from "./chunk-
|
|
55
|
+
} from "./chunk-LV3J6TAV.js";
|
|
56
56
|
import {
|
|
57
57
|
configureLogger,
|
|
58
58
|
enablePackageLogging,
|
|
59
59
|
getLogLevel,
|
|
60
60
|
logger,
|
|
61
61
|
setLogLevel
|
|
62
|
-
} from "./chunk-
|
|
62
|
+
} from "./chunk-JQAQRJPE.js";
|
|
63
63
|
import {
|
|
64
64
|
ensurePinggyConfigDir,
|
|
65
65
|
ensurePinggyLogDir,
|
|
@@ -1126,7 +1126,7 @@ async function connectTui(opts) {
|
|
|
1126
1126
|
const exitMessage = opts.exitMessage || "Stopping tunnel...";
|
|
1127
1127
|
if (!noTui && process.stdin.isTTY) {
|
|
1128
1128
|
try {
|
|
1129
|
-
const { TunnelTui } = await import("./TunnelTui-
|
|
1129
|
+
const { TunnelTui } = await import("./TunnelTui-GBRJDOQD.js");
|
|
1130
1130
|
const tui = new TunnelTui({
|
|
1131
1131
|
urls,
|
|
1132
1132
|
greet,
|
|
@@ -1349,7 +1349,7 @@ async function startBackgroundTunnels(configs, values, positionals) {
|
|
|
1349
1349
|
client.close();
|
|
1350
1350
|
}
|
|
1351
1351
|
async function startAutoStartTunnels() {
|
|
1352
|
-
const { getAutoStartConfigs: getAutoStartConfigs2 } = await import("./configStore-
|
|
1352
|
+
const { getAutoStartConfigs: getAutoStartConfigs2 } = await import("./configStore-XRWOTTA4.js");
|
|
1353
1353
|
const configs = getAutoStartConfigs2();
|
|
1354
1354
|
if (configs.length === 0) {
|
|
1355
1355
|
printer_default.warn("No configs marked for auto-start. Use: pinggy config auto <name>");
|
|
@@ -3463,7 +3463,7 @@ async function main() {
|
|
|
3463
3463
|
const { values, positionals, hasAnyArgs } = parseCliArgs(cliOptions);
|
|
3464
3464
|
configureLogger(values);
|
|
3465
3465
|
if (values["_daemon-child"]) {
|
|
3466
|
-
const { runDaemonChild: runDaemonChild2 } = await import("./daemonChild-
|
|
3466
|
+
const { runDaemonChild: runDaemonChild2 } = await import("./daemonChild-VX7SCGVS.js");
|
|
3467
3467
|
await runDaemonChild2();
|
|
3468
3468
|
return;
|
|
3469
3469
|
}
|
|
@@ -16,7 +16,7 @@ function setLogLevel(level) {
|
|
|
16
16
|
}
|
|
17
17
|
import("./daemonConfig-G6S46GPJ.js").then(({ writeDaemonConfig }) => writeDaemonConfig({ logLevel: level })).catch(() => {
|
|
18
18
|
});
|
|
19
|
-
import("./TunnelManager-
|
|
19
|
+
import("./TunnelManager-EHMPIQDZ.js").then(({ TunnelManager }) => TunnelManager.getInstance().applyLogLevelToActiveTunnels(level)).catch(() => {
|
|
20
20
|
});
|
|
21
21
|
}
|
|
22
22
|
var _logger = null;
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
import {
|
|
5
5
|
getLogLevel,
|
|
6
6
|
logger
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-JQAQRJPE.js";
|
|
8
8
|
import {
|
|
9
9
|
getTunnelLogPath
|
|
10
10
|
} from "./chunk-GBYF2H4H.js";
|
|
@@ -348,14 +348,15 @@ var TunnelManager = class _TunnelManager {
|
|
|
348
348
|
* @private
|
|
349
349
|
*/
|
|
350
350
|
async _createTunnelWithProcessedConfig(params) {
|
|
351
|
-
const
|
|
351
|
+
const tunnelConfig = { ...params.originalConfig, maxReconnectAttempts: 0 };
|
|
352
|
+
const tunnelLogName = params.tunnelName || tunnelConfig?.name;
|
|
352
353
|
const tunnelLogPath = getTunnelLogPath(params.tunnelid, params.origin, tunnelLogName);
|
|
353
354
|
maybeRotate(tunnelLogPath);
|
|
354
355
|
attachTunnelLogger(params.tunnelid, params.origin, tunnelLogName);
|
|
355
356
|
let instance;
|
|
356
357
|
try {
|
|
357
|
-
logger.debug("Creating tunnel instance with processed config",
|
|
358
|
-
instance = await TunnelInstance.create(
|
|
358
|
+
logger.debug("Creating tunnel instance with processed config", tunnelConfig);
|
|
359
|
+
instance = await TunnelInstance.create(tunnelConfig, {
|
|
359
360
|
enabled: true,
|
|
360
361
|
logLevel: mapToSdkLogLevel(getLogLevel()),
|
|
361
362
|
logFilePath: tunnelLogPath,
|
|
@@ -373,7 +374,7 @@ var TunnelManager = class _TunnelManager {
|
|
|
373
374
|
tunnelName: params.tunnelName,
|
|
374
375
|
origin: params.origin,
|
|
375
376
|
instance,
|
|
376
|
-
tunnelConfig
|
|
377
|
+
tunnelConfig,
|
|
377
378
|
serve: params.serve,
|
|
378
379
|
warnings: [],
|
|
379
380
|
isStopped: false,
|
|
@@ -421,6 +422,10 @@ var TunnelManager = class _TunnelManager {
|
|
|
421
422
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
422
423
|
isFatal: true
|
|
423
424
|
};
|
|
425
|
+
managed.isStopping = true;
|
|
426
|
+
managed.instance.stop().catch((e) => {
|
|
427
|
+
logger.debug("Stop after failed start", { tunnelId, error: errorMessage(e) });
|
|
428
|
+
});
|
|
424
429
|
throw error;
|
|
425
430
|
}
|
|
426
431
|
logger.info("Tunnel started", { tunnelId, urls });
|
|
@@ -13,10 +13,10 @@ import {
|
|
|
13
13
|
getVersion,
|
|
14
14
|
isValidPort,
|
|
15
15
|
printer_default
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-LV3J6TAV.js";
|
|
17
17
|
import {
|
|
18
18
|
logger
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-JQAQRJPE.js";
|
|
20
20
|
import {
|
|
21
21
|
getDaemonInfoPath,
|
|
22
22
|
getDaemonLogPath
|
|
@@ -1682,7 +1682,7 @@ async function ensureDaemonRunning() {
|
|
|
1682
1682
|
return existing;
|
|
1683
1683
|
}
|
|
1684
1684
|
if (process.versions.electron) {
|
|
1685
|
-
const { runDaemonChild } = await import("./daemonChild-
|
|
1685
|
+
const { runDaemonChild } = await import("./daemonChild-VX7SCGVS.js");
|
|
1686
1686
|
const handle = await runDaemonChild({
|
|
1687
1687
|
installSignalHandlers: false,
|
|
1688
1688
|
exitOnFailure: false,
|
|
@@ -22,8 +22,8 @@ import {
|
|
|
22
22
|
validateName,
|
|
23
23
|
validateNameForStorage,
|
|
24
24
|
validateNameStrict
|
|
25
|
-
} from "./chunk-
|
|
26
|
-
import "./chunk-
|
|
25
|
+
} from "./chunk-DJ5WX37D.js";
|
|
26
|
+
import "./chunk-JQAQRJPE.js";
|
|
27
27
|
import "./chunk-GBYF2H4H.js";
|
|
28
28
|
export {
|
|
29
29
|
CONFIG_VERBS,
|
|
@@ -6,16 +6,16 @@ import {
|
|
|
6
6
|
trackIPCTunnelStart,
|
|
7
7
|
trackTunnelStart,
|
|
8
8
|
trackTunnelStop
|
|
9
|
-
} from "./chunk-
|
|
10
|
-
import "./chunk-
|
|
9
|
+
} from "./chunk-7F67A6LY.js";
|
|
10
|
+
import "./chunk-QVV3MRKY.js";
|
|
11
11
|
import "./chunk-MT44NAXX.js";
|
|
12
12
|
import {
|
|
13
13
|
DaemonHost
|
|
14
14
|
} from "./chunk-I4HXBP5G.js";
|
|
15
|
-
import "./chunk-
|
|
16
|
-
import "./chunk-
|
|
15
|
+
import "./chunk-DJ5WX37D.js";
|
|
16
|
+
import "./chunk-LV3J6TAV.js";
|
|
17
17
|
import "./chunk-UB26QJ4T.js";
|
|
18
|
-
import "./chunk-
|
|
18
|
+
import "./chunk-JQAQRJPE.js";
|
|
19
19
|
import "./chunk-GBYF2H4H.js";
|
|
20
20
|
export {
|
|
21
21
|
DaemonHost,
|
package/dist/index.cjs
CHANGED
|
@@ -687,14 +687,15 @@ var init_TunnelManager = __esm({
|
|
|
687
687
|
* @private
|
|
688
688
|
*/
|
|
689
689
|
async _createTunnelWithProcessedConfig(params) {
|
|
690
|
-
const
|
|
690
|
+
const tunnelConfig = { ...params.originalConfig, maxReconnectAttempts: 0 };
|
|
691
|
+
const tunnelLogName = params.tunnelName || tunnelConfig?.name;
|
|
691
692
|
const tunnelLogPath = getTunnelLogPath(params.tunnelid, params.origin, tunnelLogName);
|
|
692
693
|
maybeRotate(tunnelLogPath);
|
|
693
694
|
attachTunnelLogger(params.tunnelid, params.origin, tunnelLogName);
|
|
694
695
|
let instance;
|
|
695
696
|
try {
|
|
696
|
-
logger.debug("Creating tunnel instance with processed config",
|
|
697
|
-
instance = await import_pinggy2.TunnelInstance.create(
|
|
697
|
+
logger.debug("Creating tunnel instance with processed config", tunnelConfig);
|
|
698
|
+
instance = await import_pinggy2.TunnelInstance.create(tunnelConfig, {
|
|
698
699
|
enabled: true,
|
|
699
700
|
logLevel: mapToSdkLogLevel(getLogLevel()),
|
|
700
701
|
logFilePath: tunnelLogPath,
|
|
@@ -712,7 +713,7 @@ var init_TunnelManager = __esm({
|
|
|
712
713
|
tunnelName: params.tunnelName,
|
|
713
714
|
origin: params.origin,
|
|
714
715
|
instance,
|
|
715
|
-
tunnelConfig
|
|
716
|
+
tunnelConfig,
|
|
716
717
|
serve: params.serve,
|
|
717
718
|
warnings: [],
|
|
718
719
|
isStopped: false,
|
|
@@ -760,6 +761,10 @@ var init_TunnelManager = __esm({
|
|
|
760
761
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
761
762
|
isFatal: true
|
|
762
763
|
};
|
|
764
|
+
managed.isStopping = true;
|
|
765
|
+
managed.instance.stop().catch((e) => {
|
|
766
|
+
logger.debug("Stop after failed start", { tunnelId, error: errorMessage(e) });
|
|
767
|
+
});
|
|
763
768
|
throw error;
|
|
764
769
|
}
|
|
765
770
|
logger.info("Tunnel started", { tunnelId, urls });
|
package/dist/index.js
CHANGED
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
initiateRemoteManagement,
|
|
15
15
|
isDaemonRunning,
|
|
16
16
|
startRemoteManagement
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-QVV3MRKY.js";
|
|
18
18
|
import "./chunk-I4HXBP5G.js";
|
|
19
19
|
import {
|
|
20
20
|
bulkReplace,
|
|
@@ -33,15 +33,15 @@ import {
|
|
|
33
33
|
validateName,
|
|
34
34
|
validateNameForStorage,
|
|
35
35
|
validateNameStrict
|
|
36
|
-
} from "./chunk-
|
|
36
|
+
} from "./chunk-DJ5WX37D.js";
|
|
37
37
|
import {
|
|
38
38
|
TunnelManager,
|
|
39
39
|
printer_default
|
|
40
|
-
} from "./chunk-
|
|
40
|
+
} from "./chunk-LV3J6TAV.js";
|
|
41
41
|
import "./chunk-UB26QJ4T.js";
|
|
42
42
|
import {
|
|
43
43
|
enablePackageLogging
|
|
44
|
-
} from "./chunk-
|
|
44
|
+
} from "./chunk-JQAQRJPE.js";
|
|
45
45
|
import {
|
|
46
46
|
ensureTunnelConfigDir,
|
|
47
47
|
getDaemonInfoPath,
|
|
@@ -139,7 +139,7 @@ async function verifyAndLoad() {
|
|
|
139
139
|
process.exit(1);
|
|
140
140
|
}
|
|
141
141
|
}
|
|
142
|
-
await import("./main-
|
|
142
|
+
await import("./main-GXPUTY6N.js");
|
|
143
143
|
}
|
|
144
144
|
verifyAndLoad().catch((err) => {
|
|
145
145
|
printer_default.fatal(`Failed to start CLI:, ${err}`);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
runDaemonChild
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-7F67A6LY.js";
|
|
5
5
|
import {
|
|
6
6
|
RemoteManagementUnauthorizedError,
|
|
7
7
|
TunnelOperations,
|
|
@@ -13,19 +13,19 @@ import {
|
|
|
13
13
|
getRemoteManagementState,
|
|
14
14
|
initiateRemoteManagement,
|
|
15
15
|
isDaemonRunning
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-QVV3MRKY.js";
|
|
17
17
|
import "./chunk-MT44NAXX.js";
|
|
18
18
|
import {
|
|
19
19
|
DaemonHost
|
|
20
20
|
} from "./chunk-I4HXBP5G.js";
|
|
21
|
-
import "./chunk-
|
|
21
|
+
import "./chunk-DJ5WX37D.js";
|
|
22
22
|
import {
|
|
23
23
|
TunnelManager
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-LV3J6TAV.js";
|
|
25
25
|
import "./chunk-UB26QJ4T.js";
|
|
26
26
|
import {
|
|
27
27
|
enablePackageLogging
|
|
28
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-JQAQRJPE.js";
|
|
29
29
|
import "./chunk-GBYF2H4H.js";
|
|
30
30
|
export {
|
|
31
31
|
DaemonHost,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pinggy",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.1",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "Create secure, shareable tunnels to your localhost and manage them from the command line. ",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
]
|
|
53
53
|
},
|
|
54
54
|
"dependencies": {
|
|
55
|
-
"@pinggy/pinggy": "^0.5.
|
|
55
|
+
"@pinggy/pinggy": "^0.5.3",
|
|
56
56
|
"blessed": "^0.1.81",
|
|
57
57
|
"clipboardy": "^5.0.0",
|
|
58
58
|
"mime": "^4.1.0",
|