Skip to content

Commit 17a03d5

Browse files
authored
Merge pull request cmliu#935 from cmliu/beta2.0
Beta2.0
2 parents 8caa844 + 53ddc0d commit 17a03d5

1 file changed

Lines changed: 16 additions & 5 deletions

File tree

_worker.js

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -803,11 +803,15 @@ function Clash订阅配置文件热补丁(Clash_原始订阅内容, uuid = null,
803803
- 208.67.220.220
804804
fallback-filter:
805805
geoip: true
806-
domain: [+.google.com, +.facebook.com, +.youtube.com]
806+
geoip-code: CN
807807
ipcidr:
808808
- 240.0.0.0/4
809+
- 127.0.0.1/32
809810
- 0.0.0.0/32
810-
geoip-code: CN
811+
domain:
812+
- '+.google.com'
813+
- '+.facebook.com'
814+
- '+.youtube.com'
811815
`;
812816

813817
// 检查是否存在 dns: 字段(可能在任意行,行首无缩进)
@@ -1508,9 +1512,16 @@ async function 读取config_JSON(env, hostname, userID, 重置配置 = false) {
15081512
}
15091513

15101514
async function 生成随机IP(request, count = 16, 指定端口 = -1) {
1511-
const asnMap = { '9808': 'cmcc', '4837': 'cu', '17623': 'cu', '4134': 'ct' }, asn = request.cf.asn;
1512-
const cidr_url = asnMap[asn] ? `https://raw.githubusercontent.com/cmliu/cmliu/main/CF-CIDR/${asnMap[asn]}.txt` : 'https://raw.githubusercontent.com/cmliu/cmliu/main/CF-CIDR.txt';
1513-
const cfname = { '9808': 'CF移动优选', '4837': 'CF联通优选', '17623': 'CF联通优选', '4134': 'CF电信优选' }[asn] || 'CF官方优选';
1515+
const ISP配置 = {
1516+
'9808': { file: 'cmcc', name: 'CF移动优选' },
1517+
'4837': { file: 'cu', name: 'CF联通优选' },
1518+
'17623': { file: 'cu', name: 'CF联通优选' },
1519+
'17816': { file: 'cu', name: 'CF联通优选' },
1520+
'4134': { file: 'ct', name: 'CF电信优选' },
1521+
};
1522+
const asn = request.cf.asn, isp = ISP配置[asn];
1523+
const cidr_url = isp ? `https://raw.githubusercontent.com/cmliu/cmliu/main/CF-CIDR/${isp.file}.txt` : 'https://raw.githubusercontent.com/cmliu/cmliu/main/CF-CIDR.txt';
1524+
const cfname = isp?.name || 'CF官方优选';
15141525
const cfport = [443, 2053, 2083, 2087, 2096, 8443];
15151526
let cidrList = [];
15161527
try { const res = await fetch(cidr_url); cidrList = res.ok ? await 整理成数组(await res.text()) : ['104.16.0.0/13']; } catch { cidrList = ['104.16.0.0/13']; }

0 commit comments

Comments
 (0)