pinggy 0.6.9 → 0.6.11
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 +21 -8
- package/CLAUDE.md +7 -3
- package/README.md +12 -0
- package/dist/{chunk-MHQ3CVEB.js → chunk-P54K7NPF.js} +5 -1
- package/dist/chunk-RYO5T2JT.js +1947 -0
- package/dist/{chunk-LF6WMFWT.js → chunk-W47AYOH2.js} +6800 -2025
- package/dist/{daemonChild-WTZ7X6SZ.js → daemonChild-GGG34AOT.js} +7 -5
- package/dist/index.cjs +3234 -432
- package/dist/index.d.cts +75 -2
- package/dist/index.d.ts +75 -2
- package/dist/index.js +21 -5
- package/dist/{ipcClient-IZ5R6TPN.js → ipcClient-6QESURCH.js} +1 -1
- package/dist/{main-INPCUGAN.js → main-FCIOVX5I.js} +5 -8
- package/dist/{updateChild-BPWBQ3WR.js → updateChild-RNCLN24C.js} +12 -14
- package/package.json +1 -1
- package/scripts/install/install.ps1 +3 -2
- package/scripts/install/install.sh +13 -7
- package/dist/chunk-HJECJ7LC.js +0 -889
- package/dist/chunk-OQVFQ5VG.js +0 -1041
- package/dist/chunk-Q5RYSWFK.js +0 -2204
package/dist/index.d.cts
CHANGED
|
@@ -1162,6 +1162,43 @@ interface DaemonInfo {
|
|
|
1162
1162
|
/** The OS boot ID when this daemon started. Absent in older builds, and where the OS gives none. */
|
|
1163
1163
|
bootId?: string;
|
|
1164
1164
|
}
|
|
1165
|
+
interface DaemonHandle {
|
|
1166
|
+
pid: number;
|
|
1167
|
+
port: number;
|
|
1168
|
+
shutdown: () => void;
|
|
1169
|
+
}
|
|
1170
|
+
interface RunDaemonOptions {
|
|
1171
|
+
/**
|
|
1172
|
+
* Install POSIX signal handlers (SIGTERM/SIGINT/exit/uncaught) that tear
|
|
1173
|
+
* the daemon down and exit the process. Set to false when hosting the
|
|
1174
|
+
* daemon inside another application that owns its own lifecycle.
|
|
1175
|
+
* Default: true.
|
|
1176
|
+
*/
|
|
1177
|
+
installSignalHandlers?: boolean;
|
|
1178
|
+
/**
|
|
1179
|
+
* Call process.exit(1) on startup failure. Set to false when hosting the
|
|
1180
|
+
* daemon in-process so the caller can handle the error.
|
|
1181
|
+
* Default: true.
|
|
1182
|
+
*/
|
|
1183
|
+
exitOnFailure?: boolean;
|
|
1184
|
+
/**
|
|
1185
|
+
* Who hosts this daemon. "app" means the Pinggy desktop app owns it: in the app's own
|
|
1186
|
+
* process, or in a child process the app supervises. The app decides when it stops, so an
|
|
1187
|
+
* IPC shutdown request is refused. Default: "cli".
|
|
1188
|
+
*/
|
|
1189
|
+
host?: DaemonHost;
|
|
1190
|
+
/**
|
|
1191
|
+
* Skip the auto-start tunnels. A host that restarts the daemon after a crash sets this:
|
|
1192
|
+
* the tunnels that ran are restored from daemon-state.json, and an auto-start tunnel the
|
|
1193
|
+
* user had stopped stays stopped. Default: false.
|
|
1194
|
+
*/
|
|
1195
|
+
skipAutoStart?: boolean;
|
|
1196
|
+
}
|
|
1197
|
+
/** Another live daemon holds daemon.lock. Thrown by runDaemonChild() when `exitOnFailure` is false. */
|
|
1198
|
+
declare class DaemonLockHeldError extends Error {
|
|
1199
|
+
constructor();
|
|
1200
|
+
}
|
|
1201
|
+
declare function runDaemonChild(opts?: RunDaemonOptions): Promise<DaemonHandle>;
|
|
1165
1202
|
|
|
1166
1203
|
type StatsCallback = (tunnelId: string, stats: TunnelUsageType) => void;
|
|
1167
1204
|
type DisconnectCallback = (tunnelId: string, error: string, messages: string[]) => void;
|
|
@@ -1190,7 +1227,13 @@ declare class WsStream {
|
|
|
1190
1227
|
ensureOpen(): Promise<void>;
|
|
1191
1228
|
/** Send a normal close (1000). Use for user-initiated shutdown. */
|
|
1192
1229
|
closeNormally(): void;
|
|
1193
|
-
/**
|
|
1230
|
+
/**
|
|
1231
|
+
* Hard kill the socket. Use when daemon is known dead.
|
|
1232
|
+
*
|
|
1233
|
+
* The subscriptions are dropped even when the socket is already gone. A daemon that dies closes
|
|
1234
|
+
* the socket first, and subscriptions left here made a later subscribe() on a new daemon send
|
|
1235
|
+
* nothing.
|
|
1236
|
+
*/
|
|
1194
1237
|
terminate(): void;
|
|
1195
1238
|
isOpen(): boolean;
|
|
1196
1239
|
subscribe(tunnelId: string, mode?: SubscriptionMode): Promise<void>;
|
|
@@ -1317,6 +1360,12 @@ declare class TunnelClient {
|
|
|
1317
1360
|
*/
|
|
1318
1361
|
connectIfRunning(): boolean;
|
|
1319
1362
|
private bindDaemon;
|
|
1363
|
+
/**
|
|
1364
|
+
* Daemon loss drops every stream subscription, and a shim listener subscribes only when it is
|
|
1365
|
+
* registered. Without this, listeners registered before the loss stay silent on the new daemon.
|
|
1366
|
+
* A daemon restarted after a crash restores its tunnels under the same tunnel ids.
|
|
1367
|
+
*/
|
|
1368
|
+
private resubscribeShimListeners;
|
|
1320
1369
|
static forRemoteManagement(): Promise<TunnelClient>;
|
|
1321
1370
|
/**
|
|
1322
1371
|
* Close the WebSocket connection and cleanup.
|
|
@@ -1380,6 +1429,14 @@ declare class TunnelClient {
|
|
|
1380
1429
|
private assertClient;
|
|
1381
1430
|
}
|
|
1382
1431
|
|
|
1432
|
+
/** Starts a daemon and resolves once daemon.json names a live one: its own, or another that won daemon.lock. */
|
|
1433
|
+
type DaemonLauncher = () => Promise<void>;
|
|
1434
|
+
/**
|
|
1435
|
+
* Lets the host start the daemon its own way. The Pinggy app sets this to start the daemon in a child
|
|
1436
|
+
* process it supervises, so a crash in the native library ends that child and not the app.
|
|
1437
|
+
* Pass null to go back to the built-in start.
|
|
1438
|
+
*/
|
|
1439
|
+
declare function setDaemonLauncher(launcher: DaemonLauncher | null): void;
|
|
1383
1440
|
/**
|
|
1384
1441
|
* Read and validate daemon.json.
|
|
1385
1442
|
* Returns null if file doesn't exist, is malformed, or PID is stale.
|
|
@@ -1390,6 +1447,22 @@ declare function getDaemonInfo(): DaemonInfo | null;
|
|
|
1390
1447
|
* Check if the daemon is currently running.
|
|
1391
1448
|
*/
|
|
1392
1449
|
declare function isDaemonRunning(): boolean;
|
|
1450
|
+
/**
|
|
1451
|
+
* Deletes daemon.json and daemon.lock when they name `pid`. A host that supervises the daemon calls this
|
|
1452
|
+
* right after its daemon process exits. Until the next daemon starts, both files would name a dead PID,
|
|
1453
|
+
* and a PID the OS gives to another process would read as a live daemon.
|
|
1454
|
+
*/
|
|
1455
|
+
declare function removeDeadDaemonFiles(pid: number): void;
|
|
1456
|
+
|
|
1457
|
+
/**
|
|
1458
|
+
* Remove the state file (called on clean shutdown).
|
|
1459
|
+
*/
|
|
1460
|
+
declare function clearDaemonState(): void;
|
|
1461
|
+
/**
|
|
1462
|
+
* How many tunnels a new daemon would restore: the detached ones in the state file. 0 after a clean
|
|
1463
|
+
* shutdown, which deletes the file. A host uses this to tell a daemon that crashed from one that was stopped.
|
|
1464
|
+
*/
|
|
1465
|
+
declare function restorableTunnelCount(): number;
|
|
1393
1466
|
|
|
1394
1467
|
interface BaseLogConfig {
|
|
1395
1468
|
level?: string;
|
|
@@ -1440,4 +1513,4 @@ declare function ensureTunnelConfigDir(): string;
|
|
|
1440
1513
|
*/
|
|
1441
1514
|
declare function getDaemonInfoPath(): string;
|
|
1442
1515
|
|
|
1443
|
-
export { type AdditionalForwarding, type DaemonInfo, type DeviceAgentError, DeviceAgentState, type DeviceAgentStatus, type DisconnectListener, type ErrorListener, type FinalConfig, type ITunnelManager, type ManagedTunnel, type ReconnectingListener, type ReconnectionCompletedListener, type ReconnectionFailedListener, RemoteManagementUnauthorizedError, type SavedTunnelConfig, type StartListener, type StatsListener, type Status, type StorageLogger, TUNNEL_CONFIG_V1_KEYS, TunnelClient, type TunnelConfigV1, TunnelConfigV1Schema, TunnelErrorCodeType, type TunnelList, TunnelManager, TunnelOperations, type TunnelResponse, TunnelStateType, type TunnelStatus, TunnelWarningCode, type TunnelWorkerErrorListner, type Warning, type WillReconnectListener, bulkReplace, closeRemoteManagement, configureStorageLogger, deleteConfig, enablePackageLogging, ensureTunnelConfigDir, findConfig, findConfigByName, getAutoStartConfigs, getDaemonInfo, getDaemonInfoPath, getPinggyConfigDir, getRemoteManagementState, getTunnelConfigDir, initiateRemoteManagement, isDaemonRunning, listSavedConfigs, loadConfigByName, sanitizeName, saveConfig, startRemoteManagement, updateConfigAutoStart, updateTunnelConfig, upsertConfig, validateName, validateNameForStorage, validateNameStrict };
|
|
1516
|
+
export { type AdditionalForwarding, type DaemonHandle, DaemonHost, type DaemonInfo, type DaemonLauncher, DaemonLockHeldError, type DeviceAgentError, DeviceAgentState, type DeviceAgentStatus, type DisconnectListener, type ErrorListener, type FinalConfig, type ITunnelManager, type ManagedTunnel, type ReconnectingListener, type ReconnectionCompletedListener, type ReconnectionFailedListener, RemoteManagementUnauthorizedError, type RunDaemonOptions, type SavedTunnelConfig, type StartListener, type StatsListener, type Status, type StorageLogger, TUNNEL_CONFIG_V1_KEYS, TunnelClient, type TunnelConfigV1, TunnelConfigV1Schema, TunnelErrorCodeType, type TunnelList, TunnelManager, TunnelOperations, type TunnelResponse, TunnelStateType, type TunnelStatus, TunnelWarningCode, type TunnelWorkerErrorListner, type Warning, type WillReconnectListener, bulkReplace, clearDaemonState, closeRemoteManagement, configureStorageLogger, deleteConfig, enablePackageLogging, ensureTunnelConfigDir, findConfig, findConfigByName, getAutoStartConfigs, getDaemonInfo, getDaemonInfoPath, getPinggyConfigDir, getRemoteManagementState, getTunnelConfigDir, initiateRemoteManagement, isDaemonRunning, listSavedConfigs, loadConfigByName, removeDeadDaemonFiles, restorableTunnelCount, runDaemonChild, sanitizeName, saveConfig, setDaemonLauncher, startRemoteManagement, updateConfigAutoStart, updateTunnelConfig, upsertConfig, validateName, validateNameForStorage, validateNameStrict };
|
package/dist/index.d.ts
CHANGED
|
@@ -1162,6 +1162,43 @@ interface DaemonInfo {
|
|
|
1162
1162
|
/** The OS boot ID when this daemon started. Absent in older builds, and where the OS gives none. */
|
|
1163
1163
|
bootId?: string;
|
|
1164
1164
|
}
|
|
1165
|
+
interface DaemonHandle {
|
|
1166
|
+
pid: number;
|
|
1167
|
+
port: number;
|
|
1168
|
+
shutdown: () => void;
|
|
1169
|
+
}
|
|
1170
|
+
interface RunDaemonOptions {
|
|
1171
|
+
/**
|
|
1172
|
+
* Install POSIX signal handlers (SIGTERM/SIGINT/exit/uncaught) that tear
|
|
1173
|
+
* the daemon down and exit the process. Set to false when hosting the
|
|
1174
|
+
* daemon inside another application that owns its own lifecycle.
|
|
1175
|
+
* Default: true.
|
|
1176
|
+
*/
|
|
1177
|
+
installSignalHandlers?: boolean;
|
|
1178
|
+
/**
|
|
1179
|
+
* Call process.exit(1) on startup failure. Set to false when hosting the
|
|
1180
|
+
* daemon in-process so the caller can handle the error.
|
|
1181
|
+
* Default: true.
|
|
1182
|
+
*/
|
|
1183
|
+
exitOnFailure?: boolean;
|
|
1184
|
+
/**
|
|
1185
|
+
* Who hosts this daemon. "app" means the Pinggy desktop app owns it: in the app's own
|
|
1186
|
+
* process, or in a child process the app supervises. The app decides when it stops, so an
|
|
1187
|
+
* IPC shutdown request is refused. Default: "cli".
|
|
1188
|
+
*/
|
|
1189
|
+
host?: DaemonHost;
|
|
1190
|
+
/**
|
|
1191
|
+
* Skip the auto-start tunnels. A host that restarts the daemon after a crash sets this:
|
|
1192
|
+
* the tunnels that ran are restored from daemon-state.json, and an auto-start tunnel the
|
|
1193
|
+
* user had stopped stays stopped. Default: false.
|
|
1194
|
+
*/
|
|
1195
|
+
skipAutoStart?: boolean;
|
|
1196
|
+
}
|
|
1197
|
+
/** Another live daemon holds daemon.lock. Thrown by runDaemonChild() when `exitOnFailure` is false. */
|
|
1198
|
+
declare class DaemonLockHeldError extends Error {
|
|
1199
|
+
constructor();
|
|
1200
|
+
}
|
|
1201
|
+
declare function runDaemonChild(opts?: RunDaemonOptions): Promise<DaemonHandle>;
|
|
1165
1202
|
|
|
1166
1203
|
type StatsCallback = (tunnelId: string, stats: TunnelUsageType) => void;
|
|
1167
1204
|
type DisconnectCallback = (tunnelId: string, error: string, messages: string[]) => void;
|
|
@@ -1190,7 +1227,13 @@ declare class WsStream {
|
|
|
1190
1227
|
ensureOpen(): Promise<void>;
|
|
1191
1228
|
/** Send a normal close (1000). Use for user-initiated shutdown. */
|
|
1192
1229
|
closeNormally(): void;
|
|
1193
|
-
/**
|
|
1230
|
+
/**
|
|
1231
|
+
* Hard kill the socket. Use when daemon is known dead.
|
|
1232
|
+
*
|
|
1233
|
+
* The subscriptions are dropped even when the socket is already gone. A daemon that dies closes
|
|
1234
|
+
* the socket first, and subscriptions left here made a later subscribe() on a new daemon send
|
|
1235
|
+
* nothing.
|
|
1236
|
+
*/
|
|
1194
1237
|
terminate(): void;
|
|
1195
1238
|
isOpen(): boolean;
|
|
1196
1239
|
subscribe(tunnelId: string, mode?: SubscriptionMode): Promise<void>;
|
|
@@ -1317,6 +1360,12 @@ declare class TunnelClient {
|
|
|
1317
1360
|
*/
|
|
1318
1361
|
connectIfRunning(): boolean;
|
|
1319
1362
|
private bindDaemon;
|
|
1363
|
+
/**
|
|
1364
|
+
* Daemon loss drops every stream subscription, and a shim listener subscribes only when it is
|
|
1365
|
+
* registered. Without this, listeners registered before the loss stay silent on the new daemon.
|
|
1366
|
+
* A daemon restarted after a crash restores its tunnels under the same tunnel ids.
|
|
1367
|
+
*/
|
|
1368
|
+
private resubscribeShimListeners;
|
|
1320
1369
|
static forRemoteManagement(): Promise<TunnelClient>;
|
|
1321
1370
|
/**
|
|
1322
1371
|
* Close the WebSocket connection and cleanup.
|
|
@@ -1380,6 +1429,14 @@ declare class TunnelClient {
|
|
|
1380
1429
|
private assertClient;
|
|
1381
1430
|
}
|
|
1382
1431
|
|
|
1432
|
+
/** Starts a daemon and resolves once daemon.json names a live one: its own, or another that won daemon.lock. */
|
|
1433
|
+
type DaemonLauncher = () => Promise<void>;
|
|
1434
|
+
/**
|
|
1435
|
+
* Lets the host start the daemon its own way. The Pinggy app sets this to start the daemon in a child
|
|
1436
|
+
* process it supervises, so a crash in the native library ends that child and not the app.
|
|
1437
|
+
* Pass null to go back to the built-in start.
|
|
1438
|
+
*/
|
|
1439
|
+
declare function setDaemonLauncher(launcher: DaemonLauncher | null): void;
|
|
1383
1440
|
/**
|
|
1384
1441
|
* Read and validate daemon.json.
|
|
1385
1442
|
* Returns null if file doesn't exist, is malformed, or PID is stale.
|
|
@@ -1390,6 +1447,22 @@ declare function getDaemonInfo(): DaemonInfo | null;
|
|
|
1390
1447
|
* Check if the daemon is currently running.
|
|
1391
1448
|
*/
|
|
1392
1449
|
declare function isDaemonRunning(): boolean;
|
|
1450
|
+
/**
|
|
1451
|
+
* Deletes daemon.json and daemon.lock when they name `pid`. A host that supervises the daemon calls this
|
|
1452
|
+
* right after its daemon process exits. Until the next daemon starts, both files would name a dead PID,
|
|
1453
|
+
* and a PID the OS gives to another process would read as a live daemon.
|
|
1454
|
+
*/
|
|
1455
|
+
declare function removeDeadDaemonFiles(pid: number): void;
|
|
1456
|
+
|
|
1457
|
+
/**
|
|
1458
|
+
* Remove the state file (called on clean shutdown).
|
|
1459
|
+
*/
|
|
1460
|
+
declare function clearDaemonState(): void;
|
|
1461
|
+
/**
|
|
1462
|
+
* How many tunnels a new daemon would restore: the detached ones in the state file. 0 after a clean
|
|
1463
|
+
* shutdown, which deletes the file. A host uses this to tell a daemon that crashed from one that was stopped.
|
|
1464
|
+
*/
|
|
1465
|
+
declare function restorableTunnelCount(): number;
|
|
1393
1466
|
|
|
1394
1467
|
interface BaseLogConfig {
|
|
1395
1468
|
level?: string;
|
|
@@ -1440,4 +1513,4 @@ declare function ensureTunnelConfigDir(): string;
|
|
|
1440
1513
|
*/
|
|
1441
1514
|
declare function getDaemonInfoPath(): string;
|
|
1442
1515
|
|
|
1443
|
-
export { type AdditionalForwarding, type DaemonInfo, type DeviceAgentError, DeviceAgentState, type DeviceAgentStatus, type DisconnectListener, type ErrorListener, type FinalConfig, type ITunnelManager, type ManagedTunnel, type ReconnectingListener, type ReconnectionCompletedListener, type ReconnectionFailedListener, RemoteManagementUnauthorizedError, type SavedTunnelConfig, type StartListener, type StatsListener, type Status, type StorageLogger, TUNNEL_CONFIG_V1_KEYS, TunnelClient, type TunnelConfigV1, TunnelConfigV1Schema, TunnelErrorCodeType, type TunnelList, TunnelManager, TunnelOperations, type TunnelResponse, TunnelStateType, type TunnelStatus, TunnelWarningCode, type TunnelWorkerErrorListner, type Warning, type WillReconnectListener, bulkReplace, closeRemoteManagement, configureStorageLogger, deleteConfig, enablePackageLogging, ensureTunnelConfigDir, findConfig, findConfigByName, getAutoStartConfigs, getDaemonInfo, getDaemonInfoPath, getPinggyConfigDir, getRemoteManagementState, getTunnelConfigDir, initiateRemoteManagement, isDaemonRunning, listSavedConfigs, loadConfigByName, sanitizeName, saveConfig, startRemoteManagement, updateConfigAutoStart, updateTunnelConfig, upsertConfig, validateName, validateNameForStorage, validateNameStrict };
|
|
1516
|
+
export { type AdditionalForwarding, type DaemonHandle, DaemonHost, type DaemonInfo, type DaemonLauncher, DaemonLockHeldError, type DeviceAgentError, DeviceAgentState, type DeviceAgentStatus, type DisconnectListener, type ErrorListener, type FinalConfig, type ITunnelManager, type ManagedTunnel, type ReconnectingListener, type ReconnectionCompletedListener, type ReconnectionFailedListener, RemoteManagementUnauthorizedError, type RunDaemonOptions, type SavedTunnelConfig, type StartListener, type StatsListener, type Status, type StorageLogger, TUNNEL_CONFIG_V1_KEYS, TunnelClient, type TunnelConfigV1, TunnelConfigV1Schema, TunnelErrorCodeType, type TunnelList, TunnelManager, TunnelOperations, type TunnelResponse, TunnelStateType, type TunnelStatus, TunnelWarningCode, type TunnelWorkerErrorListner, type Warning, type WillReconnectListener, bulkReplace, clearDaemonState, closeRemoteManagement, configureStorageLogger, deleteConfig, enablePackageLogging, ensureTunnelConfigDir, findConfig, findConfigByName, getAutoStartConfigs, getDaemonInfo, getDaemonInfoPath, getPinggyConfigDir, getRemoteManagementState, getTunnelConfigDir, initiateRemoteManagement, isDaemonRunning, listSavedConfigs, loadConfigByName, removeDeadDaemonFiles, restorableTunnelCount, runDaemonChild, sanitizeName, saveConfig, setDaemonLauncher, startRemoteManagement, updateConfigAutoStart, updateTunnelConfig, upsertConfig, validateName, validateNameForStorage, validateNameStrict };
|
package/dist/index.js
CHANGED
|
@@ -1,16 +1,21 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
|
+
DaemonLockHeldError,
|
|
3
4
|
RemoteManagementUnauthorizedError,
|
|
4
5
|
TUNNEL_CONFIG_V1_KEYS,
|
|
5
6
|
TunnelClient,
|
|
6
7
|
TunnelConfigV1Schema,
|
|
7
8
|
TunnelOperations,
|
|
9
|
+
clearDaemonState,
|
|
8
10
|
closeRemoteManagement,
|
|
9
11
|
getRemoteManagementState,
|
|
10
12
|
initiateRemoteManagement,
|
|
13
|
+
restorableTunnelCount,
|
|
14
|
+
runDaemonChild,
|
|
11
15
|
startRemoteManagement
|
|
12
|
-
} from "./chunk-
|
|
13
|
-
import "./chunk-
|
|
16
|
+
} from "./chunk-W47AYOH2.js";
|
|
17
|
+
import "./chunk-VD5ZFCZW.js";
|
|
18
|
+
import "./chunk-P54K7NPF.js";
|
|
14
19
|
import {
|
|
15
20
|
bulkReplace,
|
|
16
21
|
configureStorageLogger,
|
|
@@ -29,15 +34,19 @@ import {
|
|
|
29
34
|
validateNameForStorage,
|
|
30
35
|
validateNameStrict
|
|
31
36
|
} from "./chunk-3IPMFCEF.js";
|
|
37
|
+
import "./chunk-XZ64ZAGO.js";
|
|
32
38
|
import {
|
|
33
39
|
TunnelManager
|
|
34
40
|
} from "./chunk-5HBGVJSW.js";
|
|
35
41
|
import "./chunk-UB26QJ4T.js";
|
|
36
42
|
import {
|
|
37
43
|
getDaemonInfo,
|
|
38
|
-
isDaemonRunning
|
|
39
|
-
|
|
44
|
+
isDaemonRunning,
|
|
45
|
+
removeDeadDaemonFiles,
|
|
46
|
+
setDaemonLauncher
|
|
47
|
+
} from "./chunk-RYO5T2JT.js";
|
|
40
48
|
import {
|
|
49
|
+
DaemonHost,
|
|
41
50
|
DeviceAgentState
|
|
42
51
|
} from "./chunk-MKGD2QAI.js";
|
|
43
52
|
import {
|
|
@@ -146,12 +155,14 @@ async function verifyAndLoad() {
|
|
|
146
155
|
process.exit(1);
|
|
147
156
|
}
|
|
148
157
|
}
|
|
149
|
-
await import("./main-
|
|
158
|
+
await import("./main-FCIOVX5I.js");
|
|
150
159
|
}
|
|
151
160
|
verifyAndLoad().catch((err) => {
|
|
152
161
|
printer_default.fatal(`Failed to start CLI:, ${err}`);
|
|
153
162
|
});
|
|
154
163
|
export {
|
|
164
|
+
DaemonHost,
|
|
165
|
+
DaemonLockHeldError,
|
|
155
166
|
DeviceAgentState,
|
|
156
167
|
RemoteManagementUnauthorizedError,
|
|
157
168
|
TUNNEL_CONFIG_V1_KEYS,
|
|
@@ -163,6 +174,7 @@ export {
|
|
|
163
174
|
TunnelStateType,
|
|
164
175
|
TunnelWarningCode,
|
|
165
176
|
bulkReplace,
|
|
177
|
+
clearDaemonState,
|
|
166
178
|
closeRemoteManagement,
|
|
167
179
|
configureStorageLogger,
|
|
168
180
|
deleteConfig,
|
|
@@ -180,8 +192,12 @@ export {
|
|
|
180
192
|
isDaemonRunning,
|
|
181
193
|
listSavedConfigs,
|
|
182
194
|
loadConfigByName,
|
|
195
|
+
removeDeadDaemonFiles,
|
|
196
|
+
restorableTunnelCount,
|
|
197
|
+
runDaemonChild,
|
|
183
198
|
sanitizeName,
|
|
184
199
|
saveConfig,
|
|
200
|
+
setDaemonLauncher,
|
|
185
201
|
startRemoteManagement,
|
|
186
202
|
updateConfigAutoStart,
|
|
187
203
|
updateTunnelConfig,
|
|
@@ -1,30 +1,27 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
3
|
-
runDaemonChild
|
|
4
|
-
} from "./chunk-LF6WMFWT.js";
|
|
5
2
|
import {
|
|
6
3
|
RemoteManagementUnauthorizedError,
|
|
7
4
|
TunnelOperations,
|
|
8
5
|
closeRemoteManagement,
|
|
9
6
|
getRemoteManagementState,
|
|
10
|
-
initiateRemoteManagement
|
|
11
|
-
|
|
7
|
+
initiateRemoteManagement,
|
|
8
|
+
runDaemonChild
|
|
9
|
+
} from "./chunk-W47AYOH2.js";
|
|
12
10
|
import "./chunk-VD5ZFCZW.js";
|
|
13
|
-
import "./chunk-
|
|
11
|
+
import "./chunk-P54K7NPF.js";
|
|
14
12
|
import "./chunk-3IPMFCEF.js";
|
|
15
13
|
import "./chunk-XZ64ZAGO.js";
|
|
16
14
|
import {
|
|
17
15
|
TunnelManager
|
|
18
16
|
} from "./chunk-5HBGVJSW.js";
|
|
19
17
|
import "./chunk-UB26QJ4T.js";
|
|
20
|
-
import "./chunk-HJECJ7LC.js";
|
|
21
18
|
import {
|
|
22
19
|
ensureDaemonRunning,
|
|
23
20
|
getActiveTunnelSummaries,
|
|
24
21
|
getDaemonInfo,
|
|
25
22
|
getInProcessDaemonHandle,
|
|
26
23
|
isDaemonRunning
|
|
27
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-RYO5T2JT.js";
|
|
28
25
|
import {
|
|
29
26
|
DaemonHost
|
|
30
27
|
} from "./chunk-MKGD2QAI.js";
|
|
@@ -1,13 +1,23 @@
|
|
|
1
1
|
import {
|
|
2
|
+
InstallKind,
|
|
2
3
|
UpdateError,
|
|
3
4
|
acquireUpdateLock,
|
|
4
5
|
assetNameFor,
|
|
6
|
+
backgroundInstallKind,
|
|
7
|
+
canReplaceItself,
|
|
8
|
+
createInstallProbe,
|
|
5
9
|
createUpdateTarget,
|
|
10
|
+
daemonIpcVersion,
|
|
11
|
+
detectInstallKind,
|
|
6
12
|
downloadRelease,
|
|
13
|
+
getDaemonInfo,
|
|
7
14
|
isNewerVersion,
|
|
8
15
|
isReleaseComplete,
|
|
9
16
|
isUpdateLockOurs,
|
|
17
|
+
nowEpochSeconds,
|
|
10
18
|
readBinaryIpcVersion,
|
|
19
|
+
readUpdateState,
|
|
20
|
+
recordLatestVersion,
|
|
11
21
|
releaseUpdateLock,
|
|
12
22
|
removeQuietly,
|
|
13
23
|
removeStaleUnixFiles,
|
|
@@ -15,22 +25,10 @@ import {
|
|
|
15
25
|
resolveLatestNpmVersion,
|
|
16
26
|
resolveLatestTag,
|
|
17
27
|
runPinggyBinary,
|
|
18
|
-
versionFromTag
|
|
19
|
-
} from "./chunk-HJECJ7LC.js";
|
|
20
|
-
import {
|
|
21
|
-
InstallKind,
|
|
22
|
-
backgroundInstallKind,
|
|
23
|
-
canReplaceItself,
|
|
24
|
-
createInstallProbe,
|
|
25
|
-
daemonIpcVersion,
|
|
26
|
-
detectInstallKind,
|
|
27
|
-
getDaemonInfo,
|
|
28
|
-
nowEpochSeconds,
|
|
29
|
-
readUpdateState,
|
|
30
|
-
recordLatestVersion,
|
|
31
28
|
unixLayoutPaths,
|
|
29
|
+
versionFromTag,
|
|
32
30
|
writeUpdateState
|
|
33
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-RYO5T2JT.js";
|
|
34
32
|
import "./chunk-MKGD2QAI.js";
|
|
35
33
|
import {
|
|
36
34
|
errorMessage,
|
package/package.json
CHANGED
|
@@ -519,8 +519,9 @@ function Install-Pinggy {
|
|
|
519
519
|
}
|
|
520
520
|
|
|
521
521
|
# Runs $pinggyPath by its full path, with -b, as Invoke-DeviceLogin does. connect reads DEVICE_AGENT_TOKEN
|
|
522
|
-
# from the environment it inherits
|
|
523
|
-
#
|
|
522
|
+
# from the environment it inherits. It reads the console for 1 question, whether the dashboard may reach this
|
|
523
|
+
# machine's files. With no console it asks nothing and leaves file access on. The token leaves the environment
|
|
524
|
+
# before the service question, so no later command inherits it.
|
|
524
525
|
function Invoke-DeviceConnect {
|
|
525
526
|
$connectArguments = @('device', 'connect', '-b')
|
|
526
527
|
if ($env:PINGGY_MANAGE) { $connectArguments += @('--manage', $env:PINGGY_MANAGE) }
|
|
@@ -20,7 +20,8 @@
|
|
|
20
20
|
# Setting, from the dashboard's command:
|
|
21
21
|
# DEVICE_AGENT_TOKEN a device token. `pinggy device connect` runs with no email and no code. Every update question
|
|
22
22
|
# is still asked, and a pinggy older than 0.6.2 ignores the token. The token reaches the CLI in
|
|
23
|
-
# its environment, never on a command line. Set it on sh, not on curl, so curl never holds it
|
|
23
|
+
# its environment, never on a command line. Set it on sh, not on curl, so curl never holds it.
|
|
24
|
+
# In a terminal, connect asks whether the dashboard may reach this machine's files
|
|
24
25
|
#
|
|
25
26
|
# Overrides, for dev and tests:
|
|
26
27
|
# PINGGY_VERSION a release tag, such as v0.6.1. Default: the version pinggy.io publishes, or for an npm copy the
|
|
@@ -836,18 +837,23 @@ offer_daemon_restart() {
|
|
|
836
837
|
}
|
|
837
838
|
|
|
838
839
|
# Runs $pinggy_path, the copy this script installed, updated or kept, by its full path, so another pinggy earlier on
|
|
839
|
-
# PATH does not answer. connect reads DEVICE_AGENT_TOKEN from the environment this script passes on
|
|
840
|
-
#
|
|
841
|
-
#
|
|
842
|
-
#
|
|
840
|
+
# PATH does not answer. connect reads DEVICE_AGENT_TOKEN from the environment this script passes on. It asks 1
|
|
841
|
+
# question, whether the dashboard may reach this machine's files, so it reads /dev/tty when there is one. With none it
|
|
842
|
+
# reads /dev/null, asks nothing, and leaves file access on. Never this script's stdin, which under `curl | sh` holds
|
|
843
|
+
# the rest of the script. -b is the default now. It is passed anyway, so an older pinggy the user kept runs the agent
|
|
844
|
+
# in its daemon too. The token leaves the environment before the service question, so no later command inherits it.
|
|
843
845
|
connect_with_device_token() {
|
|
844
846
|
export DEVICE_AGENT_TOKEN
|
|
845
847
|
say ""
|
|
848
|
+
connect_input=/dev/null
|
|
849
|
+
if has_terminal; then
|
|
850
|
+
connect_input=/dev/tty
|
|
851
|
+
fi
|
|
846
852
|
status=0
|
|
847
853
|
if [ -n "${PINGGY_MANAGE:-}" ]; then
|
|
848
|
-
"$pinggy_path" device connect -b --manage "$PINGGY_MANAGE"
|
|
854
|
+
"$pinggy_path" device connect -b --manage "$PINGGY_MANAGE" <"$connect_input" || status=$?
|
|
849
855
|
else
|
|
850
|
-
"$pinggy_path" device connect -b
|
|
856
|
+
"$pinggy_path" device connect -b <"$connect_input" || status=$?
|
|
851
857
|
fi
|
|
852
858
|
unset DEVICE_AGENT_TOKEN
|
|
853
859
|
if [ "$status" -ne 0 ]; then
|