dsh-mobile 0.4.2 → 0.4.4
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/CHANGELOG.md +17 -3
- package/CONTRIBUTORS.md +53 -0
- package/README.en.md +50 -20
- package/README.md +48 -20
- package/bin/dsh-mobile-funnel-linux-arm64 +0 -0
- package/bin/dsh-mobile-funnel-linux-x64 +0 -0
- package/docs/CLOUDFLARE_TUNNEL.en.md +2 -2
- package/docs/CLOUDFLARE_TUNNEL.md +2 -2
- package/lib/cli.js.map +1 -1
- package/lib/client.js +6 -6
- package/lib/client.js.map +1 -1
- package/lib/index.d.mts +63 -15
- package/lib/index.mjs +599 -148
- package/lib/index.mjs.map +1 -1
- package/package.json +11 -8
package/lib/index.d.mts
CHANGED
|
@@ -597,6 +597,7 @@ declare class MobileAccessGateway {
|
|
|
597
597
|
private readonly upstreamAuthenticatedUrl?;
|
|
598
598
|
private readonly extraWebSocketPaths?;
|
|
599
599
|
private readonly blockedUpgradeLog?;
|
|
600
|
+
private readonly onDiscoveryDegraded?;
|
|
600
601
|
readonly access: AccessController;
|
|
601
602
|
private readonly listenerTlsEnabled;
|
|
602
603
|
private readonly tlsEnabled;
|
|
@@ -611,6 +612,7 @@ declare class MobileAccessGateway {
|
|
|
611
612
|
* it, "the phone cannot find this computer" has no diagnosable cause on the host.
|
|
612
613
|
*/
|
|
613
614
|
private discoveryError;
|
|
615
|
+
private mdnsError;
|
|
614
616
|
/** Names of the bundled mobile assets that could not be read, if any. */
|
|
615
617
|
private mobileAssetError;
|
|
616
618
|
private bonjour;
|
|
@@ -620,6 +622,8 @@ declare class MobileAccessGateway {
|
|
|
620
622
|
private readonly activeRequests;
|
|
621
623
|
private readonly activeWebSockets;
|
|
622
624
|
private readonly mobileBootBatches;
|
|
625
|
+
/** Cached upstream bundle byte sizes (HEAD probes), keyed by resource URL. */
|
|
626
|
+
private readonly bootEntrySizeCache;
|
|
623
627
|
private readonly extensionEventListeners;
|
|
624
628
|
private extensionEventRevision;
|
|
625
629
|
private readonly taskEventListeners;
|
|
@@ -642,10 +646,13 @@ declare class MobileAccessGateway {
|
|
|
642
646
|
private readonly probeLimiter;
|
|
643
647
|
constructor(config: ResolvedGatewayConfig, store: DeviceStore, extensions?: MobileAccessService | undefined, upstreamAuthenticatedUrl?: string | undefined, extraWebSocketPaths?: {
|
|
644
648
|
has(pathname: string): boolean;
|
|
645
|
-
} | undefined, blockedUpgradeLog?: BlockedUpgradePathLog | undefined);
|
|
649
|
+
} | undefined, blockedUpgradeLog?: BlockedUpgradePathLog | undefined, onDiscoveryDegraded?: ((source: 'broadcast' | 'mdns', code: string) => void) | undefined);
|
|
646
650
|
/** Initialize durable state, validate TLS, and bind the externally reachable listener. */
|
|
647
651
|
start(): Promise<void>;
|
|
648
652
|
private startDiscovery;
|
|
653
|
+
private reportDiscoveryDegraded;
|
|
654
|
+
private recordBroadcastFailure;
|
|
655
|
+
private recordMdnsFailure;
|
|
649
656
|
private discoveryAnnouncement;
|
|
650
657
|
private closeFailedStart;
|
|
651
658
|
private closeBonjour;
|
|
@@ -666,6 +673,7 @@ declare class MobileAccessGateway {
|
|
|
666
673
|
readonly broadcast: boolean;
|
|
667
674
|
readonly mdns: boolean;
|
|
668
675
|
readonly errorCode?: string;
|
|
676
|
+
readonly mdnsErrorCode?: string;
|
|
669
677
|
readonly mobileAssetsErrorCode?: string;
|
|
670
678
|
};
|
|
671
679
|
private requirePolicy;
|
|
@@ -686,6 +694,20 @@ declare class MobileAccessGateway {
|
|
|
686
694
|
private exchangeUpstreamCookie;
|
|
687
695
|
private proxyMobileIndex;
|
|
688
696
|
private rememberMobileBootBatch;
|
|
697
|
+
/**
|
|
698
|
+
* Determine which layout-batch entries can share a merged boot batch and which
|
|
699
|
+
* must pass through. An entry at or above the per-entry cap, or one whose size
|
|
700
|
+
* could not be probed, keeps its own upstream `/plugins` row: a merged batch
|
|
701
|
+
* cannot carry it, and an unknown bundle must not risk the whole batch.
|
|
702
|
+
*/
|
|
703
|
+
private resolveMobileBootSizes;
|
|
704
|
+
/**
|
|
705
|
+
* Measure one upstream bundle by reading its body. The upstream serves
|
|
706
|
+
* `/plugins` bundles as chunked streams without a Content-Length, so a probe
|
|
707
|
+
* counts bytes; it aborts instantly past the per-entry cap. Measurements are
|
|
708
|
+
* cached for a short window.
|
|
709
|
+
*/
|
|
710
|
+
private upstreamBundleSize;
|
|
689
711
|
private serveMobileBootBatch;
|
|
690
712
|
private startMobileBootBatchAssembly;
|
|
691
713
|
private assembleMobileBootBatch;
|
|
@@ -703,7 +725,14 @@ declare class MobileAccessGateway {
|
|
|
703
725
|
private readUpstreamClientBundleWithRetry;
|
|
704
726
|
private readUpstreamClientBundle;
|
|
705
727
|
private allocateRequest;
|
|
728
|
+
/**
|
|
729
|
+
* Proxy one request upstream. Pass-through client bundles (`GET /plugins`)
|
|
730
|
+
* receive bounded transient retries — the upstream resets a fraction of fresh
|
|
731
|
+
* connections — matching the resilience the merged-batch assembly already has.
|
|
732
|
+
* A request is only retried before any byte reached the client.
|
|
733
|
+
*/
|
|
706
734
|
private proxyHttp;
|
|
735
|
+
private proxyHttpOnce;
|
|
707
736
|
private abortSessionResources;
|
|
708
737
|
private broadcastExtensionChange;
|
|
709
738
|
/** Fan a completed task to every phone holding this gateway's event stream. */
|
|
@@ -1073,23 +1102,28 @@ declare class OriginController implements RemoteProviderController {
|
|
|
1073
1102
|
//#endregion
|
|
1074
1103
|
//#region src/cloudflared-component.d.ts
|
|
1075
1104
|
/**
|
|
1076
|
-
* Pinned cloudflared
|
|
1105
|
+
* Pinned cloudflared components fetched only after an explicit user action.
|
|
1077
1106
|
*
|
|
1078
|
-
* Unlike the cpolar archive
|
|
1079
|
-
* unpack, so the download digest and the installed digest are the same pair.
|
|
1107
|
+
* Unlike the cpolar archive each artifact IS the executable: there is nothing
|
|
1108
|
+
* to unpack, so the download digest and the installed digest are the same pair.
|
|
1080
1109
|
* `--no-autoupdate` is passed at runtime as well, so the pinned bytes stay the
|
|
1081
1110
|
* bytes that were verified.
|
|
1082
1111
|
*/
|
|
1083
|
-
|
|
1084
|
-
version:
|
|
1085
|
-
platform:
|
|
1086
|
-
arch:
|
|
1087
|
-
downloadUrl:
|
|
1088
|
-
downloadBytes:
|
|
1089
|
-
downloadSha256:
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1112
|
+
interface CloudflaredArtifact {
|
|
1113
|
+
readonly version: string;
|
|
1114
|
+
readonly platform: NodeJS.Platform;
|
|
1115
|
+
readonly arch: string;
|
|
1116
|
+
readonly downloadUrl: string;
|
|
1117
|
+
readonly downloadBytes: number;
|
|
1118
|
+
readonly downloadSha256: string;
|
|
1119
|
+
readonly executableName: string;
|
|
1120
|
+
}
|
|
1121
|
+
/**
|
|
1122
|
+
* Canonical release metadata. New code should select from
|
|
1123
|
+
* {@link CLOUDFLARED_COMPONENT_RELEASES} by platform and architecture; this
|
|
1124
|
+
* alias preserves the original Windows x64 entry for existing callers.
|
|
1125
|
+
*/
|
|
1126
|
+
declare const CLOUDFLARED_COMPONENT_RELEASE: CloudflaredArtifact;
|
|
1093
1127
|
/**
|
|
1094
1128
|
* Public, credential-free description of the managed cloudflared component.
|
|
1095
1129
|
*
|
|
@@ -1124,6 +1158,7 @@ declare class CloudflaredComponentManager {
|
|
|
1124
1158
|
private readonly stagingRoot;
|
|
1125
1159
|
private readonly platform;
|
|
1126
1160
|
private readonly arch;
|
|
1161
|
+
private readonly release;
|
|
1127
1162
|
private readonly fetchArtifact;
|
|
1128
1163
|
private installed;
|
|
1129
1164
|
private errorCode;
|
|
@@ -1236,8 +1271,13 @@ interface CloudflaredControllerOptions {
|
|
|
1236
1271
|
};
|
|
1237
1272
|
readonly createGateway: (origin: string, listenPort: number) => Promise<MobileAccessGateway>;
|
|
1238
1273
|
readonly onStatus?: (status: CloudflaredStatus) => void;
|
|
1239
|
-
/** Liveness bound for one
|
|
1274
|
+
/** Liveness bound for one startup-timeout round; defaults to the product timeout. */
|
|
1240
1275
|
readonly startupTimeoutMs?: number;
|
|
1276
|
+
/**
|
|
1277
|
+
* Total startup-timeout rounds before a live named connector is given up on;
|
|
1278
|
+
* defaults to NAMED_STARTUP_ROUNDS. Quick tunnels always use a single round.
|
|
1279
|
+
*/
|
|
1280
|
+
readonly maxStartupRounds?: number;
|
|
1241
1281
|
readonly spawnProcess?: (executable: string, args: readonly string[], environment: NodeJS.ProcessEnv) => ChildProcessWithoutNullStreams;
|
|
1242
1282
|
}
|
|
1243
1283
|
/**
|
|
@@ -1281,6 +1321,7 @@ declare class CloudflaredController implements RemoteProviderController {
|
|
|
1281
1321
|
private latest;
|
|
1282
1322
|
private queue;
|
|
1283
1323
|
private startupTimer;
|
|
1324
|
+
private startupRounds;
|
|
1284
1325
|
constructor(options: CloudflaredControllerOptions);
|
|
1285
1326
|
/** Restore the remembered cloudflared switch independently from LAN and other providers. */
|
|
1286
1327
|
initialize(): Promise<void>;
|
|
@@ -1299,6 +1340,13 @@ declare class CloudflaredController implements RemoteProviderController {
|
|
|
1299
1340
|
private enqueue;
|
|
1300
1341
|
private publish;
|
|
1301
1342
|
private start;
|
|
1343
|
+
private armStartupTimer;
|
|
1344
|
+
/**
|
|
1345
|
+
* Give a live named connector more time instead of killing it: it retries the
|
|
1346
|
+
* edge on its own and usually registers once the rebooted network is usable.
|
|
1347
|
+
* A dead connector, or an exhausted budget, fails the generation as before.
|
|
1348
|
+
*/
|
|
1349
|
+
private checkStartupTimeout;
|
|
1302
1350
|
private consume;
|
|
1303
1351
|
/** Mark a named tunnel ready once the connector has registered with the edge. */
|
|
1304
1352
|
private confirmNamedReady;
|