panrouter 6.3.6 → 6.3.7
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/package.json +1 -1
- package/pool-worker.mjs +0 -27
package/package.json
CHANGED
package/pool-worker.mjs
CHANGED
|
@@ -145,10 +145,6 @@ function connectToHub() {
|
|
|
145
145
|
ws.send(JSON.stringify({ type: "pong" }));
|
|
146
146
|
break;
|
|
147
147
|
|
|
148
|
-
case "test":
|
|
149
|
-
handleTestRequest(msg);
|
|
150
|
-
break;
|
|
151
|
-
|
|
152
148
|
case "upgrade":
|
|
153
149
|
handleUpgrade();
|
|
154
150
|
break;
|
|
@@ -352,29 +348,6 @@ function safeSend(data) {
|
|
|
352
348
|
}
|
|
353
349
|
}
|
|
354
350
|
|
|
355
|
-
// ─── 节点连通性测试 ─────────────────────────────────────────────────────────
|
|
356
|
-
|
|
357
|
-
function handleTestRequest(msg) {
|
|
358
|
-
const testReq = http.request({
|
|
359
|
-
hostname: "127.0.0.1",
|
|
360
|
-
port: SERVER_PORT,
|
|
361
|
-
path: "/dashboard",
|
|
362
|
-
method: "GET",
|
|
363
|
-
timeout: 8000,
|
|
364
|
-
}, (res) => {
|
|
365
|
-
// 只要收到响应就算通
|
|
366
|
-
let body = "";
|
|
367
|
-
res.on("data", (c) => body += c);
|
|
368
|
-
res.on("end", () => {
|
|
369
|
-
safeSend({ type: "test_result", reqId: msg.reqId, ok: true, status: res.statusCode, detail: body.slice(0, 200) });
|
|
370
|
-
});
|
|
371
|
-
});
|
|
372
|
-
testReq.on("error", (err) => {
|
|
373
|
-
safeSend({ type: "test_result", reqId: msg.reqId, ok: false, error: err.message });
|
|
374
|
-
});
|
|
375
|
-
testReq.end();
|
|
376
|
-
}
|
|
377
|
-
|
|
378
351
|
// ─── 心跳保活(每 25 秒发送 ping,避免 Cloudflare 闲置超时) ─────────────────
|
|
379
352
|
|
|
380
353
|
function startHeartbeat() {
|