From ae07753931365b903ecf3f4349f482aae611e2f9 Mon Sep 17 00:00:00 2001 From: cmliu Date: Tue, 27 Jan 2026 21:44:32 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=9B=B4=E6=96=B0=E7=94=9F=E6=88=90?= =?UTF-8?q?=E9=9A=8F=E6=9C=BAIP=E5=87=BD=E6=95=B0=EF=BC=8C=E9=87=8D?= =?UTF-8?q?=E6=9E=84ISP=E9=85=8D=E7=BD=AE=E9=80=BB=E8=BE=91=E4=BB=A5?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E6=9B=B4=E5=A4=9AASN=E5=B9=B6=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E4=BB=A3=E7=A0=81=E5=8F=AF=E8=AF=BB=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- _worker.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/_worker.js b/_worker.js index a145310..ba2d014 100644 --- a/_worker.js +++ b/_worker.js @@ -1508,9 +1508,16 @@ async function 读取config_JSON(env, hostname, userID, 重置配置 = false) { } async function 生成随机IP(request, count = 16, 指定端口 = -1) { - const asnMap = { '9808': 'cmcc', '4837': 'cu', '17623': 'cu', '4134': 'ct' }, asn = request.cf.asn; - 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'; - const cfname = { '9808': 'CF移动优选', '4837': 'CF联通优选', '17623': 'CF联通优选', '4134': 'CF电信优选' }[asn] || 'CF官方优选'; + const ISP配置 = { + '9808': { file: 'cmcc', name: 'CF移动优选' }, + '4837': { file: 'cu', name: 'CF联通优选' }, + '17623': { file: 'cu', name: 'CF联通优选' }, + '17816': { file: 'cu', name: 'CF联通优选' }, + '4134': { file: 'ct', name: 'CF电信优选' }, + }; + const asn = request.cf.asn, isp = ISP配置[asn]; + 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'; + const cfname = isp?.name || 'CF官方优选'; const cfport = [443, 2053, 2083, 2087, 2096, 8443]; let cidrList = []; 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']; }