cfpilot 0.11.2 → 0.12.1
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/assets/control.js +10 -10
- package/assets/dataplane.js +5 -5
- package/assets/worker.js +15 -15
- package/dist/cli.js +323 -16
- package/package.json +2 -2
package/dist/cli.js
CHANGED
|
@@ -87,7 +87,7 @@ var VERSION, NAME;
|
|
|
87
87
|
var init_version = __esm({
|
|
88
88
|
"src/shared/version.ts"() {
|
|
89
89
|
"use strict";
|
|
90
|
-
VERSION = "0.
|
|
90
|
+
VERSION = "0.12.1";
|
|
91
91
|
NAME = "cfpilot";
|
|
92
92
|
}
|
|
93
93
|
});
|
|
@@ -373,14 +373,14 @@ async function multiSelect(question, choices, options = {}) {
|
|
|
373
373
|
if (!first) stdout.write(`\x1B[${choices.length}A`);
|
|
374
374
|
for (let i = 0; i < choices.length; i++) {
|
|
375
375
|
const ch = choices[i];
|
|
376
|
-
const
|
|
376
|
+
const mark2 = selected.has(i) ? c.green("[x]") : c.gray("[ ]");
|
|
377
377
|
clearLine();
|
|
378
378
|
if (i === cursor) {
|
|
379
|
-
stdout.write(` ${c.cyan("\u276F")} ${
|
|
379
|
+
stdout.write(` ${c.cyan("\u276F")} ${mark2} ${c.inverse(" " + ch.label + " ")}`);
|
|
380
380
|
if (ch.hint) stdout.write(` ${c.gray(ch.hint)}`);
|
|
381
381
|
stdout.write("\n");
|
|
382
382
|
} else {
|
|
383
|
-
stdout.write(` ${
|
|
383
|
+
stdout.write(` ${mark2} ${ch.label}`);
|
|
384
384
|
if (ch.hint) stdout.write(` ${c.gray(ch.hint)}`);
|
|
385
385
|
stdout.write("\n");
|
|
386
386
|
}
|
|
@@ -4266,6 +4266,28 @@ var init_unlock = __esm({
|
|
|
4266
4266
|
|
|
4267
4267
|
// src/scan/scan.ts
|
|
4268
4268
|
import * as net2 from "node:net";
|
|
4269
|
+
function classifyFailure(error) {
|
|
4270
|
+
const text = String(error ?? "").trim();
|
|
4271
|
+
if (!text) return "\u672A\u77E5\u539F\u56E0";
|
|
4272
|
+
if (/timeout|timed out|超时|ETIMEDOUT/i.test(text)) return "\u8D85\u65F6";
|
|
4273
|
+
if (/ECONNREFUSED|connection refused|连接被拒/i.test(text)) return "\u8FDE\u63A5\u88AB\u62D2";
|
|
4274
|
+
if (/ENETUNREACH|EHOSTUNREACH|unreachable/i.test(text)) return "\u7F51\u7EDC\u4E0D\u53EF\u8FBE";
|
|
4275
|
+
if (/ECONNRESET|socket hang up|连接重置/i.test(text)) return "\u8FDE\u63A5\u91CD\u7F6E";
|
|
4276
|
+
if (/certificate|CERT_|SELF_SIGNED|证书/i.test(text)) return "\u8BC1\u4E66\u95EE\u9898";
|
|
4277
|
+
if (/ALPN/i.test(text)) return "ALPN \u534F\u5546\u5931\u8D25";
|
|
4278
|
+
if (/HTTP\s*\d{3}/i.test(text)) {
|
|
4279
|
+
const code = /HTTP\s*(\d{3})/i.exec(text)?.[1];
|
|
4280
|
+
return code ? `HTTP ${code}` : "HTTP \u72B6\u6001\u5F02\u5E38";
|
|
4281
|
+
}
|
|
4282
|
+
if (/PONG|pong/i.test(text)) return "\u5185\u5BB9\u6821\u9A8C\u4E0D\u901A\u8FC7";
|
|
4283
|
+
if (/ENOTFOUND|EAI_AGAIN|getaddrinfo/i.test(text)) return "\u57DF\u540D\u89E3\u6790\u5931\u8D25";
|
|
4284
|
+
return "\u5176\u4ED6";
|
|
4285
|
+
}
|
|
4286
|
+
function countFailure(into, stage, error) {
|
|
4287
|
+
const bucket = into[stage] ??= {};
|
|
4288
|
+
const key = classifyFailure(error);
|
|
4289
|
+
bucket[key] = (bucket[key] ?? 0) + 1;
|
|
4290
|
+
}
|
|
4269
4291
|
async function tcpPing(ip, port, timeoutMs) {
|
|
4270
4292
|
return new Promise((resolve3) => {
|
|
4271
4293
|
const started = Date.now();
|
|
@@ -4397,7 +4419,12 @@ async function runScan(options) {
|
|
|
4397
4419
|
}
|
|
4398
4420
|
return { ...item, tls: probe };
|
|
4399
4421
|
});
|
|
4422
|
+
const failures = {};
|
|
4400
4423
|
const tlsOk = tlsResults.filter((r) => r.tls.tlsMs > 0);
|
|
4424
|
+
for (const item of tlsResults) {
|
|
4425
|
+
if (item.tls.tlsMs > 0) continue;
|
|
4426
|
+
countFailure(failures, "tls", item.tls.error);
|
|
4427
|
+
}
|
|
4401
4428
|
const stage1 = tlsOk.sort((a, b) => a.tls.tlsMs - b.tls.tlsMs || a.latency - b.latency).slice(0, effectiveProbeLimit);
|
|
4402
4429
|
const strictProbe = options.verifyPayload !== false;
|
|
4403
4430
|
const explicitProbePath = options.probePath?.trim();
|
|
@@ -4455,6 +4482,10 @@ async function runScan(options) {
|
|
|
4455
4482
|
}
|
|
4456
4483
|
);
|
|
4457
4484
|
const wsOk = (strictProbe ? probeResults.filter((r) => r.probe.ok && r.probe.pongVerified === true) : probeResults.filter((r) => r.probe.ok)).filter((r) => r.pathOk !== false);
|
|
4485
|
+
for (const item of probeResults) {
|
|
4486
|
+
if (item.probe.ok) continue;
|
|
4487
|
+
countFailure(failures, "ws101", item.probe.error);
|
|
4488
|
+
}
|
|
4458
4489
|
let tunnelOk = wsOk;
|
|
4459
4490
|
let tunnelFailed = 0;
|
|
4460
4491
|
const tunnelCredential = options.uuid || options.trojanPassword;
|
|
@@ -4644,7 +4675,9 @@ async function runScan(options) {
|
|
|
4644
4675
|
/** 国家筛选未命中任何候选、已放宽为全量 */
|
|
4645
4676
|
countryFilterRelaxed,
|
|
4646
4677
|
/** 因已攒够目标国家节点而提前结束阶段二 */
|
|
4647
|
-
stoppedEarly
|
|
4678
|
+
stoppedEarly,
|
|
4679
|
+
/** 各阶段失败原因分布 */
|
|
4680
|
+
failures
|
|
4648
4681
|
}
|
|
4649
4682
|
};
|
|
4650
4683
|
report({ type: "done", count: entries.length });
|
|
@@ -5872,6 +5905,9 @@ function normalizeWsPath(raw, fallback) {
|
|
|
5872
5905
|
}
|
|
5873
5906
|
return value;
|
|
5874
5907
|
}
|
|
5908
|
+
function seedFromArgs(args) {
|
|
5909
|
+
return args.flags["seed"] !== void 0 ? flagNumber(args, "seed", 24301) : void 0;
|
|
5910
|
+
}
|
|
5875
5911
|
async function resolveCandidatesFromArgs(args) {
|
|
5876
5912
|
const ipFile = flagString(args, "ip-file");
|
|
5877
5913
|
if (ipFile) {
|
|
@@ -5886,7 +5922,7 @@ async function resolveCandidatesFromArgs(args) {
|
|
|
5886
5922
|
cidr: flagList(args, "cidr"),
|
|
5887
5923
|
// ⚠️ 不传 seed = 每次随机(默认)。只有用户显式给了 --seed 才固定,
|
|
5888
5924
|
// 否则「每次跑都测同一批 IP」——那批落在劣质路由段上时永远测不出好 IP。
|
|
5889
|
-
seed:
|
|
5925
|
+
seed: seedFromArgs(args)
|
|
5890
5926
|
});
|
|
5891
5927
|
}
|
|
5892
5928
|
function printProgress(event, quiet) {
|
|
@@ -6040,9 +6076,11 @@ ${NAME} v${VERSION}
|
|
|
6040
6076
|
`);
|
|
6041
6077
|
}
|
|
6042
6078
|
}
|
|
6043
|
-
|
|
6079
|
+
let envResult = null;
|
|
6080
|
+
if (!quiet || asJson) {
|
|
6044
6081
|
const env = await detectProxyInterference(host);
|
|
6045
|
-
|
|
6082
|
+
envResult = env;
|
|
6083
|
+
if (!quiet && !env.clean) {
|
|
6046
6084
|
process.stdout.write("\n\u26A0\uFE0F \u68C0\u6D4B\u5230\u53EF\u80FD\u5E72\u6270\u4F18\u9009\u7684\u56E0\u7D20\uFF1A\n");
|
|
6047
6085
|
for (const f of env.findings) {
|
|
6048
6086
|
process.stdout.write(` ${f.message}
|
|
@@ -6165,7 +6203,34 @@ ${NAME} v${VERSION}
|
|
|
6165
6203
|
});
|
|
6166
6204
|
if (asJson) {
|
|
6167
6205
|
process.stdout.write(
|
|
6168
|
-
`${JSON.stringify(
|
|
6206
|
+
`${JSON.stringify(
|
|
6207
|
+
{
|
|
6208
|
+
generatedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
6209
|
+
tool: "cfpilot",
|
|
6210
|
+
version: VERSION,
|
|
6211
|
+
seed: seedFromArgs(args) ?? null,
|
|
6212
|
+
params: {
|
|
6213
|
+
host,
|
|
6214
|
+
port,
|
|
6215
|
+
wsPath,
|
|
6216
|
+
probePath,
|
|
6217
|
+
sample: flagNumber(args, "sample", 6556),
|
|
6218
|
+
top,
|
|
6219
|
+
countries: summary.stats.countries,
|
|
6220
|
+
speedMode,
|
|
6221
|
+
speedLimit: flagNumber(args, "speed-limit", 30),
|
|
6222
|
+
speedBytes: flagNumber(args, "speed-bytes", 5 * 1024 * 1024),
|
|
6223
|
+
skipSpeed,
|
|
6224
|
+
verifyPayload,
|
|
6225
|
+
tunnelVerified: Boolean(flagString(args, "uuid") || flagString(args, "trojan-password"))
|
|
6226
|
+
},
|
|
6227
|
+
env: envResult,
|
|
6228
|
+
stats: summary.stats,
|
|
6229
|
+
entries: summary.entries
|
|
6230
|
+
},
|
|
6231
|
+
null,
|
|
6232
|
+
2
|
|
6233
|
+
)}
|
|
6169
6234
|
`
|
|
6170
6235
|
);
|
|
6171
6236
|
} else {
|
|
@@ -6900,6 +6965,241 @@ var init_main = __esm({
|
|
|
6900
6965
|
}
|
|
6901
6966
|
});
|
|
6902
6967
|
|
|
6968
|
+
// src/scan/single.ts
|
|
6969
|
+
import * as net4 from "node:net";
|
|
6970
|
+
function probeTcp(ip, port, timeoutMs) {
|
|
6971
|
+
return new Promise((resolve3) => {
|
|
6972
|
+
const started = Date.now();
|
|
6973
|
+
let settled = false;
|
|
6974
|
+
const finish = (result) => {
|
|
6975
|
+
if (settled) return;
|
|
6976
|
+
settled = true;
|
|
6977
|
+
try {
|
|
6978
|
+
socket.destroy();
|
|
6979
|
+
} catch {
|
|
6980
|
+
}
|
|
6981
|
+
resolve3({ stage: "TCP \u5EFA\u8FDE", ms: Date.now() - started, ...result });
|
|
6982
|
+
};
|
|
6983
|
+
const socket = net4.connect({ host: ip, port });
|
|
6984
|
+
socket.setTimeout(timeoutMs, () => finish({ ok: false, error: "\u8D85\u65F6" }));
|
|
6985
|
+
socket.once("connect", () => finish({ ok: true }));
|
|
6986
|
+
socket.once("error", (err) => finish({ ok: false, error: err.message }));
|
|
6987
|
+
});
|
|
6988
|
+
}
|
|
6989
|
+
async function runSingleTest(options) {
|
|
6990
|
+
const {
|
|
6991
|
+
ip,
|
|
6992
|
+
port,
|
|
6993
|
+
host,
|
|
6994
|
+
path,
|
|
6995
|
+
timeoutMs,
|
|
6996
|
+
speed,
|
|
6997
|
+
speedBytes,
|
|
6998
|
+
uuid,
|
|
6999
|
+
trojanPassword,
|
|
7000
|
+
verifyTargetHost,
|
|
7001
|
+
verifyTargetPort,
|
|
7002
|
+
onStage
|
|
7003
|
+
} = options;
|
|
7004
|
+
const results = [];
|
|
7005
|
+
const push = (result) => {
|
|
7006
|
+
results.push(result);
|
|
7007
|
+
onStage?.(result);
|
|
7008
|
+
};
|
|
7009
|
+
const tcp = await probeTcp(ip, port, timeoutMs);
|
|
7010
|
+
push(tcp);
|
|
7011
|
+
if (!tcp.ok) return results;
|
|
7012
|
+
const tls4 = await probeTlsHandshake(ip, port, host, timeoutMs);
|
|
7013
|
+
const tlsOk = tls4.tlsMs >= 0 && !tls4.error;
|
|
7014
|
+
push({
|
|
7015
|
+
stage: "TLS \u63E1\u624B",
|
|
7016
|
+
ok: tlsOk,
|
|
7017
|
+
ms: tls4.tlsMs >= 0 ? tls4.tlsMs : void 0,
|
|
7018
|
+
detail: tls4.alpn ? `ALPN=${tls4.alpn}` : void 0,
|
|
7019
|
+
error: tlsOk ? void 0 : tls4.error ?? "\u63E1\u624B\u5931\u8D25"
|
|
7020
|
+
});
|
|
7021
|
+
if (!tlsOk) return results;
|
|
7022
|
+
const ws = await probeWs101(ip, port, host, timeoutMs, path);
|
|
7023
|
+
push({
|
|
7024
|
+
stage: "WebSocket 101",
|
|
7025
|
+
ok: ws.ok,
|
|
7026
|
+
ms: ws.latencyMs,
|
|
7027
|
+
detail: ws.colo ? `\u673A\u623F ${ws.colo}` : void 0,
|
|
7028
|
+
error: ws.ok ? void 0 : ws.error ?? `HTTP ${ws.status}`
|
|
7029
|
+
});
|
|
7030
|
+
if (!ws.ok) return results;
|
|
7031
|
+
const ping = await probeWsPing(ip, port, host, timeoutMs, path);
|
|
7032
|
+
push({
|
|
7033
|
+
stage: "PONG \u5185\u5BB9\u6821\u9A8C",
|
|
7034
|
+
ok: ping.ok,
|
|
7035
|
+
ms: ping.latencyMs,
|
|
7036
|
+
detail: ping.probeColo ? `\u673A\u623F ${ping.probeColo}` : void 0,
|
|
7037
|
+
error: ping.ok ? void 0 : ping.error ?? "\u672A\u6536\u5230 PONG"
|
|
7038
|
+
});
|
|
7039
|
+
if (speed) {
|
|
7040
|
+
const throughput = await measureProbeThroughput({
|
|
7041
|
+
ip,
|
|
7042
|
+
port,
|
|
7043
|
+
host,
|
|
7044
|
+
bytes: speedBytes,
|
|
7045
|
+
path,
|
|
7046
|
+
connections: 8,
|
|
7047
|
+
durationMs: 6e3,
|
|
7048
|
+
timeoutMs: Math.max(timeoutMs, 15e3),
|
|
7049
|
+
token: uuid
|
|
7050
|
+
});
|
|
7051
|
+
push({
|
|
7052
|
+
stage: "\u4E0B\u884C\u6D4B\u901F",
|
|
7053
|
+
ok: throughput.ok,
|
|
7054
|
+
detail: throughput.ok ? `${throughput.steadyMBps.toFixed(2)} MB/s\uFF08\u7A33\u6001\uFF09` : void 0,
|
|
7055
|
+
error: throughput.ok ? void 0 : throughput.error ?? "\u6D4B\u901F\u5931\u8D25"
|
|
7056
|
+
});
|
|
7057
|
+
}
|
|
7058
|
+
if (uuid || trojanPassword) {
|
|
7059
|
+
const tunnel = await verifyTunnel({
|
|
7060
|
+
ip,
|
|
7061
|
+
port,
|
|
7062
|
+
host,
|
|
7063
|
+
wsPath: path,
|
|
7064
|
+
uuid,
|
|
7065
|
+
trojanPassword,
|
|
7066
|
+
targetHost: verifyTargetHost,
|
|
7067
|
+
targetPort: verifyTargetPort,
|
|
7068
|
+
timeoutMs: Math.max(timeoutMs, 8e3)
|
|
7069
|
+
});
|
|
7070
|
+
push({
|
|
7071
|
+
stage: "\u771F\u5B9E\u96A7\u9053",
|
|
7072
|
+
ok: tunnel.ok,
|
|
7073
|
+
ms: tunnel.latencyMs,
|
|
7074
|
+
detail: tunnel.ok ? `\u8BBF\u95EE ${verifyTargetHost} \u6536\u5230\u6570\u636E` : void 0,
|
|
7075
|
+
error: tunnel.ok ? void 0 : `${tunnel.stage ?? "\u672A\u77E5\u9636\u6BB5"}\uFF1A${tunnel.error ?? "\u5931\u8D25"}`
|
|
7076
|
+
});
|
|
7077
|
+
}
|
|
7078
|
+
return results;
|
|
7079
|
+
}
|
|
7080
|
+
function summarizeStages(results) {
|
|
7081
|
+
const failed = results.find((r) => !r.ok);
|
|
7082
|
+
if (!failed) return `\u5168\u90E8 ${results.length} \u9879\u901A\u8FC7`;
|
|
7083
|
+
return `\u5361\u5728\u300C${failed.stage}\u300D\uFF1A${failed.error ?? "\u672A\u77E5\u539F\u56E0"}`;
|
|
7084
|
+
}
|
|
7085
|
+
var init_single = __esm({
|
|
7086
|
+
"src/scan/single.ts"() {
|
|
7087
|
+
"use strict";
|
|
7088
|
+
init_true_probe();
|
|
7089
|
+
}
|
|
7090
|
+
});
|
|
7091
|
+
|
|
7092
|
+
// src/scan/single-command.ts
|
|
7093
|
+
var single_command_exports = {};
|
|
7094
|
+
__export(single_command_exports, {
|
|
7095
|
+
runTestCommand: () => runTestCommand
|
|
7096
|
+
});
|
|
7097
|
+
function mark(ok) {
|
|
7098
|
+
return ok ? "\x1B[32m\u2713\x1B[0m" : "\x1B[31m\u2717\x1B[0m";
|
|
7099
|
+
}
|
|
7100
|
+
function printStage(result) {
|
|
7101
|
+
const parts = [` ${mark(result.ok)} ${result.stage}`];
|
|
7102
|
+
if (result.ms !== void 0) parts.push(`${result.ms} ms`);
|
|
7103
|
+
if (result.detail) parts.push(result.detail);
|
|
7104
|
+
if (result.error) parts.push(`\x1B[31m${result.error}\x1B[0m`);
|
|
7105
|
+
process.stdout.write(parts.join(" ") + "\n");
|
|
7106
|
+
}
|
|
7107
|
+
async function runTestCommand(args) {
|
|
7108
|
+
if (flagBool(args, "h") || flagBool(args, "help")) {
|
|
7109
|
+
process.stdout.write(HELP);
|
|
7110
|
+
return;
|
|
7111
|
+
}
|
|
7112
|
+
const host = flagString(args, "host").trim();
|
|
7113
|
+
const ip = flagString(args, "ip").trim();
|
|
7114
|
+
if (!host || !ip) {
|
|
7115
|
+
process.stderr.write("\u7F3A\u5C11\u53C2\u6570\uFF1A--host \u4E0E --ip \u90FD\u662F\u5FC5\u586B\n\n" + HELP);
|
|
7116
|
+
process.exitCode = 1;
|
|
7117
|
+
return;
|
|
7118
|
+
}
|
|
7119
|
+
const port = flagNumber(args, "port", 443);
|
|
7120
|
+
if (port < 1 || port > 65535) {
|
|
7121
|
+
process.stderr.write(`\u7AEF\u53E3 ${port} \u8D85\u51FA\u8303\u56F4\uFF081-65535\uFF09
|
|
7122
|
+
`);
|
|
7123
|
+
process.exitCode = 1;
|
|
7124
|
+
return;
|
|
7125
|
+
}
|
|
7126
|
+
const asJson = flagBool(args, "json");
|
|
7127
|
+
const options = {
|
|
7128
|
+
ip,
|
|
7129
|
+
port,
|
|
7130
|
+
host,
|
|
7131
|
+
path: flagString(args, "path", "/__edge_probe"),
|
|
7132
|
+
timeoutMs: flagNumber(args, "timeout", 4e3),
|
|
7133
|
+
speed: flagBool(args, "speed"),
|
|
7134
|
+
speedBytes: flagNumber(args, "speed-bytes", 5 * 1024 * 1024),
|
|
7135
|
+
uuid: flagString(args, "uuid").trim() || void 0,
|
|
7136
|
+
trojanPassword: flagString(args, "trojan-password").trim() || void 0,
|
|
7137
|
+
verifyTargetHost: flagString(args, "verify-target", "baidu.com"),
|
|
7138
|
+
verifyTargetPort: flagNumber(args, "verify-target-port", 80)
|
|
7139
|
+
};
|
|
7140
|
+
if (!asJson) {
|
|
7141
|
+
process.stdout.write(`
|
|
7142
|
+
\u6D4B\u8BD5 ${ip}:${port} \u2192 ${host}${options.path}
|
|
7143
|
+
|
|
7144
|
+
`);
|
|
7145
|
+
}
|
|
7146
|
+
const results = await runSingleTest({
|
|
7147
|
+
...options,
|
|
7148
|
+
onStage: asJson ? void 0 : printStage
|
|
7149
|
+
});
|
|
7150
|
+
const summary = summarizeStages(results);
|
|
7151
|
+
if (asJson) {
|
|
7152
|
+
process.stdout.write(
|
|
7153
|
+
`${JSON.stringify({ ip, port, host, path: options.path, results, summary }, null, 2)}
|
|
7154
|
+
`
|
|
7155
|
+
);
|
|
7156
|
+
} else {
|
|
7157
|
+
process.stdout.write(`
|
|
7158
|
+
\u7ED3\u8BBA\uFF1A${summary}
|
|
7159
|
+
`);
|
|
7160
|
+
}
|
|
7161
|
+
if (results.some((r) => !r.ok)) process.exitCode = 1;
|
|
7162
|
+
}
|
|
7163
|
+
var HELP;
|
|
7164
|
+
var init_single_command = __esm({
|
|
7165
|
+
"src/scan/single-command.ts"() {
|
|
7166
|
+
"use strict";
|
|
7167
|
+
init_args();
|
|
7168
|
+
init_version();
|
|
7169
|
+
init_single();
|
|
7170
|
+
HELP = `
|
|
7171
|
+
${NAME} test \u2014\u2014 \u6D4B\u8BD5\u5355\u4E2A IP \u7684\u5B8C\u6574\u94FE\u8DEF
|
|
7172
|
+
|
|
7173
|
+
\u7528\u6CD5:
|
|
7174
|
+
${NAME} test --host <\u6570\u636E\u9762\u57DF\u540D> --ip <IP> [\u9009\u9879]
|
|
7175
|
+
|
|
7176
|
+
\u5FC5\u586B:
|
|
7177
|
+
--host <domain> \u6570\u636E\u9762\u57DF\u540D\uFF08\u4F5C\u4E3A TLS SNI \u4E0E HTTP Host\uFF09
|
|
7178
|
+
--ip <address> \u8981\u6D4B\u8BD5\u7684 IP\uFF08IPv6 \u76F4\u63A5\u5199\uFF0C\u4E0D\u52A0\u65B9\u62EC\u53F7\uFF09
|
|
7179
|
+
|
|
7180
|
+
\u9009\u9879:
|
|
7181
|
+
--port <port> \u7AEF\u53E3\uFF0C\u9ED8\u8BA4 443
|
|
7182
|
+
--path <path> WebSocket \u6821\u9A8C\u8DEF\u5F84\uFF0C\u9ED8\u8BA4 /__edge_probe
|
|
7183
|
+
--timeout <ms> \u5355\u9636\u6BB5\u8D85\u65F6\uFF0C\u9ED8\u8BA4 4000
|
|
7184
|
+
--speed \u989D\u5916\u505A\u4E0B\u884C\u6D4B\u901F\uFF08\u4F1A\u6D88\u8017\u6D41\u91CF\uFF0C\u9ED8\u8BA4\u5173\u95ED\uFF09
|
|
7185
|
+
--speed-bytes <n> \u6D4B\u901F\u8BF7\u6C42\u5B57\u8282\u6570\uFF0C\u9ED8\u8BA4 5242880\uFF085 MiB\uFF09
|
|
7186
|
+
--uuid <uuid> \u771F\u5B9E\u96A7\u9053\u6821\u9A8C\u7528\u7684 VLESS UUID
|
|
7187
|
+
--trojan-password <pw> \u771F\u5B9E\u96A7\u9053\u6821\u9A8C\u7528\u7684 Trojan \u53E3\u4EE4\uFF08\u4E0E --uuid \u4E8C\u9009\u4E00\uFF09
|
|
7188
|
+
--verify-target <host> \u96A7\u9053\u6821\u9A8C\u8BBF\u95EE\u7684\u76EE\u6807\uFF0C\u9ED8\u8BA4 baidu.com
|
|
7189
|
+
--json \u4EE5 JSON \u8F93\u51FA\uFF08\u4FBF\u4E8E\u811A\u672C\u5904\u7406\uFF09
|
|
7190
|
+
-h, --help \u663E\u793A\u672C\u5E2E\u52A9
|
|
7191
|
+
|
|
7192
|
+
\u793A\u4F8B:
|
|
7193
|
+
${NAME} test --host cf.example.com --ip 104.16.1.1
|
|
7194
|
+
${NAME} test --host cf.example.com --ip 104.16.1.1 --speed --uuid <UUID>
|
|
7195
|
+
|
|
7196
|
+
\u8BF4\u660E:
|
|
7197
|
+
\u9636\u6BB5\u987A\u5E8F\u4E0E\u5BA2\u6237\u7AEF\u771F\u5B9E\u5EFA\u8FDE\u4E00\u81F4\uFF1ATCP \u2192 TLS \u2192 WS 101 \u2192 PONG \u2192 \u6D4B\u901F \u2192 \u96A7\u9053\u3002
|
|
7198
|
+
\u524D\u4E00\u9636\u6BB5\u5931\u8D25\u5373\u505C\u6B62\uFF08\u540E\u9762\u7684\u9636\u6BB5\u4F9D\u8D56\u5B83\uFF0C\u7EE7\u7EED\u8DD1\u53EA\u4F1A\u5F97\u5230\u4E00\u4E32\u300C\u4E5F\u5931\u8D25\u300D\uFF09\u3002
|
|
7199
|
+
`;
|
|
7200
|
+
}
|
|
7201
|
+
});
|
|
7202
|
+
|
|
6903
7203
|
// src/deploy/token-command.ts
|
|
6904
7204
|
var token_command_exports = {};
|
|
6905
7205
|
__export(token_command_exports, {
|
|
@@ -7006,7 +7306,7 @@ ssh \u542F\u52A8\u5931\u8D25\uFF1A${err.message}
|
|
|
7006
7306
|
}
|
|
7007
7307
|
async function runVpsCommand(args) {
|
|
7008
7308
|
if (flagBool(args, "h") || flagBool(args, "help")) {
|
|
7009
|
-
process.stdout.write(
|
|
7309
|
+
process.stdout.write(HELP2);
|
|
7010
7310
|
return;
|
|
7011
7311
|
}
|
|
7012
7312
|
const port = flagNumber(args, "port", 0);
|
|
@@ -7053,13 +7353,13 @@ async function runVpsCommand(args) {
|
|
|
7053
7353
|
`
|
|
7054
7354
|
);
|
|
7055
7355
|
}
|
|
7056
|
-
var
|
|
7356
|
+
var HELP2;
|
|
7057
7357
|
var init_command3 = __esm({
|
|
7058
7358
|
"src/vps/command.ts"() {
|
|
7059
7359
|
"use strict";
|
|
7060
7360
|
init_args();
|
|
7061
7361
|
init_version();
|
|
7062
|
-
|
|
7362
|
+
HELP2 = `
|
|
7063
7363
|
${NAME} vps \u2014\u2014 \u5728\u81EA\u5DF1\u7684 VPS \u4E0A\u90E8\u7F72 SOCKS5 \u843D\u5730\u4EE3\u7406
|
|
7064
7364
|
|
|
7065
7365
|
\u7528\u6CD5:
|
|
@@ -7092,7 +7392,7 @@ ${NAME} vps \u2014\u2014 \u5728\u81EA\u5DF1\u7684 VPS \u4E0A\u90E8\u7F72 SOCKS5
|
|
|
7092
7392
|
// src/cli.ts
|
|
7093
7393
|
init_args();
|
|
7094
7394
|
init_version();
|
|
7095
|
-
var
|
|
7395
|
+
var HELP3 = `
|
|
7096
7396
|
${NAME} v${VERSION}
|
|
7097
7397
|
Cloudflare Pages \u4EE3\u7406\u90E8\u7F72\u4E0E\u4F18\u9009\u5DE5\u5177
|
|
7098
7398
|
|
|
@@ -7100,6 +7400,7 @@ Cloudflare Pages \u4EE3\u7406\u90E8\u7F72\u4E0E\u4F18\u9009\u5DE5\u5177
|
|
|
7100
7400
|
${NAME} \u4EA4\u4E92\u83DC\u5355\uFF08\u63A8\u8350\u9996\u6B21\u4F7F\u7528\uFF09
|
|
7101
7401
|
${NAME} deploy [\u9009\u9879] \u90E8\u7F72 Pages \u53CC\u9879\u76EE
|
|
7102
7402
|
${NAME} scan [\u9009\u9879] \u672C\u5730\u771F\u8FDE\u63A5\u4F18\u9009
|
|
7403
|
+
${NAME} test [\u9009\u9879] \u6D4B\u8BD5\u5355\u4E2A IP \u7684\u5B8C\u6574\u94FE\u8DEF
|
|
7103
7404
|
${NAME} status \u67E5\u770B\u5F53\u524D\u5B9E\u4F8B\u72B6\u6001
|
|
7104
7405
|
${NAME} token [\u9009\u9879] \u68C0\u67E5 API Token \u6743\u9650
|
|
7105
7406
|
${NAME} vps [\u9009\u9879] \u5728\u81EA\u5DF1\u7684 VPS \u4E0A\u90E8\u7F72 SOCKS5 \u843D\u5730\u4EE3\u7406
|
|
@@ -7111,6 +7412,7 @@ Cloudflare Pages \u4EE3\u7406\u90E8\u7F72\u4E0E\u4F18\u9009\u5DE5\u5177
|
|
|
7111
7412
|
${NAME} # \u8FDB\u83DC\u5355\uFF0C\u6309\u63D0\u793A\u64CD\u4F5C
|
|
7112
7413
|
${NAME} deploy --token <TOKEN> # \u76F4\u63A5\u90E8\u7F72
|
|
7113
7414
|
${NAME} scan --host <\u6570\u636E\u9762\u57DF\u540D> # \u76F4\u63A5\u4F18\u9009
|
|
7415
|
+
${NAME} test --host x --ip 104.16.1.1 # \u53EA\u6D4B\u4E00\u4E2A IP
|
|
7114
7416
|
${NAME} scan --host x --panel y --panel-password z # \u4F18\u9009\u5E76\u56DE\u586B
|
|
7115
7417
|
|
|
7116
7418
|
\u6587\u6863: https://github.com/xmwengxing/CFPilot
|
|
@@ -7124,11 +7426,11 @@ async function main() {
|
|
|
7124
7426
|
return;
|
|
7125
7427
|
}
|
|
7126
7428
|
if (!command && (flagBool(args, "h") || flagBool(args, "help"))) {
|
|
7127
|
-
process.stdout.write(
|
|
7429
|
+
process.stdout.write(HELP3);
|
|
7128
7430
|
return;
|
|
7129
7431
|
}
|
|
7130
7432
|
if (command === "help") {
|
|
7131
|
-
process.stdout.write(
|
|
7433
|
+
process.stdout.write(HELP3);
|
|
7132
7434
|
return;
|
|
7133
7435
|
}
|
|
7134
7436
|
switch (command) {
|
|
@@ -7148,6 +7450,11 @@ async function main() {
|
|
|
7148
7450
|
await runScanCommand2(args);
|
|
7149
7451
|
return;
|
|
7150
7452
|
}
|
|
7453
|
+
case "test": {
|
|
7454
|
+
const { runTestCommand: runTestCommand2 } = await Promise.resolve().then(() => (init_single_command(), single_command_exports));
|
|
7455
|
+
await runTestCommand2(args);
|
|
7456
|
+
return;
|
|
7457
|
+
}
|
|
7151
7458
|
case "status": {
|
|
7152
7459
|
const { runStatus: runStatus2 } = await Promise.resolve().then(() => (init_status(), status_exports));
|
|
7153
7460
|
await runStatus2();
|
|
@@ -7172,7 +7479,7 @@ async function main() {
|
|
|
7172
7479
|
process.stderr.write(`\u672A\u77E5\u547D\u4EE4\uFF1A${command}
|
|
7173
7480
|
|
|
7174
7481
|
`);
|
|
7175
|
-
process.stderr.write(
|
|
7482
|
+
process.stderr.write(HELP3);
|
|
7176
7483
|
process.exitCode = 1;
|
|
7177
7484
|
}
|
|
7178
7485
|
}
|
package/package.json
CHANGED