cfpilot 0.20.0 → 0.30.0

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/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.20.0";
90
+ VERSION = "0.30.0";
91
91
  NAME = "cfpilot";
92
92
  }
93
93
  });
@@ -5523,6 +5523,10 @@ async function runScan(options) {
5523
5523
  const speedTimeoutMs = options.speedTimeoutMs ?? 12e3;
5524
5524
  const speedBytes = options.speedBytes ?? 5 * 1024 * 1024;
5525
5525
  const top = options.top ?? 8;
5526
+ const minSpeedMBps = options.minSpeedMBps ?? 0;
5527
+ if (minSpeedMBps > 0 && options.skipSpeed) {
5528
+ throw new Error("--min-speed \u4E0E\u300C\u8DF3\u8FC7\u6D4B\u901F\u300D\u4E92\u65A5\uFF1A\u8DF3\u8FC7\u6D4B\u901F\u65F6\u6CA1\u6709\u901F\u5EA6\u503C\u53EF\u7528\u4E8E\u7B5B\u9009");
5529
+ }
5526
5530
  const countryFilter = normalizeCountryFilter(options.countries ?? []);
5527
5531
  const hasCountryFilter = countryFilter.length > 0;
5528
5532
  const effectiveProbeLimit = hasCountryFilter ? Math.max(probeLimit * 4, 500) : probeLimit;
@@ -5890,7 +5894,17 @@ async function runScan(options) {
5890
5894
  })).sort(
5891
5895
  (a, b) => options.skipSpeed ? a.tlsMs - b.tlsMs || a.latency - b.latency : b.speed - a.speed || a.tlsMs - b.tlsMs || a.latency - b.latency
5892
5896
  );
5893
- const entries = pickWithDiversity(ranked, top);
5897
+ const speedFiltered = filterByMinSpeed(ranked, minSpeedMBps);
5898
+ if (minSpeedMBps > 0 && speedFiltered.length < ranked.length) {
5899
+ report({
5900
+ type: "progress",
5901
+ stage: 3,
5902
+ done: speedFiltered.length,
5903
+ total: ranked.length,
5904
+ message: `\u901F\u5EA6\u8FC7\u6EE4\uFF1A\u6DD8\u6C70 ${ranked.length - speedFiltered.length} \u4E2A\u4F4E\u4E8E ${minSpeedMBps} MB/s \u7684\u5019\u9009`
5905
+ });
5906
+ }
5907
+ const entries = pickWithDiversity(speedFiltered, top);
5894
5908
  if (options.unlock && options.uuid && entries.length > 0) {
5895
5909
  const byColo = /* @__PURE__ */ new Map();
5896
5910
  for (const entry of entries) {
@@ -6074,6 +6088,10 @@ async function coarsePreRank(options, candidates, speedLimit, report, probePath)
6074
6088
  });
6075
6089
  return rankByCoarseSpeed(candidates, coarse, speedLimit);
6076
6090
  }
6091
+ function filterByMinSpeed(entries, minSpeedMBps) {
6092
+ if (!(minSpeedMBps > 0)) return entries;
6093
+ return entries.filter((e) => e.speed >= minSpeedMBps);
6094
+ }
6077
6095
  function pickWithDiversity(ranked, top) {
6078
6096
  if (top <= 0) return [];
6079
6097
  const v4 = ranked.filter((item) => !item.ip.includes(":"));
@@ -7804,6 +7822,12 @@ scan \u9009\u9879:
7804
7822
  \u5E26\u6B64\u53C2\u6570\u4F1A\u81EA\u52A8\u6269\u5927 101 \u6821\u9A8C\u7684\u5019\u9009\u6C60\uFF08120 \u2192 \u6700\u591A 500\uFF09\uFF0C
7805
7823
  \u5426\u5219\u76EE\u6807\u5730\u533A\u53EF\u80FD\u56E0\u5EF6\u8FDF\u6392\u5E8F\u88AB\u63D0\u524D\u622A\u65AD\uFF1B
7806
7824
  \u7B5B\u4E0D\u5230\u65F6\u4F1A\u660E\u786E\u63D0\u793A\u300C\u5DF2\u653E\u5BBD\u4E3A\u5168\u91CF\u300D\u800C\u4E0D\u662F\u9759\u9ED8\u5FFD\u7565
7825
+ --min-speed <MB/s> \u4E0B\u884C\u901F\u5EA6\u4E0B\u9650\uFF0C\u9ED8\u8BA4 0\uFF08\u4E0D\u8FC7\u6EE4\uFF09
7826
+ \u6309**\u7A33\u6001**\u4E0B\u884C\u901F\u5EA6\u6DD8\u6C70\uFF0C\u5355\u4F4D MB/s\uFF0C0.1 \u5373\u53EF\u8FC7\u6EE4\u6389
7827
+ \u7EDD\u5927\u591A\u6570\u300C\u63E1\u624B\u80FD\u8FC7\u4F46\u5E26\u5BBD\u4E0D\u53EF\u7528\u300D\u7684 IP\u3002
7828
+ \u7528\u7A33\u6001\u503C\u800C\u4E0D\u662F\u5CF0\u503C\uFF1A\u5355\u7A97\u53E3\u7A81\u53D1\u80FD\u628A\u5CF0\u503C\u7FFB\u500D
7829
+ \uFF08\u5B9E\u6D4B 2.46 vs 1.14\uFF09\uFF0C\u62FF\u5CF0\u503C\u5F53\u95E8\u69DB\u4F1A\u8BEF\u7559\u5076\u7136\u51B2\u9AD8\u7684 IP\u3002
7830
+ \u4E0E --no-speed\uFF08\u8DF3\u8FC7\u6D4B\u901F\uFF09\u4E92\u65A5
7807
7831
  --cidr <a,b> \u81EA\u5B9A\u4E49\u7F51\u6BB5\uFF08\u53EF\u91CD\u590D\uFF0C\u7528\u9017\u53F7\u5206\u9694\uFF09
7808
7832
  --ip-file <path> \u4F7F\u7528\u672C\u5730 IP \u5217\u8868\u6587\u4EF6
7809
7833
  --ip-url <\u94FE\u63A5> \u4F7F\u7528\u8FDC\u7A0B IP \u5217\u8868\uFF08http/https\uFF0C\u4E0A\u9650 2MB\uFF0C\u4E0E --ip-file \u4E8C\u9009\u4E00\uFF09
@@ -9494,6 +9518,11 @@ async function runScanCommand(args) {
9494
9518
  "/xhttp"
9495
9519
  ).replace(/\/+$/, "") || "/xhttp";
9496
9520
  const noSpeed = flagBool(args, "no-speed");
9521
+ const minSpeedMBps = Math.max(0, flagNumber(args, "min-speed", 0));
9522
+ if (minSpeedMBps > 0 && noSpeed) {
9523
+ process.stderr.write("--min-speed \u4E0E --no-speed\uFF08\u8DF3\u8FC7\u6D4B\u901F\uFF09\u4E92\u65A5\uFF1A\u6CA1\u6709\u901F\u5EA6\u503C\u53EF\u7528\u4E8E\u7B5B\u9009\n");
9524
+ process.exit(1);
9525
+ }
9497
9526
  const countries = normalizeCountryFilter(flagList(args, "countries"));
9498
9527
  const panelHost = flagString(args, "panel");
9499
9528
  const panelPassword = flagString(args, "panel-password");
@@ -9534,6 +9563,10 @@ ${NAME} v${VERSION}
9534
9563
  `);
9535
9564
  if (countries.length > 0) {
9536
9565
  process.stdout.write(`\u56FD\u5BB6\u7B5B\u9009\uFF1A${countries.join(" / ")}\uFF08\u4E0D\u586B\u5219\u5168\u91CF\uFF09
9566
+ `);
9567
+ }
9568
+ if (minSpeedMBps > 0) {
9569
+ process.stdout.write(`\u901F\u5EA6\u8FC7\u6EE4\uFF1A\u4F4E\u4E8E ${minSpeedMBps} MB/s \u7684\u5019\u9009\u6DD8\u6C70
9537
9570
  `);
9538
9571
  }
9539
9572
  }
@@ -9649,6 +9682,7 @@ ${NAME} v${VERSION}
9649
9682
  wsPath,
9650
9683
  probePath,
9651
9684
  skipSpeed,
9685
+ minSpeedMBps,
9652
9686
  verifyPayload,
9653
9687
  concurrency: flagNumber(args, "concurrency", 300),
9654
9688
  retries: flagNumber(args, "retries", 2),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cfpilot",
3
- "version": "0.20.0",
3
+ "version": "0.30.0",
4
4
  "description": "CFPilot —— Cloudflare Pages 代理部署与优选工具(交互菜单 + 子命令)",
5
5
  "type": "module",
6
6
  "license": "AGPL-3.0-only",