pinggy 0.5.2 → 0.5.5
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 +4 -0
- package/dist/{TunnelManager-OPUMAZFX.js → TunnelManager-ZSVX7U3Z.js} +2 -2
- package/dist/{TunnelTui-QZEWWH2H.js → TunnelTui-S35BNVPO.js} +85 -16
- package/dist/{chunk-LFK74BMU.js → chunk-NBR2L6LW.js} +40 -12
- package/dist/{chunk-7G6SJEEA.js → chunk-P7WNBN7F.js} +1 -1
- package/dist/{chunk-DLNUDW6G.js → chunk-PQSLSIDA.js} +67 -13
- package/dist/{chunk-C3ZMLIC4.js → chunk-UX64XCC2.js} +251 -77
- package/dist/{chunk-BFARGPGP.js → chunk-YTJEV27N.js} +12 -2
- package/dist/{chunk-WM7I57AA.js → chunk-YWXADADB.js} +1 -1
- package/dist/{configStore-HP3NXPH4.js → configStore-2AZRILVC.js} +2 -2
- package/dist/{daemonChild-6QA4AVAN.js → daemonChild-ZACX7V6J.js} +11 -6
- package/dist/index.cjs +459 -120
- package/dist/index.d.cts +65 -19
- package/dist/index.d.ts +65 -19
- package/dist/index.js +10 -6
- package/dist/{ipcClient-LZQCCNMR.js → ipcClient-XRL2WUUM.js} +1 -1
- package/dist/{main-K6ZEWZQ7.js → main-KG3Q4LXI.js} +9 -6
- package/dist/workers/file_serve_worker.js +1 -1
- package/jest.config.cjs +1 -0
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { TunnelConfigurationV1, TunnelUsageType, TunnelInstance, TunnelType, RemoteManagementConfig } from '@pinggy/pinggy';
|
|
2
|
+
import { TunnelConfigurationV1, TunnelUsageType, TunnelInstance, TunnelType, HaProxyVersion, RemoteManagementConfig } from '@pinggy/pinggy';
|
|
3
3
|
export { TunnelConfigurationV1 } from '@pinggy/pinggy';
|
|
4
4
|
import { Worker } from 'node:worker_threads';
|
|
5
5
|
import { z } from 'zod';
|
|
@@ -297,12 +297,24 @@ declare class TunnelManager implements ITunnelManager {
|
|
|
297
297
|
* @throws Error if neither configId nor tunnelId is provided, or if tunnel is not found
|
|
298
298
|
*/
|
|
299
299
|
getTunnelConfig(configId?: string, tunnelId?: string): Promise<TunnelConfigurationV1>;
|
|
300
|
+
/**
|
|
301
|
+
* Stop a tunnel instance and wait for the stop to settle, capped by a
|
|
302
|
+
* timeout. Failure is logged, not thrown: the caller replaces the
|
|
303
|
+
* instance either way and a hung stop must not block that forever.
|
|
304
|
+
*/
|
|
305
|
+
private stopInstanceGuarded;
|
|
300
306
|
/**
|
|
301
307
|
* Restarts a tunnel with its current configuration.
|
|
302
308
|
* This function will stop the tunnel if it's running and start it again.
|
|
303
309
|
* All configurations including additional forwarding rules are preserved.
|
|
304
310
|
*/
|
|
305
311
|
restartTunnel(tunnelid: string): Promise<void>;
|
|
312
|
+
/**
|
|
313
|
+
* Carry lifecycle state from a replaced tunnel over to its replacement:
|
|
314
|
+
* keep createdAt, start the replacement if the old tunnel was running,
|
|
315
|
+
* otherwise keep it stopped with the original timestamps.
|
|
316
|
+
*/
|
|
317
|
+
private applyPreservedLifecycle;
|
|
306
318
|
/**
|
|
307
319
|
* Updates the configuration of an existing tunnel.
|
|
308
320
|
*
|
|
@@ -571,13 +583,13 @@ declare const TunnelConfigV1Schema: z.ZodObject<{
|
|
|
571
583
|
forwarding: z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodObject<{
|
|
572
584
|
listenAddress: z.ZodOptional<z.ZodString>;
|
|
573
585
|
address: z.ZodString;
|
|
574
|
-
type: z.ZodEnum<{
|
|
586
|
+
type: z.ZodDefault<z.ZodEnum<{
|
|
575
587
|
http: TunnelType.Http;
|
|
576
588
|
tcp: TunnelType.Tcp;
|
|
577
589
|
tls: TunnelType.Tls;
|
|
578
590
|
udp: TunnelType.Udp;
|
|
579
591
|
tlstcp: TunnelType.TlsTcp;
|
|
580
|
-
}
|
|
592
|
+
}>>;
|
|
581
593
|
}, z.core.$strip>>]>;
|
|
582
594
|
ipWhitelist: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
583
595
|
basicAuth: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
@@ -599,18 +611,12 @@ declare const TunnelConfigV1Schema: z.ZodObject<{
|
|
|
599
611
|
httpsOnly: z.ZodOptional<z.ZodBoolean>;
|
|
600
612
|
originalRequestUrl: z.ZodOptional<z.ZodBoolean>;
|
|
601
613
|
allowPreflight: z.ZodOptional<z.ZodBoolean>;
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
remoteManagement: z.ZodOptional<z.ZodObject<{
|
|
609
|
-
serverUrl: z.ZodString;
|
|
610
|
-
apiKey: z.ZodString;
|
|
611
|
-
}, z.core.$strip>>;
|
|
612
|
-
noTui: z.ZodOptional<z.ZodBoolean>;
|
|
613
|
-
}, z.core.$catchall<z.ZodUnknown>>>;
|
|
614
|
+
haProxy: z.ZodOptional<z.ZodEnum<{
|
|
615
|
+
v1: HaProxyVersion.V1;
|
|
616
|
+
v2: HaProxyVersion.V2;
|
|
617
|
+
}>>;
|
|
618
|
+
serve: z.ZodOptional<z.ZodString>;
|
|
619
|
+
optional: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
614
620
|
}, z.core.$strip>;
|
|
615
621
|
type TunnelConfigV1 = z.infer<typeof TunnelConfigV1Schema>;
|
|
616
622
|
declare const TUNNEL_CONFIG_V1_KEYS: (keyof TunnelConfigV1)[];
|
|
@@ -682,8 +688,18 @@ type ResolveLogPathResponse = {
|
|
|
682
688
|
} | {
|
|
683
689
|
status: "not-found";
|
|
684
690
|
};
|
|
691
|
+
declare const DaemonHost: {
|
|
692
|
+
readonly CLI: "cli";
|
|
693
|
+
readonly APP: "app";
|
|
694
|
+
};
|
|
695
|
+
type DaemonHost = typeof DaemonHost[keyof typeof DaemonHost];
|
|
696
|
+
declare const ShutdownStatus: {
|
|
697
|
+
readonly ShuttingDown: "shutting_down";
|
|
698
|
+
readonly RefusedInApp: "refused_in_app";
|
|
699
|
+
};
|
|
700
|
+
type ShutdownStatus = typeof ShutdownStatus[keyof typeof ShutdownStatus];
|
|
685
701
|
interface ShutdownResponse {
|
|
686
|
-
status:
|
|
702
|
+
status: ShutdownStatus;
|
|
687
703
|
errors: string[];
|
|
688
704
|
}
|
|
689
705
|
type LogLevel = "debug" | "info" | "error";
|
|
@@ -737,6 +753,7 @@ type IPCRoutes = {
|
|
|
737
753
|
[Route.RestartTunnel]: {
|
|
738
754
|
req: {
|
|
739
755
|
tunnelid: string;
|
|
756
|
+
noWait?: boolean;
|
|
740
757
|
};
|
|
741
758
|
res: TunnelResponse | ErrorResponse;
|
|
742
759
|
};
|
|
@@ -899,7 +916,7 @@ declare class IPCClient {
|
|
|
899
916
|
startTunnel(name: string, mode: SessionMode): Promise<TunnelResponseV2 | ErrorResponse>;
|
|
900
917
|
startTunnelWithConfig(config: TunnelConfigV1, mode: SessionMode, noWait?: boolean): Promise<TunnelResponseV2 | ErrorResponse>;
|
|
901
918
|
stopTunnel(tunnelid: string): Promise<TunnelResponse | ErrorResponse>;
|
|
902
|
-
restartTunnel(tunnelid: string): Promise<TunnelResponse | ErrorResponse>;
|
|
919
|
+
restartTunnel(tunnelid: string, noWait?: boolean): Promise<TunnelResponse | ErrorResponse>;
|
|
903
920
|
startTunnelV1(config: TunnelConfig, mode: SessionMode, noWait?: boolean): Promise<TunnelResponse | ErrorResponse>;
|
|
904
921
|
listTunnelsV1(): Promise<TunnelResponse[] | ErrorResponse>;
|
|
905
922
|
updateConfig(config: TunnelConfig, noWait?: boolean): Promise<TunnelResponse | ErrorResponse>;
|
|
@@ -1027,6 +1044,11 @@ declare class DaemonHealth {
|
|
|
1027
1044
|
private reconnectedCallbacks;
|
|
1028
1045
|
constructor(getIpc: () => IPCClient | null, stream: WsStream);
|
|
1029
1046
|
bindPid(pid: number): void;
|
|
1047
|
+
/**
|
|
1048
|
+
* Forget a previous loss verdict. Called when the client re-binds to a
|
|
1049
|
+
* live daemon via ensureDaemon():
|
|
1050
|
+
*/
|
|
1051
|
+
reset(): void;
|
|
1030
1052
|
isLost(): boolean;
|
|
1031
1053
|
onLost(cb: DaemonLostCallback): void;
|
|
1032
1054
|
onReconnecting(cb: DaemonReconnectingCallback): void;
|
|
@@ -1078,8 +1100,14 @@ declare class TunnelClient {
|
|
|
1078
1100
|
handleRemoveStoppedTunnelByTunnelId(tunnelId: string): boolean | ErrorResponse;
|
|
1079
1101
|
handleRemoveStoppedTunnelByConfigId(configId: string): boolean | ErrorResponse;
|
|
1080
1102
|
handleGet(tunnelId: string): Promise<TunnelResponse | ErrorResponse>;
|
|
1081
|
-
handleRestart(tunnelId: string): Promise<TunnelResponse | ErrorResponse>;
|
|
1103
|
+
handleRestart(tunnelId: string, noWait?: boolean): Promise<TunnelResponse | ErrorResponse>;
|
|
1082
1104
|
shutdown(): Promise<void>;
|
|
1105
|
+
/**
|
|
1106
|
+
* Tear down the daemon hosted in THIS process, if any. Stops all tunnels
|
|
1107
|
+
* and removes daemon.json + daemon-state.json so the next CLI run doesn't
|
|
1108
|
+
* "crash-recover" tunnels that died with the host application.
|
|
1109
|
+
*/
|
|
1110
|
+
shutdownInProcessDaemon(): boolean;
|
|
1083
1111
|
getLogLevel(): Promise<string>;
|
|
1084
1112
|
setLogLevel(level: "debug" | "info" | "error"): Promise<void>;
|
|
1085
1113
|
getTunnelLogging(): Promise<boolean>;
|
|
@@ -1110,6 +1138,24 @@ declare class TunnelClient {
|
|
|
1110
1138
|
private assertClient;
|
|
1111
1139
|
}
|
|
1112
1140
|
|
|
1141
|
+
interface DaemonInfo {
|
|
1142
|
+
pid: number;
|
|
1143
|
+
port: number;
|
|
1144
|
+
startedAt: string;
|
|
1145
|
+
host?: DaemonHost;
|
|
1146
|
+
}
|
|
1147
|
+
|
|
1148
|
+
/**
|
|
1149
|
+
* Read and validate daemon.json.
|
|
1150
|
+
* Returns null if file doesn't exist, is malformed, or PID is stale.
|
|
1151
|
+
* Automatically cleans up stale daemon.json.
|
|
1152
|
+
*/
|
|
1153
|
+
declare function getDaemonInfo(): DaemonInfo | null;
|
|
1154
|
+
/**
|
|
1155
|
+
* Check if the daemon is currently running.
|
|
1156
|
+
*/
|
|
1157
|
+
declare function isDaemonRunning(): boolean;
|
|
1158
|
+
|
|
1113
1159
|
interface BaseLogConfig {
|
|
1114
1160
|
level?: string;
|
|
1115
1161
|
filePath?: string;
|
|
@@ -1278,4 +1324,4 @@ declare function ensureTunnelConfigDir(): string;
|
|
|
1278
1324
|
*/
|
|
1279
1325
|
declare function getDaemonInfoPath(): string;
|
|
1280
1326
|
|
|
1281
|
-
export { type AdditionalForwarding, 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, getDaemonInfoPath, getPinggyConfigDir, getRemoteManagementState, getTunnelConfigDir, initiateRemoteManagement, listSavedConfigs, loadConfigByName, sanitizeName, saveConfig, startRemoteManagement, updateConfigAutoStart, updateTunnelConfig, upsertConfig, validateName, validateNameForStorage, validateNameStrict };
|
|
1327
|
+
export { type AdditionalForwarding, type DaemonInfo, 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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { TunnelConfigurationV1, TunnelUsageType, TunnelInstance, TunnelType, RemoteManagementConfig } from '@pinggy/pinggy';
|
|
2
|
+
import { TunnelConfigurationV1, TunnelUsageType, TunnelInstance, TunnelType, HaProxyVersion, RemoteManagementConfig } from '@pinggy/pinggy';
|
|
3
3
|
export { TunnelConfigurationV1 } from '@pinggy/pinggy';
|
|
4
4
|
import { Worker } from 'node:worker_threads';
|
|
5
5
|
import { z } from 'zod';
|
|
@@ -297,12 +297,24 @@ declare class TunnelManager implements ITunnelManager {
|
|
|
297
297
|
* @throws Error if neither configId nor tunnelId is provided, or if tunnel is not found
|
|
298
298
|
*/
|
|
299
299
|
getTunnelConfig(configId?: string, tunnelId?: string): Promise<TunnelConfigurationV1>;
|
|
300
|
+
/**
|
|
301
|
+
* Stop a tunnel instance and wait for the stop to settle, capped by a
|
|
302
|
+
* timeout. Failure is logged, not thrown: the caller replaces the
|
|
303
|
+
* instance either way and a hung stop must not block that forever.
|
|
304
|
+
*/
|
|
305
|
+
private stopInstanceGuarded;
|
|
300
306
|
/**
|
|
301
307
|
* Restarts a tunnel with its current configuration.
|
|
302
308
|
* This function will stop the tunnel if it's running and start it again.
|
|
303
309
|
* All configurations including additional forwarding rules are preserved.
|
|
304
310
|
*/
|
|
305
311
|
restartTunnel(tunnelid: string): Promise<void>;
|
|
312
|
+
/**
|
|
313
|
+
* Carry lifecycle state from a replaced tunnel over to its replacement:
|
|
314
|
+
* keep createdAt, start the replacement if the old tunnel was running,
|
|
315
|
+
* otherwise keep it stopped with the original timestamps.
|
|
316
|
+
*/
|
|
317
|
+
private applyPreservedLifecycle;
|
|
306
318
|
/**
|
|
307
319
|
* Updates the configuration of an existing tunnel.
|
|
308
320
|
*
|
|
@@ -571,13 +583,13 @@ declare const TunnelConfigV1Schema: z.ZodObject<{
|
|
|
571
583
|
forwarding: z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodObject<{
|
|
572
584
|
listenAddress: z.ZodOptional<z.ZodString>;
|
|
573
585
|
address: z.ZodString;
|
|
574
|
-
type: z.ZodEnum<{
|
|
586
|
+
type: z.ZodDefault<z.ZodEnum<{
|
|
575
587
|
http: TunnelType.Http;
|
|
576
588
|
tcp: TunnelType.Tcp;
|
|
577
589
|
tls: TunnelType.Tls;
|
|
578
590
|
udp: TunnelType.Udp;
|
|
579
591
|
tlstcp: TunnelType.TlsTcp;
|
|
580
|
-
}
|
|
592
|
+
}>>;
|
|
581
593
|
}, z.core.$strip>>]>;
|
|
582
594
|
ipWhitelist: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
583
595
|
basicAuth: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
@@ -599,18 +611,12 @@ declare const TunnelConfigV1Schema: z.ZodObject<{
|
|
|
599
611
|
httpsOnly: z.ZodOptional<z.ZodBoolean>;
|
|
600
612
|
originalRequestUrl: z.ZodOptional<z.ZodBoolean>;
|
|
601
613
|
allowPreflight: z.ZodOptional<z.ZodBoolean>;
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
remoteManagement: z.ZodOptional<z.ZodObject<{
|
|
609
|
-
serverUrl: z.ZodString;
|
|
610
|
-
apiKey: z.ZodString;
|
|
611
|
-
}, z.core.$strip>>;
|
|
612
|
-
noTui: z.ZodOptional<z.ZodBoolean>;
|
|
613
|
-
}, z.core.$catchall<z.ZodUnknown>>>;
|
|
614
|
+
haProxy: z.ZodOptional<z.ZodEnum<{
|
|
615
|
+
v1: HaProxyVersion.V1;
|
|
616
|
+
v2: HaProxyVersion.V2;
|
|
617
|
+
}>>;
|
|
618
|
+
serve: z.ZodOptional<z.ZodString>;
|
|
619
|
+
optional: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
614
620
|
}, z.core.$strip>;
|
|
615
621
|
type TunnelConfigV1 = z.infer<typeof TunnelConfigV1Schema>;
|
|
616
622
|
declare const TUNNEL_CONFIG_V1_KEYS: (keyof TunnelConfigV1)[];
|
|
@@ -682,8 +688,18 @@ type ResolveLogPathResponse = {
|
|
|
682
688
|
} | {
|
|
683
689
|
status: "not-found";
|
|
684
690
|
};
|
|
691
|
+
declare const DaemonHost: {
|
|
692
|
+
readonly CLI: "cli";
|
|
693
|
+
readonly APP: "app";
|
|
694
|
+
};
|
|
695
|
+
type DaemonHost = typeof DaemonHost[keyof typeof DaemonHost];
|
|
696
|
+
declare const ShutdownStatus: {
|
|
697
|
+
readonly ShuttingDown: "shutting_down";
|
|
698
|
+
readonly RefusedInApp: "refused_in_app";
|
|
699
|
+
};
|
|
700
|
+
type ShutdownStatus = typeof ShutdownStatus[keyof typeof ShutdownStatus];
|
|
685
701
|
interface ShutdownResponse {
|
|
686
|
-
status:
|
|
702
|
+
status: ShutdownStatus;
|
|
687
703
|
errors: string[];
|
|
688
704
|
}
|
|
689
705
|
type LogLevel = "debug" | "info" | "error";
|
|
@@ -737,6 +753,7 @@ type IPCRoutes = {
|
|
|
737
753
|
[Route.RestartTunnel]: {
|
|
738
754
|
req: {
|
|
739
755
|
tunnelid: string;
|
|
756
|
+
noWait?: boolean;
|
|
740
757
|
};
|
|
741
758
|
res: TunnelResponse | ErrorResponse;
|
|
742
759
|
};
|
|
@@ -899,7 +916,7 @@ declare class IPCClient {
|
|
|
899
916
|
startTunnel(name: string, mode: SessionMode): Promise<TunnelResponseV2 | ErrorResponse>;
|
|
900
917
|
startTunnelWithConfig(config: TunnelConfigV1, mode: SessionMode, noWait?: boolean): Promise<TunnelResponseV2 | ErrorResponse>;
|
|
901
918
|
stopTunnel(tunnelid: string): Promise<TunnelResponse | ErrorResponse>;
|
|
902
|
-
restartTunnel(tunnelid: string): Promise<TunnelResponse | ErrorResponse>;
|
|
919
|
+
restartTunnel(tunnelid: string, noWait?: boolean): Promise<TunnelResponse | ErrorResponse>;
|
|
903
920
|
startTunnelV1(config: TunnelConfig, mode: SessionMode, noWait?: boolean): Promise<TunnelResponse | ErrorResponse>;
|
|
904
921
|
listTunnelsV1(): Promise<TunnelResponse[] | ErrorResponse>;
|
|
905
922
|
updateConfig(config: TunnelConfig, noWait?: boolean): Promise<TunnelResponse | ErrorResponse>;
|
|
@@ -1027,6 +1044,11 @@ declare class DaemonHealth {
|
|
|
1027
1044
|
private reconnectedCallbacks;
|
|
1028
1045
|
constructor(getIpc: () => IPCClient | null, stream: WsStream);
|
|
1029
1046
|
bindPid(pid: number): void;
|
|
1047
|
+
/**
|
|
1048
|
+
* Forget a previous loss verdict. Called when the client re-binds to a
|
|
1049
|
+
* live daemon via ensureDaemon():
|
|
1050
|
+
*/
|
|
1051
|
+
reset(): void;
|
|
1030
1052
|
isLost(): boolean;
|
|
1031
1053
|
onLost(cb: DaemonLostCallback): void;
|
|
1032
1054
|
onReconnecting(cb: DaemonReconnectingCallback): void;
|
|
@@ -1078,8 +1100,14 @@ declare class TunnelClient {
|
|
|
1078
1100
|
handleRemoveStoppedTunnelByTunnelId(tunnelId: string): boolean | ErrorResponse;
|
|
1079
1101
|
handleRemoveStoppedTunnelByConfigId(configId: string): boolean | ErrorResponse;
|
|
1080
1102
|
handleGet(tunnelId: string): Promise<TunnelResponse | ErrorResponse>;
|
|
1081
|
-
handleRestart(tunnelId: string): Promise<TunnelResponse | ErrorResponse>;
|
|
1103
|
+
handleRestart(tunnelId: string, noWait?: boolean): Promise<TunnelResponse | ErrorResponse>;
|
|
1082
1104
|
shutdown(): Promise<void>;
|
|
1105
|
+
/**
|
|
1106
|
+
* Tear down the daemon hosted in THIS process, if any. Stops all tunnels
|
|
1107
|
+
* and removes daemon.json + daemon-state.json so the next CLI run doesn't
|
|
1108
|
+
* "crash-recover" tunnels that died with the host application.
|
|
1109
|
+
*/
|
|
1110
|
+
shutdownInProcessDaemon(): boolean;
|
|
1083
1111
|
getLogLevel(): Promise<string>;
|
|
1084
1112
|
setLogLevel(level: "debug" | "info" | "error"): Promise<void>;
|
|
1085
1113
|
getTunnelLogging(): Promise<boolean>;
|
|
@@ -1110,6 +1138,24 @@ declare class TunnelClient {
|
|
|
1110
1138
|
private assertClient;
|
|
1111
1139
|
}
|
|
1112
1140
|
|
|
1141
|
+
interface DaemonInfo {
|
|
1142
|
+
pid: number;
|
|
1143
|
+
port: number;
|
|
1144
|
+
startedAt: string;
|
|
1145
|
+
host?: DaemonHost;
|
|
1146
|
+
}
|
|
1147
|
+
|
|
1148
|
+
/**
|
|
1149
|
+
* Read and validate daemon.json.
|
|
1150
|
+
* Returns null if file doesn't exist, is malformed, or PID is stale.
|
|
1151
|
+
* Automatically cleans up stale daemon.json.
|
|
1152
|
+
*/
|
|
1153
|
+
declare function getDaemonInfo(): DaemonInfo | null;
|
|
1154
|
+
/**
|
|
1155
|
+
* Check if the daemon is currently running.
|
|
1156
|
+
*/
|
|
1157
|
+
declare function isDaemonRunning(): boolean;
|
|
1158
|
+
|
|
1113
1159
|
interface BaseLogConfig {
|
|
1114
1160
|
level?: string;
|
|
1115
1161
|
filePath?: string;
|
|
@@ -1278,4 +1324,4 @@ declare function ensureTunnelConfigDir(): string;
|
|
|
1278
1324
|
*/
|
|
1279
1325
|
declare function getDaemonInfoPath(): string;
|
|
1280
1326
|
|
|
1281
|
-
export { type AdditionalForwarding, 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, getDaemonInfoPath, getPinggyConfigDir, getRemoteManagementState, getTunnelConfigDir, initiateRemoteManagement, listSavedConfigs, loadConfigByName, sanitizeName, saveConfig, startRemoteManagement, updateConfigAutoStart, updateTunnelConfig, upsertConfig, validateName, validateNameForStorage, validateNameStrict };
|
|
1327
|
+
export { type AdditionalForwarding, type DaemonInfo, 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 };
|
package/dist/index.js
CHANGED
|
@@ -9,11 +9,13 @@ import {
|
|
|
9
9
|
TunnelStateType,
|
|
10
10
|
TunnelWarningCode,
|
|
11
11
|
closeRemoteManagement,
|
|
12
|
+
getDaemonInfo,
|
|
12
13
|
getRemoteManagementState,
|
|
13
14
|
initiateRemoteManagement,
|
|
15
|
+
isDaemonRunning,
|
|
14
16
|
startRemoteManagement
|
|
15
|
-
} from "./chunk-
|
|
16
|
-
import "./chunk-
|
|
17
|
+
} from "./chunk-UX64XCC2.js";
|
|
18
|
+
import "./chunk-YTJEV27N.js";
|
|
17
19
|
import {
|
|
18
20
|
bulkReplace,
|
|
19
21
|
configureStorageLogger,
|
|
@@ -31,15 +33,15 @@ import {
|
|
|
31
33
|
validateName,
|
|
32
34
|
validateNameForStorage,
|
|
33
35
|
validateNameStrict
|
|
34
|
-
} from "./chunk-
|
|
36
|
+
} from "./chunk-YWXADADB.js";
|
|
35
37
|
import {
|
|
36
38
|
TunnelManager,
|
|
37
39
|
printer_default
|
|
38
|
-
} from "./chunk-
|
|
40
|
+
} from "./chunk-PQSLSIDA.js";
|
|
39
41
|
import "./chunk-UB26QJ4T.js";
|
|
40
42
|
import {
|
|
41
43
|
enablePackageLogging
|
|
42
|
-
} from "./chunk-
|
|
44
|
+
} from "./chunk-P7WNBN7F.js";
|
|
43
45
|
import {
|
|
44
46
|
ensureTunnelConfigDir,
|
|
45
47
|
getDaemonInfoPath,
|
|
@@ -137,7 +139,7 @@ async function verifyAndLoad() {
|
|
|
137
139
|
process.exit(1);
|
|
138
140
|
}
|
|
139
141
|
}
|
|
140
|
-
await import("./main-
|
|
142
|
+
await import("./main-KG3Q4LXI.js");
|
|
141
143
|
}
|
|
142
144
|
verifyAndLoad().catch((err) => {
|
|
143
145
|
printer_default.fatal(`Failed to start CLI:, ${err}`);
|
|
@@ -161,11 +163,13 @@ export {
|
|
|
161
163
|
findConfig,
|
|
162
164
|
findConfigByName,
|
|
163
165
|
getAutoStartConfigs,
|
|
166
|
+
getDaemonInfo,
|
|
164
167
|
getDaemonInfoPath,
|
|
165
168
|
getPinggyConfigDir,
|
|
166
169
|
getRemoteManagementState,
|
|
167
170
|
getTunnelConfigDir,
|
|
168
171
|
initiateRemoteManagement,
|
|
172
|
+
isDaemonRunning,
|
|
169
173
|
listSavedConfigs,
|
|
170
174
|
loadConfigByName,
|
|
171
175
|
sanitizeName,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
runDaemonChild
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-NBR2L6LW.js";
|
|
5
5
|
import {
|
|
6
6
|
RemoteManagementUnauthorizedError,
|
|
7
7
|
TunnelOperations,
|
|
@@ -13,19 +13,22 @@ import {
|
|
|
13
13
|
getRemoteManagementState,
|
|
14
14
|
initiateRemoteManagement,
|
|
15
15
|
isDaemonRunning
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-UX64XCC2.js";
|
|
17
17
|
import "./chunk-MT44NAXX.js";
|
|
18
|
-
import
|
|
19
|
-
|
|
18
|
+
import {
|
|
19
|
+
DaemonHost
|
|
20
|
+
} from "./chunk-YTJEV27N.js";
|
|
21
|
+
import "./chunk-YWXADADB.js";
|
|
20
22
|
import {
|
|
21
23
|
TunnelManager
|
|
22
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-PQSLSIDA.js";
|
|
23
25
|
import "./chunk-UB26QJ4T.js";
|
|
24
26
|
import {
|
|
25
27
|
enablePackageLogging
|
|
26
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-P7WNBN7F.js";
|
|
27
29
|
import "./chunk-GBYF2H4H.js";
|
|
28
30
|
export {
|
|
31
|
+
DaemonHost,
|
|
29
32
|
RemoteManagementUnauthorizedError,
|
|
30
33
|
TunnelManager,
|
|
31
34
|
TunnelOperations,
|
package/jest.config.cjs
CHANGED
|
@@ -6,6 +6,7 @@ const presetConfig = createDefaultEsmPreset();
|
|
|
6
6
|
module.exports = {
|
|
7
7
|
...presetConfig,
|
|
8
8
|
testEnvironment: "node",
|
|
9
|
+
testPathIgnorePatterns: ['/node_modules/', '/.claude/', '/dist/'],
|
|
9
10
|
moduleNameMapper: {
|
|
10
11
|
// This handles the .js extension in your TS imports
|
|
11
12
|
'^(\\.{1,2}/.*)\\.js$': '$1',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pinggy",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.5",
|
|
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.
|
|
55
|
+
"@pinggy/pinggy": "^0.5.0",
|
|
56
56
|
"blessed": "^0.1.81",
|
|
57
57
|
"clipboardy": "^5.0.0",
|
|
58
58
|
"mime": "^4.1.0",
|