cfpilot 0.9.8 → 0.10.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/assets/control.js +9 -9
- package/assets/dataplane.js +5 -5
- package/assets/worker.js +15 -15
- package/dist/cli.js +15 -7
- package/package.json +1 -1
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.10.0";
|
|
91
91
|
NAME = "cfpilot";
|
|
92
92
|
}
|
|
93
93
|
});
|
|
@@ -4628,6 +4628,7 @@ function splitByWeight(cidr) {
|
|
|
4628
4628
|
return out.sort((a, b) => a.base < b.base ? -1 : a.base > b.base ? 1 : 0);
|
|
4629
4629
|
}
|
|
4630
4630
|
function expandCidrs(cidrs, options = {}) {
|
|
4631
|
+
const neutral = options.neutral === true;
|
|
4631
4632
|
const sample = options.sample ?? 2e4;
|
|
4632
4633
|
const random = makeRandom(options.seed ?? 24301);
|
|
4633
4634
|
const parsedRaw = cidrs.map(parseCidr).filter((c2) => c2 !== null);
|
|
@@ -4653,7 +4654,8 @@ function expandCidrs(cidrs, options = {}) {
|
|
|
4653
4654
|
const familyBudget = Math.max(1, Math.round(hasOtherFamily ? sample / 2 : sample));
|
|
4654
4655
|
const effectiveSize = (c2) => {
|
|
4655
4656
|
if (c2.family !== 4) return c2.size;
|
|
4656
|
-
const
|
|
4657
|
+
const raw = cidrWeight(c2.cidr);
|
|
4658
|
+
const weight = neutral ? raw > 0 ? 1 : 0 : raw;
|
|
4657
4659
|
if (weight <= 0) return 0n;
|
|
4658
4660
|
const scaled = Number(c2.size) * weight;
|
|
4659
4661
|
return scaled >= 1 ? BigInt(Math.floor(scaled)) : 0n;
|
|
@@ -4668,7 +4670,7 @@ function expandCidrs(cidrs, options = {}) {
|
|
|
4668
4670
|
}
|
|
4669
4671
|
if (familyTotal === 0n) continue;
|
|
4670
4672
|
const minForCidr = (c2) => {
|
|
4671
|
-
if (c2.family !== 4) return minPerCidr;
|
|
4673
|
+
if (c2.family !== 4 || neutral) return minPerCidr;
|
|
4672
4674
|
const w = cidrWeight(c2.cidr);
|
|
4673
4675
|
if (w >= 1) return minPerCidr;
|
|
4674
4676
|
return Math.max(1, Math.round(minPerCidr * w));
|
|
@@ -4773,8 +4775,8 @@ var init_ip_ranges = __esm({
|
|
|
4773
4775
|
// 复测 11/12,最好的一段(旧表 0.9)
|
|
4774
4776
|
"188.114.96.0/20": 0.75,
|
|
4775
4777
|
// 复测 9/12(旧表 0.3 —— 被低估 3 倍)
|
|
4776
|
-
"172.64.0.0/13": 0.
|
|
4777
|
-
// 复测 5/12
|
|
4778
|
+
"172.64.0.0/13": 0.55,
|
|
4779
|
+
// 复测 5/12;2026-10-29 用户侧实测该段出过 9.3 MB/s(NRT),不宜压太低
|
|
4778
4780
|
"103.21.244.0/22": 0.35,
|
|
4779
4781
|
// 复测 4/12
|
|
4780
4782
|
"103.31.4.0/22": 0.3,
|
|
@@ -5015,12 +5017,13 @@ async function resolveCandidates(opts = {}) {
|
|
|
5015
5017
|
const sample = opts.sample ?? DEFAULT_CANDIDATE_SAMPLE;
|
|
5016
5018
|
const seed = opts.seed ?? randomSeed();
|
|
5017
5019
|
const family = opts.family ?? "both";
|
|
5020
|
+
const neutral = opts.neutral === true;
|
|
5018
5021
|
const customCidrs = normalizeCidrInput(opts.cidr);
|
|
5019
5022
|
if (customCidrs.length > 0) {
|
|
5020
|
-
return expandCidrs(filterByFamily(customCidrs, family), { sample, seed });
|
|
5023
|
+
return expandCidrs(filterByFamily(customCidrs, family), { sample, seed, neutral });
|
|
5021
5024
|
}
|
|
5022
5025
|
const cidrs = await loadCloudflareCidrs(family);
|
|
5023
|
-
return expandCidrs(cidrs, { sample, seed });
|
|
5026
|
+
return expandCidrs(cidrs, { sample, seed, neutral });
|
|
5024
5027
|
}
|
|
5025
5028
|
function randomSeed() {
|
|
5026
5029
|
return (Date.now() ^ Math.floor(Math.random() * 4294967296)) >>> 0;
|
|
@@ -5489,6 +5492,8 @@ scan \u9009\u9879:
|
|
|
5489
5492
|
--speed-limit <n> \u8FDB\u5165\u6D4B\u901F\u7684\u5019\u9009\u6570\uFF0C\u9ED8\u8BA4 30
|
|
5490
5493
|
--speed-bytes <n> \u6D4B\u901F\u5B57\u8282\u6570\uFF0C\u9ED8\u8BA4 5242880
|
|
5491
5494
|
--timeout <ms> \u9636\u6BB5\u4E00\u8D85\u65F6\uFF0C\u9ED8\u8BA4 1200
|
|
5495
|
+
--neutral-sampling \u4E2D\u6027\u91C7\u6837\uFF1A\u5FFD\u7565\u7F51\u6BB5\u6743\u91CD\u3001\u6309\u7F51\u6BB5\u5927\u5C0F\u7B49\u6BD4\u62BD\u53D6
|
|
5496
|
+
\uFF08\u9009\u56FD\u5BB6\u7B5B\u9009\u65F6\u4F1A\u81EA\u52A8\u542F\u7528\uFF1B\u53EA\u4FDD\u7559 TCP \u5C42\u4E0D\u53EF\u8FBE\u7684\u7F51\u6BB5\uFF09
|
|
5492
5497
|
--speed-repeat <n> \u6BCF\u4E2A\u5019\u9009\u91CD\u590D\u6D4B\u901F\u6B21\u6570\uFF0C\u9ED8\u8BA4 1\uFF08>1 \u65F6\u53D6\u4E2D\u4F4D\u6570\u5E76\u663E\u793A \xB1\u6296\u52A8\uFF09
|
|
5493
5498
|
--uuid <uuid> \u771F\u5B9E\u96A7\u9053\u6821\u9A8C\u7528\u7684 VLESS UUID\uFF08\u7ED9\u4E86\u624D\u4F1A\u8DD1\u9636\u6BB5\u4E8C\u70B9\u4E94\uFF09
|
|
5494
5499
|
--trojan-password <pw> \u771F\u5B9E\u96A7\u9053\u6821\u9A8C\u7528\u7684 Trojan \u53E3\u4EE4\uFF08\u4E0E --uuid \u4E8C\u9009\u4E00\uFF09
|
|
@@ -5553,6 +5558,9 @@ async function resolveCandidatesFromArgs(args) {
|
|
|
5553
5558
|
return readIpFile(text);
|
|
5554
5559
|
}
|
|
5555
5560
|
return resolveCandidates({
|
|
5561
|
+
// 选国家时**自动中性采样**:采样发生在阶段一之前、那时还不知道机房,
|
|
5562
|
+
// 若某国家的 IP 集中在低权重网段,候选会被压少 → 可能「扫了几千个还是找不到 HKG/NRT」。
|
|
5563
|
+
neutral: args.flags["neutral-sampling"] !== void 0 || flagList(args, "countries").length > 0,
|
|
5556
5564
|
sample: flagNumber(args, "sample", 6556),
|
|
5557
5565
|
cidr: flagList(args, "cidr"),
|
|
5558
5566
|
// ⚠️ 不传 seed = 每次随机(默认)。只有用户显式给了 --seed 才固定,
|