multiclaws 0.4.11 → 0.4.13
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/dist/infra/frp.js +10 -4
- package/package.json +1 -1
package/dist/infra/frp.js
CHANGED
|
@@ -233,7 +233,9 @@ class FrpTunnelManager {
|
|
|
233
233
|
}
|
|
234
234
|
/* ── Private: poll admin API ──────────────────────────────────── */
|
|
235
235
|
async waitForProxy(proxyName) {
|
|
236
|
-
|
|
236
|
+
// frpc 0.61.x uses /api/status (returns { tcp: [...], udp: [...], ... })
|
|
237
|
+
// older versions used /api/proxy/tcp (returns flat array or { proxies: [...] })
|
|
238
|
+
const statusUrl = `http://127.0.0.1:${this.adminPort}/api/status`;
|
|
237
239
|
for (let attempt = 0; attempt < ADMIN_API_POLL_MAX_RETRIES; attempt++) {
|
|
238
240
|
await new Promise((r) => setTimeout(r, ADMIN_API_POLL_INTERVAL_MS));
|
|
239
241
|
// Check if process has already exited
|
|
@@ -241,11 +243,13 @@ class FrpTunnelManager {
|
|
|
241
243
|
throw new Error("frpc process exited before proxy became ready");
|
|
242
244
|
}
|
|
243
245
|
try {
|
|
244
|
-
const res = await fetch(
|
|
246
|
+
const res = await fetch(statusUrl, { signal: AbortSignal.timeout(3_000) });
|
|
245
247
|
if (!res.ok)
|
|
246
248
|
continue;
|
|
247
249
|
const data = (await res.json());
|
|
248
|
-
|
|
250
|
+
// /api/status groups proxies by type: { tcp: [...], udp: [...], ... }
|
|
251
|
+
const tcpProxies = data.tcp ?? [];
|
|
252
|
+
const proxy = tcpProxies.find((p) => p.name === proxyName);
|
|
249
253
|
if (!proxy)
|
|
250
254
|
continue;
|
|
251
255
|
if (proxy.status === "running") {
|
|
@@ -272,13 +276,15 @@ class FrpTunnelManager {
|
|
|
272
276
|
if (this._status.status !== "running")
|
|
273
277
|
return;
|
|
274
278
|
try {
|
|
275
|
-
const res = await fetch(`http://127.0.0.1:${this.adminPort}/api/
|
|
279
|
+
const res = await fetch(`http://127.0.0.1:${this.adminPort}/api/status`, { signal: AbortSignal.timeout(5_000) });
|
|
276
280
|
if (!res.ok) {
|
|
277
281
|
this.logger.warn("[frp] health check: admin API returned non-OK");
|
|
282
|
+
this._status = { status: "error", reason: "admin API returned non-OK status" };
|
|
278
283
|
}
|
|
279
284
|
}
|
|
280
285
|
catch {
|
|
281
286
|
this.logger.warn("[frp] health check: failed to reach admin API");
|
|
287
|
+
this._status = { status: "error", reason: "admin API unreachable" };
|
|
282
288
|
}
|
|
283
289
|
}, HEALTH_CHECK_INTERVAL_MS);
|
|
284
290
|
// Don't prevent Node from exiting
|