Initialize rule providers and README
This commit is contained in:
@@ -0,0 +1,1612 @@
|
|||||||
|
/**
|
||||||
|
* ============================================================
|
||||||
|
* Sub-Store → Mihomo / Clash Meta 配置生成器
|
||||||
|
* ============================================================
|
||||||
|
*
|
||||||
|
* 当前版本:v1.2.0
|
||||||
|
* 更新时间:2026-08-23
|
||||||
|
*
|
||||||
|
* v1.2.0
|
||||||
|
* ────────────────────────────────────────────────────────────
|
||||||
|
* 1. 重构地区节点分类
|
||||||
|
* - 每个节点只进行一次地区分类
|
||||||
|
* - 保持香港 / 台湾 / 日本 / 新加坡 / 美国 / 韩国 / 其他
|
||||||
|
* 的优先级顺序
|
||||||
|
*
|
||||||
|
* 2. 修复 AI 节点兜底逻辑
|
||||||
|
* - 香港永远不会进入人工智能策略
|
||||||
|
* - 无非香港地区节点时,AI 使用 DIRECT
|
||||||
|
* - 不再通过自动选择间接引入香港
|
||||||
|
*
|
||||||
|
* 3. 优化策略组排序
|
||||||
|
* - 🚀 节点选择
|
||||||
|
* - ♻️ 自动选择
|
||||||
|
* - 🔯 故障转移
|
||||||
|
* 放置在最顶部
|
||||||
|
*
|
||||||
|
* 4. 统一策略组创建逻辑
|
||||||
|
* - 减少重复代码
|
||||||
|
* - 统一候选节点去重
|
||||||
|
* - 降低后续维护难度
|
||||||
|
*
|
||||||
|
* 5. 优化空策略组处理
|
||||||
|
* - 没有节点的地区自动隐藏
|
||||||
|
* - 🇨🇳 其他节点为空时自动隐藏
|
||||||
|
*
|
||||||
|
* 6. 保留原有功能
|
||||||
|
* - TUN
|
||||||
|
* - DNS
|
||||||
|
* - Sniffer
|
||||||
|
* - Fake-IP
|
||||||
|
* - Rule Provider
|
||||||
|
* - AI
|
||||||
|
* - 海外服务
|
||||||
|
* - 网络测试
|
||||||
|
* - 广告拦截
|
||||||
|
* - 代理域名
|
||||||
|
* - 全球直连
|
||||||
|
* - 最终兜底
|
||||||
|
*
|
||||||
|
* 7. 保留原测速参数
|
||||||
|
* - URL:https://www.gstatic.com/generate_204
|
||||||
|
* - interval:600
|
||||||
|
* - timeout:3000
|
||||||
|
* - tolerance:80
|
||||||
|
* - lazy:true
|
||||||
|
* - max-failed-times:3
|
||||||
|
*
|
||||||
|
* 版本:v1.1.0
|
||||||
|
* 更新时间:2026-08-22
|
||||||
|
*
|
||||||
|
* v1.1.0
|
||||||
|
* ────────────────────────────────────────────────────────────
|
||||||
|
* 1. 重构“🇨🇳 其他节点”
|
||||||
|
* - 仅作为真正的地区兜底节点组
|
||||||
|
* - 不属于香港 / 台湾 / 日本 / 新加坡 / 美国 / 韩国
|
||||||
|
* 的节点全部进入这里
|
||||||
|
* - 没有其他节点时自动隐藏
|
||||||
|
*
|
||||||
|
* 2. “💬 GPT专用”更名为“🤖 人工智能”
|
||||||
|
* - 不再只针对 GPT
|
||||||
|
* - 香港节点不加入人工智能节点
|
||||||
|
* - 台湾 / 日本 / 新加坡 / 美国 / 韩国 / 其他节点
|
||||||
|
* 均可参与人工智能节点选择
|
||||||
|
*
|
||||||
|
* 3. “🐟 漏网之鱼”更名为“🛟 兜底策略”
|
||||||
|
* - MATCH 最终兜底策略名称同步修改
|
||||||
|
*
|
||||||
|
* 4. 合并重复策略组
|
||||||
|
* - 微软服务
|
||||||
|
* - 苹果服务
|
||||||
|
* - 游戏平台
|
||||||
|
* - 国内 IP
|
||||||
|
* - 直连域名
|
||||||
|
* - 直连软件
|
||||||
|
* - 私有网络
|
||||||
|
* 等不再单独创建重复 Select 组
|
||||||
|
*
|
||||||
|
* 5. 统一直连策略
|
||||||
|
* - 所有确定应该 DIRECT 的规则统一进入:
|
||||||
|
* 🎯 全球直连
|
||||||
|
*
|
||||||
|
* 6. 减少策略组数量
|
||||||
|
* - 保留真正有实际选择意义的策略组
|
||||||
|
* - 降低 Clash Meta Android 界面复杂度
|
||||||
|
*
|
||||||
|
* 7. 优化自动选择
|
||||||
|
* - 地区内部先选择最佳节点
|
||||||
|
* - 自动选择再选择最佳地区
|
||||||
|
* - 避免直接对所有节点重复测速
|
||||||
|
*
|
||||||
|
* 8. 优化人工智能节点
|
||||||
|
* - 使用地区组作为候选
|
||||||
|
* - 避免人工智能策略组重复测速所有具体节点
|
||||||
|
*
|
||||||
|
* 9. 优化 Android 后台运行
|
||||||
|
* - URL-Test:600 秒
|
||||||
|
* - Fallback:600 秒
|
||||||
|
* - tolerance:80ms
|
||||||
|
* - lazy:true
|
||||||
|
*
|
||||||
|
* ============================================================
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/* ============================================================
|
||||||
|
* 1. 基础配置
|
||||||
|
* ============================================================ */
|
||||||
|
|
||||||
|
const generalConfig = {
|
||||||
|
|
||||||
|
"mode": "rule",
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 关闭 IPv6。
|
||||||
|
*
|
||||||
|
* 移动网络环境下优先保证稳定性。
|
||||||
|
*/
|
||||||
|
"ipv6": false,
|
||||||
|
|
||||||
|
"log-level": "silent",
|
||||||
|
|
||||||
|
"allow-lan": true,
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 统一延迟计算。
|
||||||
|
*/
|
||||||
|
"unified-delay": true,
|
||||||
|
|
||||||
|
/*
|
||||||
|
* TCP 并发连接。
|
||||||
|
*/
|
||||||
|
"tcp-concurrent": true,
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 严格进程匹配。
|
||||||
|
*/
|
||||||
|
"find-process-mode": "strict",
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Chrome TLS 指纹。
|
||||||
|
*/
|
||||||
|
"global-client-fingerprint": "chrome",
|
||||||
|
|
||||||
|
"profile": {
|
||||||
|
"store-selected": true,
|
||||||
|
"store-fake-ip": true
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/* ============================================================
|
||||||
|
* 2. Sniffer
|
||||||
|
* ============================================================ */
|
||||||
|
|
||||||
|
const snifferConfig = {
|
||||||
|
|
||||||
|
"enable": true,
|
||||||
|
|
||||||
|
"parse-pure-ip": true,
|
||||||
|
|
||||||
|
"sniff": {
|
||||||
|
|
||||||
|
"HTTP": {
|
||||||
|
"ports": [
|
||||||
|
80,
|
||||||
|
"8080-8880"
|
||||||
|
],
|
||||||
|
"override-destination": true
|
||||||
|
},
|
||||||
|
|
||||||
|
"TLS": {
|
||||||
|
"ports": [
|
||||||
|
443,
|
||||||
|
8443
|
||||||
|
]
|
||||||
|
},
|
||||||
|
|
||||||
|
"QUIC": {
|
||||||
|
"ports": [
|
||||||
|
443,
|
||||||
|
8443
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
"skip-domain": [
|
||||||
|
"Mijia Cloud"
|
||||||
|
]
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/* ============================================================
|
||||||
|
* 3. TUN
|
||||||
|
* ============================================================ */
|
||||||
|
|
||||||
|
const tunConfig = {
|
||||||
|
|
||||||
|
"enable": true,
|
||||||
|
|
||||||
|
"stack": "system",
|
||||||
|
|
||||||
|
"dns-hijack": [
|
||||||
|
"any:53"
|
||||||
|
],
|
||||||
|
|
||||||
|
"auto-route": true,
|
||||||
|
|
||||||
|
"auto-detect-interface": true,
|
||||||
|
|
||||||
|
"strict-route": true
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/* ============================================================
|
||||||
|
* 4. DNS
|
||||||
|
* ============================================================ */
|
||||||
|
|
||||||
|
const dnsConfig = {
|
||||||
|
|
||||||
|
"enable": true,
|
||||||
|
|
||||||
|
"ipv6": false,
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 移动网络环境下优先稳定性。
|
||||||
|
*/
|
||||||
|
"prefer-h3": false,
|
||||||
|
|
||||||
|
"listen": "0.0.0.0:53",
|
||||||
|
|
||||||
|
"fake-ip-range": "198.18.0.1/16",
|
||||||
|
|
||||||
|
"enhanced-mode": "fake-ip",
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 主 DNS。
|
||||||
|
*/
|
||||||
|
"nameserver": [
|
||||||
|
"https://dns.alidns.com/dns-query",
|
||||||
|
"https://doh.pub/dns-query"
|
||||||
|
],
|
||||||
|
|
||||||
|
/*
|
||||||
|
* DNS 备用。
|
||||||
|
*/
|
||||||
|
"fallback": [
|
||||||
|
"223.5.5.5",
|
||||||
|
"119.29.29.29"
|
||||||
|
],
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 启动阶段 DNS。
|
||||||
|
*/
|
||||||
|
"default-nameserver": [
|
||||||
|
"223.5.5.5",
|
||||||
|
"114.114.114.114"
|
||||||
|
],
|
||||||
|
|
||||||
|
/*
|
||||||
|
* DNS 回退过滤。
|
||||||
|
*/
|
||||||
|
"fallback-filter": {
|
||||||
|
|
||||||
|
"geoip": true,
|
||||||
|
|
||||||
|
"geoip-code": "CN",
|
||||||
|
|
||||||
|
"geosite": [
|
||||||
|
"gfw"
|
||||||
|
],
|
||||||
|
|
||||||
|
"ipcidr": [
|
||||||
|
"240.0.0.0/4",
|
||||||
|
"0.0.0.0/32",
|
||||||
|
"127.0.0.1/32"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Fake-IP 排除列表。
|
||||||
|
*/
|
||||||
|
"fake-ip-filter": [
|
||||||
|
|
||||||
|
"*.lan",
|
||||||
|
"*.localdomain",
|
||||||
|
"*.example",
|
||||||
|
"*.invalid",
|
||||||
|
"*.localhost",
|
||||||
|
"*.test",
|
||||||
|
"*.local",
|
||||||
|
"*.home.arpa",
|
||||||
|
|
||||||
|
"*.woozooo.com",
|
||||||
|
"*.kiid.top",
|
||||||
|
"43.142.112.88",
|
||||||
|
|
||||||
|
"time.*.com",
|
||||||
|
"time.*.gov",
|
||||||
|
"time.*.edu.cn",
|
||||||
|
"time.*.apple.com",
|
||||||
|
"time-ios.apple.com",
|
||||||
|
|
||||||
|
"time1.*.com",
|
||||||
|
"time2.*.com",
|
||||||
|
"time3.*.com",
|
||||||
|
"time4.*.com",
|
||||||
|
"time5.*.com",
|
||||||
|
"time6.*.com",
|
||||||
|
"time7.*.com",
|
||||||
|
|
||||||
|
"ntp.*.com",
|
||||||
|
"ntp1.*.com",
|
||||||
|
"ntp2.*.com",
|
||||||
|
"ntp3.*.com",
|
||||||
|
"ntp4.*.com",
|
||||||
|
"ntp5.*.com",
|
||||||
|
"ntp6.*.com",
|
||||||
|
"ntp7.*.com",
|
||||||
|
|
||||||
|
"*.time.edu.cn",
|
||||||
|
"*.ntp.org.cn",
|
||||||
|
"+.pool.ntp.org",
|
||||||
|
"time1.cloud.tencent.com",
|
||||||
|
|
||||||
|
"music.163.com",
|
||||||
|
"*.music.163.com",
|
||||||
|
"*.126.net",
|
||||||
|
|
||||||
|
"musicapi.taihe.com",
|
||||||
|
"music.taihe.com",
|
||||||
|
|
||||||
|
"songsearch.kugou.com",
|
||||||
|
"trackercdn.kugou.com",
|
||||||
|
|
||||||
|
"*.kuwo.cn",
|
||||||
|
"api-jooxtt.sanook.com",
|
||||||
|
"api.joox.com",
|
||||||
|
"joox.com",
|
||||||
|
|
||||||
|
"y.qq.com",
|
||||||
|
"*.y.qq.com",
|
||||||
|
"streamoc.music.tc.qq.com",
|
||||||
|
"mobileoc.music.tc.qq.com",
|
||||||
|
"isure.stream.qqmusic.qq.com",
|
||||||
|
"dl.stream.qq.com",
|
||||||
|
"aqqmusic.tc.qq.com",
|
||||||
|
"amobile.music.tc.qq.com",
|
||||||
|
|
||||||
|
"*.xiami.com",
|
||||||
|
"*.music.migu.cn",
|
||||||
|
"music.migu.cn",
|
||||||
|
|
||||||
|
"+.msftconnecttest.com",
|
||||||
|
"+.msftncsi.com",
|
||||||
|
|
||||||
|
"localhost.ptlogin2.qq.com",
|
||||||
|
"localhost.sec.qq.com",
|
||||||
|
"+.qq.com",
|
||||||
|
"+.tencent.com",
|
||||||
|
|
||||||
|
"+.srv.nintendo.net",
|
||||||
|
"*.n.n.srv.nintendo.net",
|
||||||
|
"+.stun.playstation.net",
|
||||||
|
|
||||||
|
"xbox.*.*.microsoft.com",
|
||||||
|
"*.*.xboxlive.com",
|
||||||
|
"xbox.*.microsoft.com",
|
||||||
|
"xnotify.xboxlive.com",
|
||||||
|
|
||||||
|
"+.battlenet.com.cn",
|
||||||
|
"+.wotgame.cn",
|
||||||
|
"+.wggames.cn",
|
||||||
|
"+.wowsgame.cn",
|
||||||
|
"+.wargaming.net",
|
||||||
|
|
||||||
|
"proxy.golang.org",
|
||||||
|
|
||||||
|
"stun.*.*",
|
||||||
|
"stun.*.*.*",
|
||||||
|
"+.stun.*.*",
|
||||||
|
"+.stun.*.*.*",
|
||||||
|
"+.stun.*.*.*.*",
|
||||||
|
"+.stun.*.*.*.*.*",
|
||||||
|
|
||||||
|
"heartbeat.belkin.com",
|
||||||
|
"*.linksys.com",
|
||||||
|
"*.linksyssmartwifi.com",
|
||||||
|
"*.router.asus.com",
|
||||||
|
|
||||||
|
"mesu.apple.com",
|
||||||
|
"swscan.apple.com",
|
||||||
|
"swquery.apple.com",
|
||||||
|
"swdownload.apple.com",
|
||||||
|
"swdist.apple.com",
|
||||||
|
|
||||||
|
"lens.l.google.com",
|
||||||
|
"stun.l.google.com",
|
||||||
|
"na.b.g-tun.com",
|
||||||
|
|
||||||
|
"+.nflxvideo.net",
|
||||||
|
|
||||||
|
"*.square-enix.com",
|
||||||
|
"*.finalfantasyxiv.com",
|
||||||
|
"*.ffxiv.com",
|
||||||
|
"*.ff14.sdo.com",
|
||||||
|
"ff.dorado.sdo.com",
|
||||||
|
|
||||||
|
"*.mcdn.bilivideo.cn",
|
||||||
|
"+.media.dssott.com",
|
||||||
|
|
||||||
|
"shark007.net",
|
||||||
|
"Mijia Cloud",
|
||||||
|
|
||||||
|
"+.cmbchina.com",
|
||||||
|
"+.cmbimg.com",
|
||||||
|
|
||||||
|
"adguardteam.github.io",
|
||||||
|
"adrules.top",
|
||||||
|
"anti-ad.net",
|
||||||
|
"local.adguard.org",
|
||||||
|
"static.adtidy.org",
|
||||||
|
|
||||||
|
"+.sandai.net",
|
||||||
|
"+.n0808.com",
|
||||||
|
"+.3gppnetwork.org"
|
||||||
|
]
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/* ============================================================
|
||||||
|
* 5. 节点名称过滤
|
||||||
|
* ============================================================ */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 排除:
|
||||||
|
*
|
||||||
|
* - 回国
|
||||||
|
* - 校园
|
||||||
|
* - 游戏
|
||||||
|
* - 通知
|
||||||
|
* - 流量
|
||||||
|
* - 到期
|
||||||
|
* - 官网
|
||||||
|
* - 客服
|
||||||
|
* - 机场
|
||||||
|
* - 邀请
|
||||||
|
* - 返利
|
||||||
|
* - 循环
|
||||||
|
* - 备用
|
||||||
|
* - 过期
|
||||||
|
* - 已用
|
||||||
|
* - 联系
|
||||||
|
* - 邮箱
|
||||||
|
* - 工单
|
||||||
|
* - 贩卖
|
||||||
|
* - 倒卖
|
||||||
|
* - 防止
|
||||||
|
* - 国内
|
||||||
|
* - 地址
|
||||||
|
* - 频道
|
||||||
|
* - 无法
|
||||||
|
* - 说明
|
||||||
|
* - 使用
|
||||||
|
* - 提示
|
||||||
|
* - 特别
|
||||||
|
* - 访问
|
||||||
|
* - 支持
|
||||||
|
* - 教程
|
||||||
|
* - 关注
|
||||||
|
* - 更新
|
||||||
|
* - 作者
|
||||||
|
* - 加入
|
||||||
|
* - 超时
|
||||||
|
* - 收藏
|
||||||
|
* - 福利
|
||||||
|
* - 失联
|
||||||
|
* 等非实际代理节点。
|
||||||
|
*/
|
||||||
|
|
||||||
|
const nodeNameExcludeReg =
|
||||||
|
/回国|校园|游戏|通知|流量|到期|官网|客服|机场|邀请|返利|循环|备用|过期|已用|联系|邮箱|工单|贩卖|倒卖|防止|国内|地址|频道|无法|说明|使用|提示|特别|访问|支持|教程|关注|更新|作者|加入|超时|收藏|福利|失联|\b(USE|USED|TOTAL|EXPIRE|EMAIL|PANEL|CHANNEL|AUTHOR|TRAFFIC)\b|compatible/i;
|
||||||
|
|
||||||
|
|
||||||
|
/* ============================================================
|
||||||
|
* 6. 地区定义
|
||||||
|
* ============================================================ */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 地区匹配优先级:
|
||||||
|
*
|
||||||
|
* 1. 香港
|
||||||
|
* 2. 台湾
|
||||||
|
* 3. 日本
|
||||||
|
* 4. 新加坡
|
||||||
|
* 5. 美国
|
||||||
|
* 6. 韩国
|
||||||
|
* 7. 其他
|
||||||
|
*
|
||||||
|
* 其他没有 pattern,
|
||||||
|
* 只负责接收没有匹配任何已知地区的节点。
|
||||||
|
*/
|
||||||
|
|
||||||
|
const regionDefinitions = [
|
||||||
|
|
||||||
|
{
|
||||||
|
key: "hongKong",
|
||||||
|
groupName: "🇭🇰 香港节点",
|
||||||
|
pattern: /🇭🇰|香港|\b(HK|HKG|Hong Kong)\b/i
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
key: "taiwan",
|
||||||
|
groupName: "🇹🇼 台湾节点",
|
||||||
|
pattern: /🇹🇼|台湾|\b(TW|TWN|Taiwan)\b/i
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
key: "japan",
|
||||||
|
groupName: "🇯🇵 日本节点",
|
||||||
|
pattern: /🇯🇵|日本|\b(JP|JPN|Japan)\b/i
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
key: "singapore",
|
||||||
|
groupName: "🇸🇬 新加坡节点",
|
||||||
|
pattern: /🇸🇬|新加坡|狮城|\b(SG|SGP|Singapore)\b/i
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
key: "usa",
|
||||||
|
groupName: "🇺🇸 美国节点",
|
||||||
|
pattern: /🇺🇸|美国|\b(US|USA|United States)\b/i
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
key: "korea",
|
||||||
|
groupName: "🇰🇷 韩国节点",
|
||||||
|
pattern: /🇰🇷|韩国|首尔|\b(KR|KOR|Korea)\b/i
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
key: "other",
|
||||||
|
groupName: "🇨🇳 其他节点",
|
||||||
|
pattern: null
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
|
||||||
|
/* ============================================================
|
||||||
|
* 7. AI 地区
|
||||||
|
* ============================================================ */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 香港明确排除。
|
||||||
|
*
|
||||||
|
* AI 可以使用:
|
||||||
|
*
|
||||||
|
* 台湾
|
||||||
|
* 日本
|
||||||
|
* 新加坡
|
||||||
|
* 美国
|
||||||
|
* 韩国
|
||||||
|
* 其他
|
||||||
|
*/
|
||||||
|
|
||||||
|
const aiRegionKeys = [
|
||||||
|
|
||||||
|
"taiwan",
|
||||||
|
|
||||||
|
"japan",
|
||||||
|
|
||||||
|
"singapore",
|
||||||
|
|
||||||
|
"usa",
|
||||||
|
|
||||||
|
"korea",
|
||||||
|
|
||||||
|
"other"
|
||||||
|
];
|
||||||
|
|
||||||
|
|
||||||
|
/* ============================================================
|
||||||
|
* 8. 测速配置
|
||||||
|
* ============================================================ */
|
||||||
|
|
||||||
|
const speedTestUrl =
|
||||||
|
"https://www.gstatic.com/generate_204";
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 所有 URL-Test 统一使用此参数。
|
||||||
|
*/
|
||||||
|
|
||||||
|
const urlTestDefaults = {
|
||||||
|
|
||||||
|
"interval": 600,
|
||||||
|
|
||||||
|
"timeout": 3000,
|
||||||
|
|
||||||
|
"url": speedTestUrl,
|
||||||
|
|
||||||
|
"lazy": true,
|
||||||
|
|
||||||
|
"max-failed-times": 3,
|
||||||
|
|
||||||
|
"tolerance": 80
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/* ============================================================
|
||||||
|
* 9. Rule Provider
|
||||||
|
* ============================================================ */
|
||||||
|
|
||||||
|
const mirrorBaseUrl =
|
||||||
|
"https://ghproxy.net/";
|
||||||
|
|
||||||
|
|
||||||
|
const ruleProviders = {
|
||||||
|
|
||||||
|
"ads": {
|
||||||
|
"type": "http",
|
||||||
|
"behavior": "domain",
|
||||||
|
"format": "text",
|
||||||
|
"path": "./rules/adss.list",
|
||||||
|
"url": mirrorBaseUrl +
|
||||||
|
"https://raw.githubusercontent.com/DustinWin/ruleset_geodata/clash-ruleset/ads.list",
|
||||||
|
"interval": 86400
|
||||||
|
},
|
||||||
|
|
||||||
|
"applications": {
|
||||||
|
"type": "http",
|
||||||
|
"behavior": "classical",
|
||||||
|
"format": "text",
|
||||||
|
"path": "./rules/applicationss.list",
|
||||||
|
"url": mirrorBaseUrl +
|
||||||
|
"https://raw.githubusercontent.com/DustinWin/ruleset_geodata/clash-ruleset/applications.list",
|
||||||
|
"interval": 86400
|
||||||
|
},
|
||||||
|
|
||||||
|
"private": {
|
||||||
|
"type": "http",
|
||||||
|
"behavior": "domain",
|
||||||
|
"format": "text",
|
||||||
|
"path": "./rules/privates.list",
|
||||||
|
"url": mirrorBaseUrl +
|
||||||
|
"https://raw.githubusercontent.com/DustinWin/ruleset_geodata/clash-ruleset/private.list",
|
||||||
|
"filter": "^((?!openai).)*$",
|
||||||
|
"interval": 86400
|
||||||
|
},
|
||||||
|
|
||||||
|
"microsoft-cn": {
|
||||||
|
"type": "http",
|
||||||
|
"behavior": "domain",
|
||||||
|
"format": "text",
|
||||||
|
"path": "./rules/microsoft-cns.list",
|
||||||
|
"url": mirrorBaseUrl +
|
||||||
|
"https://raw.githubusercontent.com/DustinWin/ruleset_geodata/clash-ruleset/microsoft-cn.list",
|
||||||
|
"interval": 86400
|
||||||
|
},
|
||||||
|
|
||||||
|
"openai": {
|
||||||
|
"type": "http",
|
||||||
|
"behavior": "domain",
|
||||||
|
"format": "text",
|
||||||
|
"path": "./rules/openais.list",
|
||||||
|
"url": mirrorBaseUrl +
|
||||||
|
"https://raw.githubusercontent.com/DustinWin/ruleset_geodata/mihomo-ruleset/ai.list",
|
||||||
|
"interval": 86400
|
||||||
|
},
|
||||||
|
|
||||||
|
"apple-cn": {
|
||||||
|
"type": "http",
|
||||||
|
"behavior": "domain",
|
||||||
|
"format": "text",
|
||||||
|
"path": "./rules/apple-cns.list",
|
||||||
|
"url": mirrorBaseUrl +
|
||||||
|
"https://raw.githubusercontent.com/DustinWin/ruleset_geodata/clash-ruleset/apple-cn.list",
|
||||||
|
"interval": 86400
|
||||||
|
},
|
||||||
|
|
||||||
|
"google-cn": {
|
||||||
|
"type": "http",
|
||||||
|
"behavior": "domain",
|
||||||
|
"format": "text",
|
||||||
|
"path": "./rules/google-cns.list",
|
||||||
|
"url": mirrorBaseUrl +
|
||||||
|
"https://raw.githubusercontent.com/DustinWin/ruleset_geodata/clash-ruleset/google-cn.list",
|
||||||
|
"interval": 86400
|
||||||
|
},
|
||||||
|
|
||||||
|
"games-cn": {
|
||||||
|
"type": "http",
|
||||||
|
"behavior": "domain",
|
||||||
|
"format": "text",
|
||||||
|
"path": "./rules/games-cns.list",
|
||||||
|
"url": mirrorBaseUrl +
|
||||||
|
"https://raw.githubusercontent.com/DustinWin/ruleset_geodata/clash-ruleset/games-cn.list",
|
||||||
|
"interval": 86400
|
||||||
|
},
|
||||||
|
|
||||||
|
"networktest": {
|
||||||
|
"type": "http",
|
||||||
|
"behavior": "classical",
|
||||||
|
"format": "text",
|
||||||
|
"path": "./rules/networktests.list",
|
||||||
|
"url": mirrorBaseUrl +
|
||||||
|
"https://raw.githubusercontent.com/DustinWin/ruleset_geodata/clash-ruleset/networktest.list",
|
||||||
|
"interval": 86400
|
||||||
|
},
|
||||||
|
|
||||||
|
"proxy": {
|
||||||
|
"type": "http",
|
||||||
|
"behavior": "domain",
|
||||||
|
"format": "text",
|
||||||
|
"path": "./rules/proxys.list",
|
||||||
|
"url": mirrorBaseUrl +
|
||||||
|
"https://raw.githubusercontent.com/y7478729/ruleset_geodata/clash-ruleset/proxy.list",
|
||||||
|
"interval": 86400
|
||||||
|
},
|
||||||
|
|
||||||
|
"cn": {
|
||||||
|
"type": "http",
|
||||||
|
"behavior": "domain",
|
||||||
|
"format": "text",
|
||||||
|
"path": "./rules/cns.list",
|
||||||
|
"url": mirrorBaseUrl +
|
||||||
|
"https://raw.githubusercontent.com/DustinWin/ruleset_geodata/clash-ruleset/cn.list",
|
||||||
|
"interval": 86400
|
||||||
|
},
|
||||||
|
|
||||||
|
"telegramip": {
|
||||||
|
"type": "http",
|
||||||
|
"behavior": "ipcidr",
|
||||||
|
"format": "text",
|
||||||
|
"path": "./rules/telegramips.list",
|
||||||
|
"url": mirrorBaseUrl +
|
||||||
|
"https://raw.githubusercontent.com/DustinWin/ruleset_geodata/clash-ruleset/telegramip.list",
|
||||||
|
"interval": 86400
|
||||||
|
},
|
||||||
|
|
||||||
|
"privateip": {
|
||||||
|
"type": "http",
|
||||||
|
"behavior": "ipcidr",
|
||||||
|
"format": "text",
|
||||||
|
"path": "./rules/privateips.list",
|
||||||
|
"url": mirrorBaseUrl +
|
||||||
|
"https://raw.githubusercontent.com/DustinWin/ruleset_geodata/clash-ruleset/privateip.list",
|
||||||
|
"interval": 86400
|
||||||
|
},
|
||||||
|
|
||||||
|
"cnip": {
|
||||||
|
"type": "http",
|
||||||
|
"behavior": "ipcidr",
|
||||||
|
"format": "text",
|
||||||
|
"path": "./rules/cnips.list",
|
||||||
|
"url": mirrorBaseUrl +
|
||||||
|
"https://raw.githubusercontent.com/DustinWin/ruleset_geodata/clash-ruleset/cnip.list",
|
||||||
|
"interval": 86400
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/* ============================================================
|
||||||
|
* 10. 分流规则
|
||||||
|
* ============================================================ */
|
||||||
|
|
||||||
|
const rules = [
|
||||||
|
|
||||||
|
/*
|
||||||
|
* AI
|
||||||
|
*/
|
||||||
|
"RULE-SET,openai,🤖 人工智能",
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 广告
|
||||||
|
*/
|
||||||
|
"RULE-SET,ads,🆎 广告拦截",
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 本地应用
|
||||||
|
*/
|
||||||
|
"RULE-SET,applications,🎯 全球直连",
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 私有网络
|
||||||
|
*/
|
||||||
|
"RULE-SET,private,🎯 全球直连",
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 微软
|
||||||
|
*/
|
||||||
|
"RULE-SET,microsoft-cn,🎯 全球直连",
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Apple
|
||||||
|
*/
|
||||||
|
"RULE-SET,apple-cn,🎯 全球直连",
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Google
|
||||||
|
*/
|
||||||
|
"RULE-SET,google-cn,🌐 海外服务",
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 游戏
|
||||||
|
*/
|
||||||
|
"RULE-SET,games-cn,🎯 全球直连",
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 网络测试
|
||||||
|
*/
|
||||||
|
"RULE-SET,networktest,📈 网络测试",
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 已知代理域名
|
||||||
|
*/
|
||||||
|
"RULE-SET,proxy,🪜 代理域名",
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 中国域名
|
||||||
|
*/
|
||||||
|
"RULE-SET,cn,🎯 全球直连",
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Telegram IP
|
||||||
|
*/
|
||||||
|
"RULE-SET,telegramip,🌐 海外服务,no-resolve",
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 私有 IP
|
||||||
|
*/
|
||||||
|
"RULE-SET,privateip,🎯 全球直连,no-resolve",
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 中国 IP
|
||||||
|
*/
|
||||||
|
"RULE-SET,cnip,🎯 全球直连,no-resolve",
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 最终兜底
|
||||||
|
*/
|
||||||
|
"MATCH,🛟 兜底策略"
|
||||||
|
];
|
||||||
|
|
||||||
|
|
||||||
|
/* ============================================================
|
||||||
|
* 11. 通用工具函数
|
||||||
|
* ============================================================ */
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 数组去重,同时保持原始顺序。
|
||||||
|
*/
|
||||||
|
function unique(items) {
|
||||||
|
|
||||||
|
return [
|
||||||
|
...new Set(
|
||||||
|
items.filter(Boolean)
|
||||||
|
)
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 安全读取节点名称。
|
||||||
|
*/
|
||||||
|
function getProxyName(proxy) {
|
||||||
|
|
||||||
|
if (
|
||||||
|
!proxy ||
|
||||||
|
typeof proxy.name !== "string"
|
||||||
|
) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
return proxy.name.trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 判断是否为有效节点。
|
||||||
|
*/
|
||||||
|
function isValidProxy(proxy) {
|
||||||
|
|
||||||
|
const name =
|
||||||
|
getProxyName(proxy);
|
||||||
|
|
||||||
|
if (!name) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return !nodeNameExcludeReg.test(
|
||||||
|
name
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* ============================================================
|
||||||
|
* 12. 获取原始节点
|
||||||
|
* ============================================================ */
|
||||||
|
|
||||||
|
function getRawProxies(config) {
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 优先使用 Sub-Store 传入的 config.proxies。
|
||||||
|
*/
|
||||||
|
if (
|
||||||
|
config &&
|
||||||
|
Array.isArray(config.proxies)
|
||||||
|
) {
|
||||||
|
return config.proxies;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 兼容 Sub-Store $proxies。
|
||||||
|
*/
|
||||||
|
if (
|
||||||
|
typeof $proxies !== "undefined" &&
|
||||||
|
Array.isArray($proxies)
|
||||||
|
) {
|
||||||
|
return $proxies;
|
||||||
|
}
|
||||||
|
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* ============================================================
|
||||||
|
* 13. 过滤有效节点
|
||||||
|
* ============================================================ */
|
||||||
|
|
||||||
|
function filterValidProxies(proxies) {
|
||||||
|
|
||||||
|
return unique(
|
||||||
|
proxies
|
||||||
|
.filter(isValidProxy)
|
||||||
|
.map(proxy => ({
|
||||||
|
...proxy,
|
||||||
|
name: getProxyName(proxy)
|
||||||
|
}))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* ============================================================
|
||||||
|
* 14. 节点地区分类
|
||||||
|
* ============================================================ */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 与旧版本不同:
|
||||||
|
*
|
||||||
|
* 不再:
|
||||||
|
*
|
||||||
|
* 地区 1 → 遍历全部节点
|
||||||
|
* 地区 2 → 遍历全部节点
|
||||||
|
* 地区 3 → 遍历全部节点
|
||||||
|
*
|
||||||
|
* 而是:
|
||||||
|
*
|
||||||
|
* 节点 1 → 找到所属地区
|
||||||
|
* 节点 2 → 找到所属地区
|
||||||
|
* 节点 3 → 找到所属地区
|
||||||
|
*
|
||||||
|
* 每个节点只分类一次。
|
||||||
|
*/
|
||||||
|
|
||||||
|
function classifyProxies(
|
||||||
|
proxies
|
||||||
|
) {
|
||||||
|
|
||||||
|
const regionProxyMap = {};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 初始化所有地区。
|
||||||
|
*/
|
||||||
|
regionDefinitions.forEach(
|
||||||
|
region => {
|
||||||
|
|
||||||
|
regionProxyMap[
|
||||||
|
region.key
|
||||||
|
] = [];
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 每个节点只处理一次。
|
||||||
|
*/
|
||||||
|
proxies.forEach(proxy => {
|
||||||
|
|
||||||
|
const name =
|
||||||
|
getProxyName(proxy);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 从前往后寻找第一个匹配地区。
|
||||||
|
*
|
||||||
|
* other 没有 pattern,
|
||||||
|
* 因此最终自然成为兜底。
|
||||||
|
*/
|
||||||
|
const matchedRegion =
|
||||||
|
regionDefinitions.find(
|
||||||
|
region => {
|
||||||
|
|
||||||
|
if (!region.pattern) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return region.pattern.test(
|
||||||
|
name
|
||||||
|
);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 理论上不会出现,
|
||||||
|
* 因为 other 永远存在。
|
||||||
|
*/
|
||||||
|
if (!matchedRegion) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
regionProxyMap[
|
||||||
|
matchedRegion.key
|
||||||
|
].push(name);
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 最终统一去重。
|
||||||
|
*/
|
||||||
|
Object.keys(
|
||||||
|
regionProxyMap
|
||||||
|
).forEach(key => {
|
||||||
|
|
||||||
|
regionProxyMap[key] =
|
||||||
|
unique(
|
||||||
|
regionProxyMap[key]
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
return regionProxyMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* ============================================================
|
||||||
|
* 15. 创建地区测速组
|
||||||
|
* ============================================================ */
|
||||||
|
|
||||||
|
function createRegionUrlTestGroup(
|
||||||
|
region,
|
||||||
|
proxyNames
|
||||||
|
) {
|
||||||
|
|
||||||
|
return {
|
||||||
|
|
||||||
|
...urlTestDefaults,
|
||||||
|
|
||||||
|
"name": region.groupName,
|
||||||
|
|
||||||
|
"type": "url-test",
|
||||||
|
|
||||||
|
"proxies": unique(
|
||||||
|
proxyNames
|
||||||
|
),
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 地区组只允许真实代理节点。
|
||||||
|
*/
|
||||||
|
"exclude-type": "direct"
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* ============================================================
|
||||||
|
* 16. 创建 Select 组
|
||||||
|
* ============================================================ */
|
||||||
|
|
||||||
|
function createSelectGroup(
|
||||||
|
name,
|
||||||
|
proxies,
|
||||||
|
options = {}
|
||||||
|
) {
|
||||||
|
|
||||||
|
return {
|
||||||
|
|
||||||
|
"name": name,
|
||||||
|
|
||||||
|
"type": "select",
|
||||||
|
|
||||||
|
"proxies": unique(
|
||||||
|
proxies
|
||||||
|
),
|
||||||
|
|
||||||
|
...options
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* ============================================================
|
||||||
|
* 17. 获取地区组名称
|
||||||
|
* ============================================================ */
|
||||||
|
|
||||||
|
function getActiveRegionNames(
|
||||||
|
regionDefinitions,
|
||||||
|
regionProxyMap
|
||||||
|
) {
|
||||||
|
|
||||||
|
return regionDefinitions
|
||||||
|
.filter(region => {
|
||||||
|
|
||||||
|
const nodes =
|
||||||
|
regionProxyMap[
|
||||||
|
region.key
|
||||||
|
];
|
||||||
|
|
||||||
|
return (
|
||||||
|
Array.isArray(nodes) &&
|
||||||
|
nodes.length > 0
|
||||||
|
);
|
||||||
|
})
|
||||||
|
.map(region =>
|
||||||
|
region.groupName
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* ============================================================
|
||||||
|
* 18. 获取 AI 候选地区
|
||||||
|
* ============================================================ */
|
||||||
|
|
||||||
|
function getAiCandidates(
|
||||||
|
regionDefinitions,
|
||||||
|
regionProxyMap
|
||||||
|
) {
|
||||||
|
|
||||||
|
const candidates = [];
|
||||||
|
|
||||||
|
|
||||||
|
aiRegionKeys.forEach(
|
||||||
|
regionKey => {
|
||||||
|
|
||||||
|
const region =
|
||||||
|
regionDefinitions.find(
|
||||||
|
item =>
|
||||||
|
item.key === regionKey
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!region) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const nodes =
|
||||||
|
regionProxyMap[
|
||||||
|
regionKey
|
||||||
|
];
|
||||||
|
|
||||||
|
|
||||||
|
if (
|
||||||
|
!Array.isArray(nodes) ||
|
||||||
|
nodes.length === 0
|
||||||
|
) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
candidates.push(
|
||||||
|
region.groupName
|
||||||
|
);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 非香港地区全部不存在时:
|
||||||
|
*
|
||||||
|
* 不允许回退到自动选择,
|
||||||
|
* 因为自动选择可能包含香港。
|
||||||
|
*
|
||||||
|
* 使用 DIRECT 保证:
|
||||||
|
*
|
||||||
|
* 1. 策略组始终存在
|
||||||
|
* 2. 配置始终合法
|
||||||
|
* 3. 香港永远不会进入 AI
|
||||||
|
*/
|
||||||
|
return candidates.length > 0
|
||||||
|
? unique(candidates)
|
||||||
|
: ["DIRECT"];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* ============================================================
|
||||||
|
* 19. 创建自动选择
|
||||||
|
* ============================================================ */
|
||||||
|
|
||||||
|
function createAutoSelectGroup(
|
||||||
|
candidates
|
||||||
|
) {
|
||||||
|
|
||||||
|
return {
|
||||||
|
|
||||||
|
...urlTestDefaults,
|
||||||
|
|
||||||
|
"name": "♻️ 自动选择",
|
||||||
|
|
||||||
|
"type": "url-test",
|
||||||
|
|
||||||
|
"proxies": unique(
|
||||||
|
candidates
|
||||||
|
)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* ============================================================
|
||||||
|
* 20. 创建故障转移
|
||||||
|
* ============================================================ */
|
||||||
|
|
||||||
|
function createFallbackGroup(
|
||||||
|
candidates
|
||||||
|
) {
|
||||||
|
|
||||||
|
return {
|
||||||
|
|
||||||
|
"name": "🔯 故障转移",
|
||||||
|
|
||||||
|
"type": "fallback",
|
||||||
|
|
||||||
|
"proxies": unique(
|
||||||
|
candidates
|
||||||
|
),
|
||||||
|
|
||||||
|
"url": speedTestUrl,
|
||||||
|
|
||||||
|
"interval": 600,
|
||||||
|
|
||||||
|
"timeout": 3000,
|
||||||
|
|
||||||
|
"lazy": true
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* ============================================================
|
||||||
|
* 21. 主函数
|
||||||
|
* ============================================================ */
|
||||||
|
|
||||||
|
function main(config = {}) {
|
||||||
|
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------
|
||||||
|
* 21.1 获取原始节点
|
||||||
|
* ---------------------------------------------------------- */
|
||||||
|
|
||||||
|
const rawProxies =
|
||||||
|
getRawProxies(config);
|
||||||
|
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------
|
||||||
|
* 21.2 过滤有效节点
|
||||||
|
* ---------------------------------------------------------- */
|
||||||
|
|
||||||
|
const filteredProxies =
|
||||||
|
filterValidProxies(
|
||||||
|
rawProxies
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 保留过滤后的节点。
|
||||||
|
*/
|
||||||
|
config.proxies =
|
||||||
|
filteredProxies;
|
||||||
|
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------
|
||||||
|
* 21.3 地区分类
|
||||||
|
* ---------------------------------------------------------- */
|
||||||
|
|
||||||
|
const regionProxyMap =
|
||||||
|
classifyProxies(
|
||||||
|
filteredProxies
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------
|
||||||
|
* 21.4 获取实际存在的地区
|
||||||
|
* ---------------------------------------------------------- */
|
||||||
|
|
||||||
|
const activeRegions =
|
||||||
|
getActiveRegionNames(
|
||||||
|
regionDefinitions,
|
||||||
|
regionProxyMap
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------
|
||||||
|
* 21.5 创建地区测速组
|
||||||
|
* ---------------------------------------------------------- */
|
||||||
|
|
||||||
|
const regionUrlTestGroups = [];
|
||||||
|
|
||||||
|
|
||||||
|
regionDefinitions.forEach(
|
||||||
|
region => {
|
||||||
|
|
||||||
|
const proxyNames =
|
||||||
|
regionProxyMap[
|
||||||
|
region.key
|
||||||
|
];
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 没有节点则隐藏。
|
||||||
|
*/
|
||||||
|
if (
|
||||||
|
!Array.isArray(proxyNames) ||
|
||||||
|
proxyNames.length === 0
|
||||||
|
) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
regionUrlTestGroups.push(
|
||||||
|
|
||||||
|
createRegionUrlTestGroup(
|
||||||
|
region,
|
||||||
|
proxyNames
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------
|
||||||
|
* 21.6 自动选择候选
|
||||||
|
* ---------------------------------------------------------- */
|
||||||
|
|
||||||
|
const autoSelectCandidates =
|
||||||
|
activeRegions.length > 0
|
||||||
|
? activeRegions
|
||||||
|
: ["DIRECT"];
|
||||||
|
|
||||||
|
|
||||||
|
const autoSelectGroup =
|
||||||
|
createAutoSelectGroup(
|
||||||
|
autoSelectCandidates
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------
|
||||||
|
* 21.7 故障转移
|
||||||
|
* ---------------------------------------------------------- */
|
||||||
|
|
||||||
|
const fallbackGroup =
|
||||||
|
createFallbackGroup(
|
||||||
|
autoSelectCandidates
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------
|
||||||
|
* 21.8 AI
|
||||||
|
* ---------------------------------------------------------- */
|
||||||
|
|
||||||
|
const aiCandidates =
|
||||||
|
getAiCandidates(
|
||||||
|
regionDefinitions,
|
||||||
|
regionProxyMap
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
const aiGroup = {
|
||||||
|
|
||||||
|
"name": "🤖 人工智能",
|
||||||
|
|
||||||
|
"type": "url-test",
|
||||||
|
|
||||||
|
"proxies": aiCandidates,
|
||||||
|
|
||||||
|
"url": speedTestUrl,
|
||||||
|
|
||||||
|
"interval": 600,
|
||||||
|
|
||||||
|
"timeout": 3000,
|
||||||
|
|
||||||
|
"lazy": true,
|
||||||
|
|
||||||
|
"tolerance": 80,
|
||||||
|
|
||||||
|
"max-failed-times": 3
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------
|
||||||
|
* 21.9 主节点选择
|
||||||
|
* ---------------------------------------------------------- */
|
||||||
|
|
||||||
|
const nodeSelectCandidates =
|
||||||
|
unique([
|
||||||
|
|
||||||
|
"♻️ 自动选择",
|
||||||
|
|
||||||
|
"🔯 故障转移",
|
||||||
|
|
||||||
|
...activeRegions
|
||||||
|
]);
|
||||||
|
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------
|
||||||
|
* 21.10 构建策略组
|
||||||
|
* ---------------------------------------------------------- */
|
||||||
|
|
||||||
|
const proxyGroups = [
|
||||||
|
|
||||||
|
/*
|
||||||
|
* ========================================================
|
||||||
|
* 核心策略组
|
||||||
|
* ========================================================
|
||||||
|
*
|
||||||
|
* 按重要程度放在最顶部。
|
||||||
|
*/
|
||||||
|
|
||||||
|
createSelectGroup(
|
||||||
|
|
||||||
|
"🚀 节点选择",
|
||||||
|
|
||||||
|
nodeSelectCandidates
|
||||||
|
),
|
||||||
|
|
||||||
|
|
||||||
|
autoSelectGroup,
|
||||||
|
|
||||||
|
|
||||||
|
fallbackGroup,
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* ========================================================
|
||||||
|
* 地区自动测速
|
||||||
|
* ========================================================
|
||||||
|
*/
|
||||||
|
|
||||||
|
...regionUrlTestGroups,
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* ========================================================
|
||||||
|
* 人工智能
|
||||||
|
* ========================================================
|
||||||
|
*/
|
||||||
|
|
||||||
|
aiGroup,
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* ========================================================
|
||||||
|
* 海外服务
|
||||||
|
* ========================================================
|
||||||
|
*/
|
||||||
|
|
||||||
|
createSelectGroup(
|
||||||
|
|
||||||
|
"🌐 海外服务",
|
||||||
|
|
||||||
|
[
|
||||||
|
"🚀 节点选择",
|
||||||
|
"♻️ 自动选择",
|
||||||
|
"🔯 故障转移",
|
||||||
|
...activeRegions
|
||||||
|
]
|
||||||
|
),
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* ========================================================
|
||||||
|
* 代理域名
|
||||||
|
* ========================================================
|
||||||
|
*/
|
||||||
|
|
||||||
|
createSelectGroup(
|
||||||
|
|
||||||
|
"🪜 代理域名",
|
||||||
|
|
||||||
|
[
|
||||||
|
"🚀 节点选择",
|
||||||
|
"🎯 全球直连"
|
||||||
|
]
|
||||||
|
),
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* ========================================================
|
||||||
|
* 网络测试
|
||||||
|
* ========================================================
|
||||||
|
*/
|
||||||
|
|
||||||
|
createSelectGroup(
|
||||||
|
|
||||||
|
"📈 网络测试",
|
||||||
|
|
||||||
|
[
|
||||||
|
"🎯 全球直连",
|
||||||
|
"🚀 节点选择",
|
||||||
|
"♻️ 自动选择",
|
||||||
|
"🔯 故障转移"
|
||||||
|
]
|
||||||
|
),
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* ========================================================
|
||||||
|
* 广告拦截
|
||||||
|
* ========================================================
|
||||||
|
*/
|
||||||
|
|
||||||
|
createSelectGroup(
|
||||||
|
|
||||||
|
"🆎 广告拦截",
|
||||||
|
|
||||||
|
[
|
||||||
|
"REJECT"
|
||||||
|
]
|
||||||
|
),
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* ========================================================
|
||||||
|
* 最终兜底
|
||||||
|
* ========================================================
|
||||||
|
*/
|
||||||
|
|
||||||
|
createSelectGroup(
|
||||||
|
|
||||||
|
"🛟 兜底策略",
|
||||||
|
|
||||||
|
[
|
||||||
|
"🚀 节点选择",
|
||||||
|
"🎯 全球直连"
|
||||||
|
]
|
||||||
|
),
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* ========================================================
|
||||||
|
* 全球直连
|
||||||
|
* ========================================================
|
||||||
|
*/
|
||||||
|
|
||||||
|
createSelectGroup(
|
||||||
|
|
||||||
|
"🎯 全球直连",
|
||||||
|
|
||||||
|
[
|
||||||
|
"DIRECT"
|
||||||
|
]
|
||||||
|
)
|
||||||
|
];
|
||||||
|
|
||||||
|
|
||||||
|
/* ==========================================================
|
||||||
|
* 22. 写入最终配置
|
||||||
|
* ========================================================== */
|
||||||
|
|
||||||
|
Object.assign(
|
||||||
|
config,
|
||||||
|
generalConfig
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
config["sniffer"] =
|
||||||
|
snifferConfig;
|
||||||
|
|
||||||
|
|
||||||
|
config["tun"] =
|
||||||
|
tunConfig;
|
||||||
|
|
||||||
|
|
||||||
|
config["dns"] =
|
||||||
|
dnsConfig;
|
||||||
|
|
||||||
|
|
||||||
|
config["proxy-groups"] =
|
||||||
|
proxyGroups;
|
||||||
|
|
||||||
|
|
||||||
|
config["rule-providers"] =
|
||||||
|
ruleProviders;
|
||||||
|
|
||||||
|
|
||||||
|
config["rules"] =
|
||||||
|
rules;
|
||||||
|
|
||||||
|
|
||||||
|
/* ==========================================================
|
||||||
|
* 23. 返回
|
||||||
|
* ========================================================== */
|
||||||
|
|
||||||
|
return config;
|
||||||
|
}
|
||||||
+1190
@@ -0,0 +1,1190 @@
|
|||||||
|
/**
|
||||||
|
* ============================================================
|
||||||
|
* Clash Verge Rev - 全局扩展脚本
|
||||||
|
* 机场独立订阅 / Windows
|
||||||
|
* ============================================================
|
||||||
|
*
|
||||||
|
* 【更新日志】
|
||||||
|
*
|
||||||
|
* 2026-08-23
|
||||||
|
* ------------------------------------------------------------
|
||||||
|
* 1. 「🚀 节点选择」调整至代理组最顶部
|
||||||
|
* 2. 「♻️ 自动选择」调整至代理组第二位
|
||||||
|
* 3. 「🔯 故障转移」调整至代理组第三位
|
||||||
|
* 4. 优化代理组生成顺序
|
||||||
|
* 5. 优化策略组之间的动态引用关系
|
||||||
|
* 6. 防止策略组引用不存在的策略
|
||||||
|
* 7. 优化节点地区识别,降低单字误判
|
||||||
|
* 8. 保留香港 / 台湾 / 日本 / 新加坡 / 美国 / 其他
|
||||||
|
* 9. 「🌐 其他」仅在存在其他节点时创建
|
||||||
|
* 10. 人工智能继续排除香港节点
|
||||||
|
* 11. 人工智能动态适应实际存在地区
|
||||||
|
* 12. 自动选择动态适应实际存在地区
|
||||||
|
* 13. 故障转移动态适应实际存在地区
|
||||||
|
* 14. 所有测速统一使用 gstatic generate_204
|
||||||
|
* 15. 保留 TUN / DNS / Fake-IP / Sniffer
|
||||||
|
* 16. 保留原有规则集
|
||||||
|
* 17. 保留规则集自动更新
|
||||||
|
* 18. 保留「🌍 海外服务」
|
||||||
|
* 19. 保留「📈 网络测试」
|
||||||
|
* 20. 保留「🪜 代理服务」
|
||||||
|
* 21. 保留「🎯 全球直连」
|
||||||
|
* 22. 保留「🛑 广告拦截」
|
||||||
|
* 23. 保留「🎯 兜底策略」
|
||||||
|
*
|
||||||
|
* ============================================================
|
||||||
|
*
|
||||||
|
* 使用方式:
|
||||||
|
*
|
||||||
|
* 机场订阅直接添加到 Clash Verge Rev。
|
||||||
|
*
|
||||||
|
* 本脚本作为:
|
||||||
|
*
|
||||||
|
* 全局扩展脚本
|
||||||
|
*
|
||||||
|
* 对最终生成的 Clash 配置进行统一修改。
|
||||||
|
*
|
||||||
|
* 不需要填写机场订阅地址。
|
||||||
|
*
|
||||||
|
* ============================================================
|
||||||
|
*/
|
||||||
|
/* ============================================================
|
||||||
|
* 一、基础配置
|
||||||
|
* ============================================================
|
||||||
|
*/
|
||||||
|
const GENERAL_CONFIG = {
|
||||||
|
"mode": "rule",
|
||||||
|
"ipv6": true,
|
||||||
|
"log-level": "silent",
|
||||||
|
"allow-lan": true,
|
||||||
|
"mixed-port": 7890,
|
||||||
|
"unified-delay": false,
|
||||||
|
"tcp-concurrent": true,
|
||||||
|
"external-controller-tls": "127.0.0.1:9090",
|
||||||
|
"find-process-mode": "strict",
|
||||||
|
"global-client-fingerprint": "chrome",
|
||||||
|
"profile": {
|
||||||
|
"store-selected": true,
|
||||||
|
"store-fake-ip": true
|
||||||
|
}
|
||||||
|
};
|
||||||
|
/* ============================================================
|
||||||
|
* 二、统一测速配置
|
||||||
|
* ============================================================
|
||||||
|
*/
|
||||||
|
const TEST_URL =
|
||||||
|
"https://www.gstatic.com/generate_204";
|
||||||
|
const GROUP_INTERVAL = 600;
|
||||||
|
const GROUP_TIMEOUT = 5000;
|
||||||
|
const GROUP_TOLERANCE = 50;
|
||||||
|
const FALLBACK_INTERVAL = 300;
|
||||||
|
/* ============================================================
|
||||||
|
* 三、固定策略名称
|
||||||
|
* ============================================================
|
||||||
|
*
|
||||||
|
* 统一集中管理。
|
||||||
|
*
|
||||||
|
* 后续修改名称时只需要修改这里。
|
||||||
|
*
|
||||||
|
* ============================================================
|
||||||
|
*/
|
||||||
|
const GROUP_NAMES = {
|
||||||
|
NODE_SELECT: "🚀 节点选择",
|
||||||
|
AUTO: "♻️ 自动选择",
|
||||||
|
FALLBACK: "🔯 故障转移",
|
||||||
|
AI: "🤖 人工智能",
|
||||||
|
OVERSEAS: "🌍 海外服务",
|
||||||
|
NETWORK_TEST: "📈 网络测试",
|
||||||
|
PROXY_SERVICE: "🪜 代理服务",
|
||||||
|
DIRECT: "🎯 全球直连",
|
||||||
|
AD_BLOCK: "🛑 广告拦截",
|
||||||
|
FINAL: "🎯 兜底策略"
|
||||||
|
};
|
||||||
|
/* ============================================================
|
||||||
|
* 四、地区名称
|
||||||
|
* ============================================================
|
||||||
|
*/
|
||||||
|
const REGION_NAMES = [
|
||||||
|
"🇭🇰 香港",
|
||||||
|
"🇹🇼 台湾",
|
||||||
|
"🇯🇵 日本",
|
||||||
|
"🇸🇬 新加坡",
|
||||||
|
"🇺🇸 美国",
|
||||||
|
"🌐 其他"
|
||||||
|
];
|
||||||
|
/* ============================================================
|
||||||
|
* 五、Sniffer
|
||||||
|
* ============================================================
|
||||||
|
*/
|
||||||
|
const SNIFFER_CONFIG = {
|
||||||
|
"enable": true,
|
||||||
|
"parse-pure-ip": true,
|
||||||
|
"sniff": {
|
||||||
|
"HTTP": {
|
||||||
|
"ports": [
|
||||||
|
80,
|
||||||
|
"8080-8880"
|
||||||
|
],
|
||||||
|
"override-destination": true
|
||||||
|
},
|
||||||
|
"TLS": {
|
||||||
|
"ports": [
|
||||||
|
443,
|
||||||
|
8443
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"QUIC": {
|
||||||
|
"ports": [
|
||||||
|
443,
|
||||||
|
8443
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"skip-domain": [
|
||||||
|
"Mijia Cloud"
|
||||||
|
]
|
||||||
|
};
|
||||||
|
/* ============================================================
|
||||||
|
* 六、TUN
|
||||||
|
* ============================================================
|
||||||
|
*/
|
||||||
|
const TUN_CONFIG = {
|
||||||
|
"enable": true,
|
||||||
|
"stack": "system",
|
||||||
|
"dns-hijack": [
|
||||||
|
"any:53"
|
||||||
|
],
|
||||||
|
"auto-route": true,
|
||||||
|
"auto-detect-interface": true,
|
||||||
|
"strict-route": true
|
||||||
|
};
|
||||||
|
/* ============================================================
|
||||||
|
* 七、DNS
|
||||||
|
* ============================================================
|
||||||
|
*/
|
||||||
|
const DNS_CONFIG = {
|
||||||
|
"enable": true,
|
||||||
|
"ipv6": true,
|
||||||
|
"prefer-h3": true,
|
||||||
|
"listen": "0.0.0.0:53",
|
||||||
|
"fake-ip-range": "198.18.0.1/16",
|
||||||
|
"enhanced-mode": "fake-ip",
|
||||||
|
"fallback": [
|
||||||
|
"8.8.8.8"
|
||||||
|
],
|
||||||
|
"default-nameserver": [
|
||||||
|
"223.5.5.5",
|
||||||
|
"114.114.114.114"
|
||||||
|
],
|
||||||
|
"nameserver": [
|
||||||
|
"https://dns.alidns.com/dns-query#h3=true",
|
||||||
|
"https://doh.pub/dns-query"
|
||||||
|
],
|
||||||
|
"fake-ip-filter": [
|
||||||
|
/* 本地 */
|
||||||
|
"*.lan",
|
||||||
|
"*.localdomain",
|
||||||
|
"*.example",
|
||||||
|
"*.invalid",
|
||||||
|
"*.localhost",
|
||||||
|
"*.test",
|
||||||
|
"*.local",
|
||||||
|
"*.home.arpa",
|
||||||
|
/* 自定义 */
|
||||||
|
"*.woozooo.com",
|
||||||
|
"*.kiid.top",
|
||||||
|
"43.142.112.88",
|
||||||
|
/* 时间同步 */
|
||||||
|
"time.*.com",
|
||||||
|
"time.*.gov",
|
||||||
|
"time.*.edu.cn",
|
||||||
|
"time.*.apple.com",
|
||||||
|
"time-ios.apple.com",
|
||||||
|
"time1.*.com",
|
||||||
|
"time2.*.com",
|
||||||
|
"time3.*.com",
|
||||||
|
"time4.*.com",
|
||||||
|
"time5.*.com",
|
||||||
|
"time6.*.com",
|
||||||
|
"time7.*.com",
|
||||||
|
"ntp.*.com",
|
||||||
|
"ntp1.*.com",
|
||||||
|
"ntp2.*.com",
|
||||||
|
"ntp3.*.com",
|
||||||
|
"ntp4.*.com",
|
||||||
|
"ntp5.*.com",
|
||||||
|
"ntp6.*.com",
|
||||||
|
"ntp7.*.com",
|
||||||
|
"*.time.edu.cn",
|
||||||
|
"*.ntp.org.cn",
|
||||||
|
"+.pool.ntp.org",
|
||||||
|
"time1.cloud.tencent.com",
|
||||||
|
/* 网易云音乐 */
|
||||||
|
"music.163.com",
|
||||||
|
"*.music.163.com",
|
||||||
|
"*.126.net",
|
||||||
|
/* 太和音乐 */
|
||||||
|
"musicapi.taihe.com",
|
||||||
|
"music.taihe.com",
|
||||||
|
/* 酷狗 */
|
||||||
|
"songsearch.kugou.com",
|
||||||
|
"trackercdn.kugou.com",
|
||||||
|
/* 酷我 */
|
||||||
|
"*.kuwo.cn",
|
||||||
|
/* JOOX */
|
||||||
|
"api-jooxtt.sanook.com",
|
||||||
|
"api.joox.com",
|
||||||
|
"joox.com",
|
||||||
|
/* QQ音乐 */
|
||||||
|
"y.qq.com",
|
||||||
|
"*.y.qq.com",
|
||||||
|
"streamoc.music.tc.qq.com",
|
||||||
|
"mobileoc.music.tc.qq.com",
|
||||||
|
"isure.stream.qqmusic.qq.com",
|
||||||
|
"dl.stream.qqmusic.qq.com",
|
||||||
|
"aqqmusic.tc.qq.com",
|
||||||
|
"amobile.music.tc.qq.com",
|
||||||
|
/* 虾米 */
|
||||||
|
"*.xiami.com",
|
||||||
|
/* 咪咕 */
|
||||||
|
"*.music.migu.cn",
|
||||||
|
"music.migu.cn",
|
||||||
|
/* Windows 网络检测 */
|
||||||
|
"+.msftconnecttest.com",
|
||||||
|
"+.msftncsi.com",
|
||||||
|
/* QQ */
|
||||||
|
"localhost.ptlogin2.qq.com",
|
||||||
|
"localhost.sec.qq.com",
|
||||||
|
"+.qq.com",
|
||||||
|
"+.tencent.com",
|
||||||
|
/* Nintendo */
|
||||||
|
"+.srv.nintendo.net",
|
||||||
|
"*.n.n.srv.nintendo.net",
|
||||||
|
/* PlayStation */
|
||||||
|
"+.stun.playstation.net",
|
||||||
|
/* Xbox */
|
||||||
|
"xbox.*.*.microsoft.com",
|
||||||
|
"*.*.xboxlive.com",
|
||||||
|
"xbox.*.microsoft.com",
|
||||||
|
"xnotify.xboxlive.com",
|
||||||
|
/* Battle.net */
|
||||||
|
"+.battlenet.com.cn",
|
||||||
|
/* Wargaming */
|
||||||
|
"+.wotgame.cn",
|
||||||
|
"+.wggames.cn",
|
||||||
|
"+.wowsgame.cn",
|
||||||
|
"+.wargaming.net",
|
||||||
|
/* Go */
|
||||||
|
"proxy.golang.org",
|
||||||
|
/* STUN */
|
||||||
|
"stun.*.*",
|
||||||
|
"stun.*.*.*",
|
||||||
|
"+.stun.*.*",
|
||||||
|
"+.stun.*.*.*",
|
||||||
|
"+.stun.*.*.*.*",
|
||||||
|
"+.stun.*.*.*.*.*",
|
||||||
|
/* Belkin */
|
||||||
|
"heartbeat.belkin.com",
|
||||||
|
/* Linksys */
|
||||||
|
"*.linksys.com",
|
||||||
|
"*.linksyssmartwifi.com",
|
||||||
|
/* ASUS */
|
||||||
|
"*.router.asus.com",
|
||||||
|
/* Apple */
|
||||||
|
"mesu.apple.com",
|
||||||
|
"swscan.apple.com",
|
||||||
|
"swquery.apple.com",
|
||||||
|
"swdownload.apple.com",
|
||||||
|
"swcdn.apple.com",
|
||||||
|
"swdist.apple.com",
|
||||||
|
/* Google */
|
||||||
|
"lens.l.google.com",
|
||||||
|
"stun.l.google.com",
|
||||||
|
/* 游戏 */
|
||||||
|
"na.b.g-tun.com",
|
||||||
|
/* Netflix */
|
||||||
|
"+.nflxvideo.net",
|
||||||
|
/* Square Enix */
|
||||||
|
"*.square-enix.com",
|
||||||
|
"*.finalfantasyxiv.com",
|
||||||
|
"*.ffxiv.com",
|
||||||
|
"*.ff14.sdo.com",
|
||||||
|
"ff.dorado.sdo.com",
|
||||||
|
/* 哔哩哔哩 */
|
||||||
|
"*.mcdn.bilivideo.cn",
|
||||||
|
/* Disney */
|
||||||
|
"+.media.dssott.com",
|
||||||
|
/* Shark007 */
|
||||||
|
"shark007.net",
|
||||||
|
/* 小米 */
|
||||||
|
"Mijia Cloud",
|
||||||
|
/* 招商银行 */
|
||||||
|
"+.cmbchina.com",
|
||||||
|
"+.cmbimg.com",
|
||||||
|
/* AdGuard */
|
||||||
|
"adguardteam.github.io",
|
||||||
|
"adrules.top",
|
||||||
|
"anti-ad.net",
|
||||||
|
"local.adguard.org",
|
||||||
|
"static.adtidy.org",
|
||||||
|
/* 网络 */
|
||||||
|
"+.sandai.net",
|
||||||
|
"+.n0808.com",
|
||||||
|
"+.3gppnetwork.org"
|
||||||
|
]
|
||||||
|
};
|
||||||
|
/* ============================================================
|
||||||
|
* 八、节点地区识别
|
||||||
|
* ============================================================
|
||||||
|
*
|
||||||
|
* 注意:
|
||||||
|
*
|
||||||
|
* 不再使用单独的:
|
||||||
|
*
|
||||||
|
* 港
|
||||||
|
* 台
|
||||||
|
* 日
|
||||||
|
* 新
|
||||||
|
* 美
|
||||||
|
*
|
||||||
|
* 作为独立匹配条件。
|
||||||
|
*
|
||||||
|
* 防止机场自定义名称产生误判。
|
||||||
|
*
|
||||||
|
* ============================================================
|
||||||
|
*/
|
||||||
|
const REGION_PATTERNS = {
|
||||||
|
"🇭🇰 香港":
|
||||||
|
/(?:香港|香港地区|Hong[\s_-]?Kong|HKG|HK|🇭🇰)/i,
|
||||||
|
"🇹🇼 台湾":
|
||||||
|
/(?:台湾|台湾地区|Taiwan|TWN|TW|🇹🇼)/i,
|
||||||
|
"🇯🇵 日本":
|
||||||
|
/(?:日本|日本地区|Japan|JPN|JP|🇯🇵)/i,
|
||||||
|
"🇸🇬 新加坡":
|
||||||
|
/(?:新加坡|狮城|Singapore|Singapura|SGP|SG|🇸🇬)/i,
|
||||||
|
"🇺🇸 美国":
|
||||||
|
/(?:美国|美国地区|United[\s_-]?States|USA|US|America|🇺🇸)/i
|
||||||
|
};
|
||||||
|
/* ============================================================
|
||||||
|
* 九、节点辅助函数
|
||||||
|
* ============================================================
|
||||||
|
*/
|
||||||
|
function getProxyName(proxy) {
|
||||||
|
if (!proxy) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
if (typeof proxy === "string") {
|
||||||
|
return proxy;
|
||||||
|
}
|
||||||
|
return proxy.name || "";
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* 判断是否为真实代理节点。
|
||||||
|
*/
|
||||||
|
function isUsableProxy(proxy) {
|
||||||
|
const name =
|
||||||
|
getProxyName(proxy);
|
||||||
|
if (!name) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
const upperName =
|
||||||
|
name.toUpperCase();
|
||||||
|
const excludedNames = [
|
||||||
|
"DIRECT",
|
||||||
|
"REJECT",
|
||||||
|
"REJECT-DROP",
|
||||||
|
"PASS"
|
||||||
|
];
|
||||||
|
if (
|
||||||
|
excludedNames.indexOf(
|
||||||
|
upperName
|
||||||
|
) !== -1
|
||||||
|
) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* 获取节点地区。
|
||||||
|
*/
|
||||||
|
function getRegionName(proxyName) {
|
||||||
|
const regionNames =
|
||||||
|
Object.keys(REGION_PATTERNS);
|
||||||
|
for (
|
||||||
|
let i = 0;
|
||||||
|
i < regionNames.length;
|
||||||
|
i++
|
||||||
|
) {
|
||||||
|
const regionName =
|
||||||
|
regionNames[i];
|
||||||
|
if (
|
||||||
|
REGION_PATTERNS[
|
||||||
|
regionName
|
||||||
|
].test(proxyName)
|
||||||
|
) {
|
||||||
|
return regionName;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return "🌐 其他";
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* 初始化地区节点。
|
||||||
|
*/
|
||||||
|
function createEmptyRegionNodes() {
|
||||||
|
return {
|
||||||
|
"🇭🇰 香港": [],
|
||||||
|
"🇹🇼 台湾": [],
|
||||||
|
"🇯🇵 日本": [],
|
||||||
|
"🇸🇬 新加坡": [],
|
||||||
|
"🇺🇸 美国": [],
|
||||||
|
"🌐 其他": []
|
||||||
|
};
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* 分类节点。
|
||||||
|
*/
|
||||||
|
function classifyProxies(config) {
|
||||||
|
const regionNodes =
|
||||||
|
createEmptyRegionNodes();
|
||||||
|
const proxies =
|
||||||
|
Array.isArray(config.proxies)
|
||||||
|
? config.proxies
|
||||||
|
: [];
|
||||||
|
for (
|
||||||
|
let i = 0;
|
||||||
|
i < proxies.length;
|
||||||
|
i++
|
||||||
|
) {
|
||||||
|
const proxy =
|
||||||
|
proxies[i];
|
||||||
|
if (
|
||||||
|
!isUsableProxy(proxy)
|
||||||
|
) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
const proxyName =
|
||||||
|
getProxyName(proxy);
|
||||||
|
const regionName =
|
||||||
|
getRegionName(proxyName);
|
||||||
|
regionNodes[
|
||||||
|
regionName
|
||||||
|
].push(proxyName);
|
||||||
|
}
|
||||||
|
return regionNodes;
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* 获取实际存在的地区。
|
||||||
|
*/
|
||||||
|
function getExistingRegions(
|
||||||
|
regionNodes
|
||||||
|
) {
|
||||||
|
const result = [];
|
||||||
|
for (
|
||||||
|
let i = 0;
|
||||||
|
i < REGION_NAMES.length;
|
||||||
|
i++
|
||||||
|
) {
|
||||||
|
const regionName =
|
||||||
|
REGION_NAMES[i];
|
||||||
|
if (
|
||||||
|
regionNodes[
|
||||||
|
regionName
|
||||||
|
] &&
|
||||||
|
regionNodes[
|
||||||
|
regionName
|
||||||
|
].length > 0
|
||||||
|
) {
|
||||||
|
result.push(regionName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
/* ============================================================
|
||||||
|
* 十、代理组辅助函数
|
||||||
|
* ============================================================
|
||||||
|
*/
|
||||||
|
/*
|
||||||
|
* 创建地区测速组。
|
||||||
|
*/
|
||||||
|
function createRegionGroup(
|
||||||
|
name,
|
||||||
|
proxies
|
||||||
|
) {
|
||||||
|
return {
|
||||||
|
"name": name,
|
||||||
|
"type": "url-test",
|
||||||
|
"proxies": proxies,
|
||||||
|
"url": TEST_URL,
|
||||||
|
"interval": GROUP_INTERVAL,
|
||||||
|
"timeout": GROUP_TIMEOUT,
|
||||||
|
"lazy": true,
|
||||||
|
"tolerance": GROUP_TOLERANCE,
|
||||||
|
"max-failed-times": 3
|
||||||
|
};
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* 创建选择组。
|
||||||
|
*/
|
||||||
|
function createSelectGroup(
|
||||||
|
name,
|
||||||
|
proxies,
|
||||||
|
disableUdp
|
||||||
|
) {
|
||||||
|
const group = {
|
||||||
|
"name": name,
|
||||||
|
"type": "select",
|
||||||
|
"proxies": proxies
|
||||||
|
};
|
||||||
|
if (disableUdp === true) {
|
||||||
|
group["disable-udp"] = true;
|
||||||
|
}
|
||||||
|
return group;
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* 判断策略是否存在。
|
||||||
|
*/
|
||||||
|
function hasGroup(
|
||||||
|
groupNames,
|
||||||
|
name
|
||||||
|
) {
|
||||||
|
return (
|
||||||
|
groupNames.indexOf(name) !== -1
|
||||||
|
);
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* 创建地区策略。
|
||||||
|
*/
|
||||||
|
function addExistingRegionGroup(
|
||||||
|
groups,
|
||||||
|
regionNodes,
|
||||||
|
regionName
|
||||||
|
) {
|
||||||
|
const proxies =
|
||||||
|
regionNodes[
|
||||||
|
regionName
|
||||||
|
] || [];
|
||||||
|
if (
|
||||||
|
proxies.length === 0
|
||||||
|
) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
groups.push(
|
||||||
|
createRegionGroup(
|
||||||
|
regionName,
|
||||||
|
proxies
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
/* ============================================================
|
||||||
|
* 十一、动态创建代理组
|
||||||
|
* ============================================================
|
||||||
|
*
|
||||||
|
* 排序结构:
|
||||||
|
*
|
||||||
|
* ① 🚀 节点选择
|
||||||
|
* ② ♻️ 自动选择
|
||||||
|
* ③ 🔯 故障转移
|
||||||
|
*
|
||||||
|
* ④ 地区策略
|
||||||
|
*
|
||||||
|
* ⑤ 人工智能
|
||||||
|
* ⑥ 海外服务
|
||||||
|
* ⑦ 网络测试
|
||||||
|
* ⑧ 代理服务
|
||||||
|
*
|
||||||
|
* ⑨ 全球直连
|
||||||
|
* ⑩ 广告拦截
|
||||||
|
* ⑪ 兜底策略
|
||||||
|
*
|
||||||
|
* ============================================================
|
||||||
|
*/
|
||||||
|
function createProxyGroups(config) {
|
||||||
|
const regionNodes =
|
||||||
|
classifyProxies(config);
|
||||||
|
const existingRegions =
|
||||||
|
getExistingRegions(
|
||||||
|
regionNodes
|
||||||
|
);
|
||||||
|
const groups = [];
|
||||||
|
/*
|
||||||
|
* ========================================================
|
||||||
|
* 第一层:核心节点控制
|
||||||
|
* ========================================================
|
||||||
|
*/
|
||||||
|
/*
|
||||||
|
* ① 节点选择
|
||||||
|
*
|
||||||
|
* 先预留,后面填充实际策略。
|
||||||
|
*/
|
||||||
|
const nodeSelectOptions = [];
|
||||||
|
/*
|
||||||
|
* ② 自动选择
|
||||||
|
*/
|
||||||
|
if (
|
||||||
|
existingRegions.length > 0
|
||||||
|
) {
|
||||||
|
groups.push({
|
||||||
|
"name": GROUP_NAMES.AUTO,
|
||||||
|
"type": "url-test",
|
||||||
|
"proxies": existingRegions,
|
||||||
|
"url": TEST_URL,
|
||||||
|
"interval": GROUP_INTERVAL,
|
||||||
|
"timeout": GROUP_TIMEOUT,
|
||||||
|
"lazy": true,
|
||||||
|
"tolerance": GROUP_TOLERANCE,
|
||||||
|
"max-failed-times": 3
|
||||||
|
});
|
||||||
|
nodeSelectOptions.push(
|
||||||
|
GROUP_NAMES.AUTO
|
||||||
|
);
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* ③ 故障转移
|
||||||
|
*/
|
||||||
|
if (
|
||||||
|
existingRegions.length > 0
|
||||||
|
) {
|
||||||
|
groups.push({
|
||||||
|
"name": GROUP_NAMES.FALLBACK,
|
||||||
|
"type": "fallback",
|
||||||
|
"proxies": existingRegions,
|
||||||
|
"url": TEST_URL,
|
||||||
|
"interval": FALLBACK_INTERVAL,
|
||||||
|
"timeout": GROUP_TIMEOUT,
|
||||||
|
"lazy": true
|
||||||
|
});
|
||||||
|
nodeSelectOptions.push(
|
||||||
|
GROUP_NAMES.FALLBACK
|
||||||
|
);
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* 地区加入节点选择。
|
||||||
|
*/
|
||||||
|
for (
|
||||||
|
let i = 0;
|
||||||
|
i < existingRegions.length;
|
||||||
|
i++
|
||||||
|
) {
|
||||||
|
nodeSelectOptions.push(
|
||||||
|
existingRegions[i]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* ① 节点选择
|
||||||
|
*
|
||||||
|
* 最终插入到 groups[0]。
|
||||||
|
*/
|
||||||
|
groups.unshift(
|
||||||
|
createSelectGroup(
|
||||||
|
GROUP_NAMES.NODE_SELECT,
|
||||||
|
nodeSelectOptions
|
||||||
|
)
|
||||||
|
);
|
||||||
|
/*
|
||||||
|
* ========================================================
|
||||||
|
* 第二层:地区策略
|
||||||
|
* ========================================================
|
||||||
|
*/
|
||||||
|
addExistingRegionGroup(
|
||||||
|
groups,
|
||||||
|
regionNodes,
|
||||||
|
"🇭🇰 香港"
|
||||||
|
);
|
||||||
|
addExistingRegionGroup(
|
||||||
|
groups,
|
||||||
|
regionNodes,
|
||||||
|
"🇹🇼 台湾"
|
||||||
|
);
|
||||||
|
addExistingRegionGroup(
|
||||||
|
groups,
|
||||||
|
regionNodes,
|
||||||
|
"🇯🇵 日本"
|
||||||
|
);
|
||||||
|
addExistingRegionGroup(
|
||||||
|
groups,
|
||||||
|
regionNodes,
|
||||||
|
"🇸🇬 新加坡"
|
||||||
|
);
|
||||||
|
addExistingRegionGroup(
|
||||||
|
groups,
|
||||||
|
regionNodes,
|
||||||
|
"🇺🇸 美国"
|
||||||
|
);
|
||||||
|
addExistingRegionGroup(
|
||||||
|
groups,
|
||||||
|
regionNodes,
|
||||||
|
"🌐 其他"
|
||||||
|
);
|
||||||
|
/*
|
||||||
|
* ========================================================
|
||||||
|
* 第三层:人工智能
|
||||||
|
* ========================================================
|
||||||
|
*
|
||||||
|
* 排除香港。
|
||||||
|
*/
|
||||||
|
const aiRegions = [
|
||||||
|
"🇹🇼 台湾",
|
||||||
|
"🇯🇵 日本",
|
||||||
|
"🇸🇬 新加坡",
|
||||||
|
"🇺🇸 美国"
|
||||||
|
];
|
||||||
|
const aiProxies = [];
|
||||||
|
for (
|
||||||
|
let i = 0;
|
||||||
|
i < aiRegions.length;
|
||||||
|
i++
|
||||||
|
) {
|
||||||
|
if (
|
||||||
|
existingRegions.indexOf(
|
||||||
|
aiRegions[i]
|
||||||
|
) !== -1
|
||||||
|
) {
|
||||||
|
aiProxies.push(
|
||||||
|
aiRegions[i]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (
|
||||||
|
aiProxies.length > 0
|
||||||
|
) {
|
||||||
|
groups.push({
|
||||||
|
"name": GROUP_NAMES.AI,
|
||||||
|
"type": "url-test",
|
||||||
|
"proxies": aiProxies,
|
||||||
|
"url": TEST_URL,
|
||||||
|
"interval": GROUP_INTERVAL,
|
||||||
|
"timeout": GROUP_TIMEOUT,
|
||||||
|
"lazy": true,
|
||||||
|
"tolerance": GROUP_TOLERANCE,
|
||||||
|
"max-failed-times": 3
|
||||||
|
});
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* ========================================================
|
||||||
|
* 第四层:海外服务
|
||||||
|
* ========================================================
|
||||||
|
*/
|
||||||
|
const overseasOptions = [];
|
||||||
|
overseasOptions.push(
|
||||||
|
GROUP_NAMES.NODE_SELECT
|
||||||
|
);
|
||||||
|
if (
|
||||||
|
hasGroup(
|
||||||
|
existingRegions,
|
||||||
|
GROUP_NAMES.AUTO
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
overseasOptions.push(
|
||||||
|
GROUP_NAMES.AUTO
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if (
|
||||||
|
hasGroup(
|
||||||
|
existingRegions,
|
||||||
|
GROUP_NAMES.FALLBACK
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
overseasOptions.push(
|
||||||
|
GROUP_NAMES.FALLBACK
|
||||||
|
);
|
||||||
|
}
|
||||||
|
groups.push(
|
||||||
|
createSelectGroup(
|
||||||
|
GROUP_NAMES.OVERSEAS,
|
||||||
|
overseasOptions
|
||||||
|
)
|
||||||
|
);
|
||||||
|
/*
|
||||||
|
* ========================================================
|
||||||
|
* 第五层:网络测试
|
||||||
|
* ========================================================
|
||||||
|
*/
|
||||||
|
const networkTestOptions = [
|
||||||
|
GROUP_NAMES.DIRECT,
|
||||||
|
GROUP_NAMES.NODE_SELECT
|
||||||
|
];
|
||||||
|
if (
|
||||||
|
existingRegions.length > 0
|
||||||
|
) {
|
||||||
|
networkTestOptions.push(
|
||||||
|
GROUP_NAMES.AUTO
|
||||||
|
);
|
||||||
|
}
|
||||||
|
groups.push(
|
||||||
|
createSelectGroup(
|
||||||
|
GROUP_NAMES.NETWORK_TEST,
|
||||||
|
networkTestOptions
|
||||||
|
)
|
||||||
|
);
|
||||||
|
/*
|
||||||
|
* ========================================================
|
||||||
|
* 第六层:代理服务
|
||||||
|
* ========================================================
|
||||||
|
*/
|
||||||
|
const proxyServiceOptions = [
|
||||||
|
GROUP_NAMES.NODE_SELECT
|
||||||
|
];
|
||||||
|
if (
|
||||||
|
existingRegions.length > 0
|
||||||
|
) {
|
||||||
|
proxyServiceOptions.push(
|
||||||
|
GROUP_NAMES.AUTO,
|
||||||
|
GROUP_NAMES.FALLBACK
|
||||||
|
);
|
||||||
|
}
|
||||||
|
proxyServiceOptions.push(
|
||||||
|
GROUP_NAMES.DIRECT
|
||||||
|
);
|
||||||
|
groups.push(
|
||||||
|
createSelectGroup(
|
||||||
|
GROUP_NAMES.PROXY_SERVICE,
|
||||||
|
proxyServiceOptions,
|
||||||
|
true
|
||||||
|
)
|
||||||
|
);
|
||||||
|
/*
|
||||||
|
* ========================================================
|
||||||
|
* 第七层:全球直连
|
||||||
|
* ========================================================
|
||||||
|
*/
|
||||||
|
groups.push(
|
||||||
|
createSelectGroup(
|
||||||
|
GROUP_NAMES.DIRECT,
|
||||||
|
[
|
||||||
|
"DIRECT"
|
||||||
|
]
|
||||||
|
)
|
||||||
|
);
|
||||||
|
/*
|
||||||
|
* ========================================================
|
||||||
|
* 第八层:广告拦截
|
||||||
|
* ========================================================
|
||||||
|
*/
|
||||||
|
groups.push(
|
||||||
|
createSelectGroup(
|
||||||
|
GROUP_NAMES.AD_BLOCK,
|
||||||
|
[
|
||||||
|
"REJECT"
|
||||||
|
]
|
||||||
|
)
|
||||||
|
);
|
||||||
|
/*
|
||||||
|
* ========================================================
|
||||||
|
* 第九层:兜底策略
|
||||||
|
* ========================================================
|
||||||
|
*/
|
||||||
|
const finalOptions = [];
|
||||||
|
if (
|
||||||
|
existingRegions.length > 0
|
||||||
|
) {
|
||||||
|
finalOptions.push(
|
||||||
|
GROUP_NAMES.NODE_SELECT
|
||||||
|
);
|
||||||
|
}
|
||||||
|
finalOptions.push(
|
||||||
|
GROUP_NAMES.DIRECT
|
||||||
|
);
|
||||||
|
groups.push(
|
||||||
|
createSelectGroup(
|
||||||
|
GROUP_NAMES.FINAL,
|
||||||
|
finalOptions,
|
||||||
|
true
|
||||||
|
)
|
||||||
|
);
|
||||||
|
return groups;
|
||||||
|
}
|
||||||
|
/* ============================================================
|
||||||
|
* 十二、规则集
|
||||||
|
* ============================================================
|
||||||
|
*/
|
||||||
|
const RULE_PROVIDERS = {
|
||||||
|
"ads": {
|
||||||
|
"type": "http",
|
||||||
|
"behavior": "domain",
|
||||||
|
"format": "text",
|
||||||
|
"path": "./rules/adss.list",
|
||||||
|
"url":
|
||||||
|
"https://fastly.jsdelivr.net/gh/DustinWin/ruleset_geodata@clash-ruleset/ads.list",
|
||||||
|
"interval": 86400
|
||||||
|
},
|
||||||
|
"applications": {
|
||||||
|
"type": "http",
|
||||||
|
"behavior": "classical",
|
||||||
|
"format": "text",
|
||||||
|
"path": "./rules/applicationss.list",
|
||||||
|
"url":
|
||||||
|
"https://fastly.jsdelivr.net/gh/DustinWin/ruleset_geodata@clash-ruleset/applications.list",
|
||||||
|
"interval": 86400
|
||||||
|
},
|
||||||
|
"private": {
|
||||||
|
"type": "http",
|
||||||
|
"behavior": "domain",
|
||||||
|
"format": "text",
|
||||||
|
"path": "./rules/privates.list",
|
||||||
|
"url":
|
||||||
|
"https://fastly.jsdelivr.net/gh/DustinWin/ruleset_geodata@clash-ruleset/private.list",
|
||||||
|
"filter": "^((?!openai).)*$",
|
||||||
|
"interval": 86400
|
||||||
|
},
|
||||||
|
"microsoft-cn": {
|
||||||
|
"type": "http",
|
||||||
|
"behavior": "domain",
|
||||||
|
"format": "text",
|
||||||
|
"path": "./rules/microsoft-cns.list",
|
||||||
|
"url":
|
||||||
|
"https://fastly.jsdelivr.net/gh/DustinWin/ruleset_geodata@clash-ruleset/microsoft-cn.list",
|
||||||
|
"interval": 86400
|
||||||
|
},
|
||||||
|
"openai": {
|
||||||
|
"type": "http",
|
||||||
|
"behavior": "domain",
|
||||||
|
"format": "text",
|
||||||
|
"path": "./rules/openais.list",
|
||||||
|
"url":
|
||||||
|
"https://cdn.jsdelivr.net/gh/DustinWin/ruleset_geodata@refs/heads/mihomo-ruleset/ai.list",
|
||||||
|
"interval": 86400
|
||||||
|
},
|
||||||
|
"apple-cn": {
|
||||||
|
"type": "http",
|
||||||
|
"behavior": "domain",
|
||||||
|
"format": "text",
|
||||||
|
"path": "./rules/apple-cns.list",
|
||||||
|
"url":
|
||||||
|
"https://fastly.jsdelivr.net/gh/DustinWin/ruleset_geodata@clash-ruleset/apple-cn.list",
|
||||||
|
"interval": 86400
|
||||||
|
},
|
||||||
|
"google-cn": {
|
||||||
|
"type": "http",
|
||||||
|
"behavior": "domain",
|
||||||
|
"format": "text",
|
||||||
|
"path": "./rules/google-cns.list",
|
||||||
|
"url":
|
||||||
|
"https://fastly.jsdelivr.net/gh/DustinWin/ruleset_geodata@clash-ruleset/google-cn.list",
|
||||||
|
"interval": 86400
|
||||||
|
},
|
||||||
|
"games-cn": {
|
||||||
|
"type": "http",
|
||||||
|
"behavior": "domain",
|
||||||
|
"format": "text",
|
||||||
|
"path": "./rules/games-cns.list",
|
||||||
|
"url":
|
||||||
|
"https://fastly.jsdelivr.net/gh/DustinWin/ruleset_geodata@clash-ruleset/games-cn.list",
|
||||||
|
"interval": 86400
|
||||||
|
},
|
||||||
|
"networktest": {
|
||||||
|
"type": "http",
|
||||||
|
"behavior": "classical",
|
||||||
|
"format": "text",
|
||||||
|
"path": "./rules/networktests.list",
|
||||||
|
"url":
|
||||||
|
"https://fastly.jsdelivr.net/gh/DustinWin/ruleset_geodata@clash-ruleset/networktest.list",
|
||||||
|
"interval": 86400
|
||||||
|
},
|
||||||
|
"proxy": {
|
||||||
|
"type": "http",
|
||||||
|
"behavior": "domain",
|
||||||
|
"format": "text",
|
||||||
|
"path": "./rules/proxys.list",
|
||||||
|
"url":
|
||||||
|
"https://fastly.jsdelivr.net/gh/y7478729/ruleset_geodata@clash-ruleset/proxy.list",
|
||||||
|
"interval": 86400
|
||||||
|
},
|
||||||
|
"cn": {
|
||||||
|
"type": "http",
|
||||||
|
"behavior": "domain",
|
||||||
|
"format": "text",
|
||||||
|
"path": "./rules/cns.list",
|
||||||
|
"url":
|
||||||
|
"https://fastly.jsdelivr.net/gh/DustinWin/ruleset_geodata@clash-ruleset/cn.list",
|
||||||
|
"interval": 86400
|
||||||
|
},
|
||||||
|
"telegramip": {
|
||||||
|
"type": "http",
|
||||||
|
"behavior": "ipcidr",
|
||||||
|
"format": "text",
|
||||||
|
"path": "./rules/telegramips.list",
|
||||||
|
"url":
|
||||||
|
"https://fastly.jsdelivr.net/gh/DustinWin/ruleset_geodata@clash-ruleset/telegramip.list",
|
||||||
|
"interval": 86400
|
||||||
|
},
|
||||||
|
"privateip": {
|
||||||
|
"type": "http",
|
||||||
|
"behavior": "ipcidr",
|
||||||
|
"format": "text",
|
||||||
|
"path": "./rules/privateips.list",
|
||||||
|
"url":
|
||||||
|
"https://fastly.jsdelivr.net/gh/DustinWin/ruleset_geodata@clash-ruleset/privateip.list",
|
||||||
|
"interval": 86400
|
||||||
|
},
|
||||||
|
"cnip": {
|
||||||
|
"type": "http",
|
||||||
|
"behavior": "ipcidr",
|
||||||
|
"format": "text",
|
||||||
|
"path": "./rules/cnips.list",
|
||||||
|
"url":
|
||||||
|
"https://fastly.jsdelivr.net/gh/DustinWin/ruleset_geodata@clash-ruleset/cnip.list",
|
||||||
|
"interval": 86400
|
||||||
|
}
|
||||||
|
};
|
||||||
|
/* ============================================================
|
||||||
|
* 十三、规则
|
||||||
|
* ============================================================
|
||||||
|
*/
|
||||||
|
const RULES = [
|
||||||
|
/*
|
||||||
|
* AI
|
||||||
|
*/
|
||||||
|
"RULE-SET,openai,🤖 人工智能",
|
||||||
|
/*
|
||||||
|
* 广告
|
||||||
|
*/
|
||||||
|
"RULE-SET,ads,🛑 广告拦截",
|
||||||
|
/*
|
||||||
|
* 软件
|
||||||
|
*/
|
||||||
|
"RULE-SET,applications,🎯 全球直连",
|
||||||
|
/*
|
||||||
|
* 私有网络
|
||||||
|
*/
|
||||||
|
"RULE-SET,private,🎯 全球直连",
|
||||||
|
/*
|
||||||
|
* Microsoft
|
||||||
|
*/
|
||||||
|
"RULE-SET,microsoft-cn,🌍 海外服务",
|
||||||
|
/*
|
||||||
|
* Apple
|
||||||
|
*/
|
||||||
|
"RULE-SET,apple-cn,🌍 海外服务",
|
||||||
|
/*
|
||||||
|
* Google
|
||||||
|
*/
|
||||||
|
"RULE-SET,google-cn,🌍 海外服务",
|
||||||
|
/*
|
||||||
|
* 游戏
|
||||||
|
*/
|
||||||
|
"RULE-SET,games-cn,🌍 海外服务",
|
||||||
|
/*
|
||||||
|
* 网络测试
|
||||||
|
*/
|
||||||
|
"RULE-SET,networktest,📈 网络测试",
|
||||||
|
/*
|
||||||
|
* 代理域名
|
||||||
|
*/
|
||||||
|
"RULE-SET,proxy,🪜 代理服务",
|
||||||
|
/*
|
||||||
|
* 中国域名
|
||||||
|
*/
|
||||||
|
"RULE-SET,cn,🎯 全球直连",
|
||||||
|
/*
|
||||||
|
* Telegram IP
|
||||||
|
*/
|
||||||
|
"RULE-SET,telegramip,🌍 海外服务,no-resolve",
|
||||||
|
/*
|
||||||
|
* 私有 IP
|
||||||
|
*/
|
||||||
|
"RULE-SET,privateip,🎯 全球直连,no-resolve",
|
||||||
|
/*
|
||||||
|
* 中国 IP
|
||||||
|
*/
|
||||||
|
"RULE-SET,cnip,🎯 全球直连,no-resolve",
|
||||||
|
/*
|
||||||
|
* 最终兜底
|
||||||
|
*/
|
||||||
|
"MATCH,🎯 兜底策略"
|
||||||
|
];
|
||||||
|
/* ============================================================
|
||||||
|
* 十四、主函数
|
||||||
|
* ============================================================
|
||||||
|
*/
|
||||||
|
function main(config) {
|
||||||
|
/*
|
||||||
|
* --------------------------------------------------------
|
||||||
|
* 1. 检查配置
|
||||||
|
* --------------------------------------------------------
|
||||||
|
*/
|
||||||
|
const proxyCount =
|
||||||
|
config &&
|
||||||
|
Array.isArray(
|
||||||
|
config.proxies
|
||||||
|
)
|
||||||
|
? config.proxies.length
|
||||||
|
: 0;
|
||||||
|
const providerCount =
|
||||||
|
config &&
|
||||||
|
config["proxy-providers"] &&
|
||||||
|
typeof config["proxy-providers"] === "object"
|
||||||
|
? Object.keys(
|
||||||
|
config["proxy-providers"]
|
||||||
|
).length
|
||||||
|
: 0;
|
||||||
|
/*
|
||||||
|
* 没有节点,也没有节点提供器。
|
||||||
|
*/
|
||||||
|
if (
|
||||||
|
proxyCount === 0 &&
|
||||||
|
providerCount === 0
|
||||||
|
) {
|
||||||
|
throw new Error(
|
||||||
|
"当前订阅没有找到任何代理节点或代理集合"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* --------------------------------------------------------
|
||||||
|
* 2. 基础配置
|
||||||
|
* --------------------------------------------------------
|
||||||
|
*/
|
||||||
|
Object.assign(
|
||||||
|
config,
|
||||||
|
GENERAL_CONFIG
|
||||||
|
);
|
||||||
|
/*
|
||||||
|
* --------------------------------------------------------
|
||||||
|
* 3. Sniffer
|
||||||
|
* --------------------------------------------------------
|
||||||
|
*/
|
||||||
|
config["sniffer"] =
|
||||||
|
SNIFFER_CONFIG;
|
||||||
|
/*
|
||||||
|
* --------------------------------------------------------
|
||||||
|
* 4. TUN
|
||||||
|
* --------------------------------------------------------
|
||||||
|
*/
|
||||||
|
config["tun"] =
|
||||||
|
TUN_CONFIG;
|
||||||
|
/*
|
||||||
|
* --------------------------------------------------------
|
||||||
|
* 5. DNS
|
||||||
|
* --------------------------------------------------------
|
||||||
|
*/
|
||||||
|
config["dns"] =
|
||||||
|
DNS_CONFIG;
|
||||||
|
/*
|
||||||
|
* --------------------------------------------------------
|
||||||
|
* 6. 代理组
|
||||||
|
* --------------------------------------------------------
|
||||||
|
*/
|
||||||
|
config["proxy-groups"] =
|
||||||
|
createProxyGroups(
|
||||||
|
config
|
||||||
|
);
|
||||||
|
/*
|
||||||
|
* --------------------------------------------------------
|
||||||
|
* 7. 规则集
|
||||||
|
* --------------------------------------------------------
|
||||||
|
*/
|
||||||
|
config["rule-providers"] =
|
||||||
|
RULE_PROVIDERS;
|
||||||
|
/*
|
||||||
|
* --------------------------------------------------------
|
||||||
|
* 8. 规则
|
||||||
|
* --------------------------------------------------------
|
||||||
|
*/
|
||||||
|
config["rules"] =
|
||||||
|
RULES;
|
||||||
|
/*
|
||||||
|
* --------------------------------------------------------
|
||||||
|
* 9. 返回配置
|
||||||
|
* --------------------------------------------------------
|
||||||
|
*/
|
||||||
|
return config;
|
||||||
|
}
|
||||||
@@ -0,0 +1,382 @@
|
|||||||
|
# ============================================================
|
||||||
|
# Loon 主配置
|
||||||
|
# Version: 2.2
|
||||||
|
# Last Update: 2026-08-22
|
||||||
|
#
|
||||||
|
# ============================================================
|
||||||
|
# 更新日志
|
||||||
|
# ============================================================
|
||||||
|
#
|
||||||
|
# 2026-08-22 v2.2
|
||||||
|
# - 所有节点测速统一使用 https://www.gstatic.com/generate_204
|
||||||
|
# - 自动优选 / 故障转移 / AI 自动优选统一使用该测速地址
|
||||||
|
# - 香港 / 台湾 / 日本 / 新加坡 / 韩国 / 美国 / 其他节点
|
||||||
|
# 统一使用该测速地址
|
||||||
|
# - 修复台湾节点图标无法显示的问题
|
||||||
|
# - 除上述两项外,其余配置保持 v2.1 不变
|
||||||
|
#
|
||||||
|
# 2026-08-22 v2.1
|
||||||
|
# - 重构全部 Proxy Group 命名
|
||||||
|
# - 统一国家 / 地区节点命名
|
||||||
|
# - “🌐 其他”改为真正的未分类节点兜底组
|
||||||
|
# - 未匹配香港 / 台湾 / 日本 / 新加坡 / 韩国 / 美国的节点
|
||||||
|
# 自动进入“🌐 其他”
|
||||||
|
# - 排除回国 / 校园 / 游戏 / 通知 / 流量 / 到期 /
|
||||||
|
# 官网 / 客服 / 机场等特殊节点
|
||||||
|
# - AI 节点组排除香港
|
||||||
|
# - AI 加入台湾 / 日本 / 新加坡 / 韩国 / 美国 / 其他
|
||||||
|
# - 增加“🤖 AI 自动优选”
|
||||||
|
# - “海外服务”重命名为“🌍 国际服务”
|
||||||
|
# - 基础策略组统一使用图标前缀
|
||||||
|
# - 保留所有原有 Remote Rule
|
||||||
|
# - 保留所有原有 Plugin
|
||||||
|
# - 保留所有原有 Remote Script
|
||||||
|
# - 保留 TestFlight / 游戏 / Telegram / Google / Apple 等功能
|
||||||
|
#
|
||||||
|
# ============================================================
|
||||||
|
# ============================================================
|
||||||
|
# General
|
||||||
|
# ============================================================
|
||||||
|
[General]
|
||||||
|
ip-mode = v4-only
|
||||||
|
disable-stun = false
|
||||||
|
dns-reject-mode = LoopbackIP
|
||||||
|
domain-reject-mode = DNS
|
||||||
|
udp-fallback-mode = REJECT
|
||||||
|
sni-sniffing = true
|
||||||
|
disconnect-on-policy-change = false
|
||||||
|
switch-node-after-failure-times = 3
|
||||||
|
skip-proxy = 127.0.0.1,192.168.0.0/16,10.0.0.0/8,172.16.0.0/12,100.64.0.0/10,localhost,*.local,passenger.t3go.cn
|
||||||
|
bypass-tun = 10.0.0.0/8,100.64.0.0/10,127.0.0.0/8,169.254.0.0/16,172.16.0.0/12,192.0.0.0/24,192.0.2.0/24,192.88.99.0/24,192.168.0.0/16,198.18.0.0/15,198.51.100.0/24,203.0.113.0/24,224.0.0.0/4,255.255.255.255/32
|
||||||
|
dns-server = system,223.5.5.5,119.29.29.29,1.1.1.1,8.8.8.8
|
||||||
|
allow-udp-proxy = true
|
||||||
|
allow-wifi-access = false
|
||||||
|
wifi-access-http-port = 7222
|
||||||
|
wifi-access-socks5-port = 7221
|
||||||
|
proxy-test-url = http://www.gstatic.com/generate_204
|
||||||
|
internet-test-url = http://connectivitycheck.platform.hicloud.com/generate_204
|
||||||
|
test-timeout = 5
|
||||||
|
interface-mode = auto
|
||||||
|
real-ip = msftconnecttest.com,msftncsi.com,*.msftconnecttest.com,*.msftncsi.com,*.srv.nintendo.net,*.stun.playstation.net,xbox.*.microsoft.com,*.xboxlive.com,*.battlenet.com.cn,*.battlenet.com,*.blzstatic.cn,*.battle.net
|
||||||
|
resource-parser = https://raw.githubusercontent.com/Peng-YM/Sub-Store/master/backend/dist/sub-store-parser.loon.min.js
|
||||||
|
geoip-url = https://github.com/Masaiki/GeoIP2-CN/raw/release/Country.mmdb
|
||||||
|
ipasn-url = https://raw.githubusercontent.com/P3TERX/GeoLite.mmdb/download/GeoLite2-ASN.mmdb
|
||||||
|
# ============================================================
|
||||||
|
# Host
|
||||||
|
# ============================================================
|
||||||
|
[Host]
|
||||||
|
# ------------------------------------------------------------
|
||||||
|
# 阿里
|
||||||
|
# ------------------------------------------------------------
|
||||||
|
*.taobao.com = server:223.5.5.5
|
||||||
|
*.tmall.com = server:223.5.5.5
|
||||||
|
*.alicdn.com = server:223.5.5.5
|
||||||
|
*.aliyun.com = server:223.5.5.5
|
||||||
|
# ------------------------------------------------------------
|
||||||
|
# 京东
|
||||||
|
# ------------------------------------------------------------
|
||||||
|
*.jd.com = server:119.28.28.28
|
||||||
|
# ------------------------------------------------------------
|
||||||
|
# 腾讯 / 微信
|
||||||
|
# ------------------------------------------------------------
|
||||||
|
*.qq.com = server:119.28.28.28
|
||||||
|
*.tencent.com = server:119.28.28.28
|
||||||
|
*.weixin.com = server:119.28.28.28
|
||||||
|
# ------------------------------------------------------------
|
||||||
|
# 网易
|
||||||
|
# ------------------------------------------------------------
|
||||||
|
*.163.com = server:119.29.29.29
|
||||||
|
*.126.com = server:119.29.29.29
|
||||||
|
*.126.net = server:119.29.29.29
|
||||||
|
*.127.net = server:119.29.29.29
|
||||||
|
*.netease.com = server:119.29.29.29
|
||||||
|
# ------------------------------------------------------------
|
||||||
|
# 小米
|
||||||
|
# ------------------------------------------------------------
|
||||||
|
*.mi.com = server:119.29.29.29
|
||||||
|
*.xiaomi.com = server:119.29.29.29
|
||||||
|
# ------------------------------------------------------------
|
||||||
|
# Bilibili
|
||||||
|
# ------------------------------------------------------------
|
||||||
|
*.bilibili.com = server:119.29.29.29
|
||||||
|
# ------------------------------------------------------------
|
||||||
|
# TestFlight
|
||||||
|
# ------------------------------------------------------------
|
||||||
|
*.testflight.apple.com = server:8.8.4.4
|
||||||
|
# ------------------------------------------------------------
|
||||||
|
# TestFlight 下载 CDN
|
||||||
|
# ------------------------------------------------------------
|
||||||
|
iosapps.itunes.apple.com = iosapps.itunes.apple.com.download.ks-cdn.com
|
||||||
|
# ============================================================
|
||||||
|
# Proxy
|
||||||
|
# ============================================================
|
||||||
|
[Proxy]
|
||||||
|
# ============================================================
|
||||||
|
# Remote Proxy
|
||||||
|
# ============================================================
|
||||||
|
[Remote Proxy]
|
||||||
|
# 在这里填写机场订阅
|
||||||
|
#
|
||||||
|
# 示例:
|
||||||
|
#
|
||||||
|
# 我的机场 = https://example.com/subscription
|
||||||
|
# ============================================================
|
||||||
|
# Proxy Group
|
||||||
|
# ============================================================
|
||||||
|
[Proxy Group]
|
||||||
|
# ============================================================
|
||||||
|
# 01. 总入口
|
||||||
|
# ============================================================
|
||||||
|
🚀 代理总入口 = select,⚡ 自动优选,🛡️ 故障转移,🇭🇰 香港,🇹🇼 台湾,🇯🇵 日本,🇸🇬 新加坡,🇰🇷 韩国,🇺🇸 美国,🌐 其他,DIRECT,img-url = https://raw.githubusercontent.com/fmz200/wool_scripts/main/icons/apps/Loon_02.png
|
||||||
|
# ============================================================
|
||||||
|
# 02. 核心自动策略
|
||||||
|
# ============================================================
|
||||||
|
⚡ 自动优选 = url-test,🇭🇰 香港,🇹🇼 台湾,🇯🇵 日本,🇸🇬 新加坡,🇰🇷 韩国,🇺🇸 美国,🌐 其他,url = https://www.gstatic.com/generate_204,interval = 600,tolerance = 50,img-url = https://raw.githubusercontent.com/Koolson/Qure/master/IconSet/Color/Auto.png
|
||||||
|
# ============================================================
|
||||||
|
# 03. 故障转移
|
||||||
|
# ============================================================
|
||||||
|
🛡️ 故障转移 = fallback,🇭🇰 香港,🇹🇼 台湾,🇯🇵 日本,🇸🇬 新加坡,🇰🇷 韩国,🇺🇸 美国,🌐 其他,url = https://www.gstatic.com/generate_204,interval = 300,max-timeout = 3000,img-url = https://raw.githubusercontent.com/Koolson/Qure/master/IconSet/Color/Failure.png
|
||||||
|
# ============================================================
|
||||||
|
# 04. 国家 / 地区节点
|
||||||
|
# ============================================================
|
||||||
|
# ------------------------------------------------------------
|
||||||
|
# 香港
|
||||||
|
# ------------------------------------------------------------
|
||||||
|
🇭🇰 香港 = url-test,HK_Filter,url = https://www.gstatic.com/generate_204,interval = 600,tolerance = 50,img-url = https://raw.githubusercontent.com/Koolson/Qure/master/IconSet/Color/Hong_Kong.png
|
||||||
|
# ------------------------------------------------------------
|
||||||
|
# 台湾
|
||||||
|
# ------------------------------------------------------------
|
||||||
|
🇹🇼 台湾 = url-test,TW_Filter,url = https://www.gstatic.com/generate_204,interval = 600,tolerance = 50,img-url = https://github.com/Koolson/Qure/raw/refs/heads/master/IconSet/Color/Taiwan.png
|
||||||
|
# ------------------------------------------------------------
|
||||||
|
# 日本
|
||||||
|
# ------------------------------------------------------------
|
||||||
|
🇯🇵 日本 = url-test,JP_Filter,url = https://www.gstatic.com/generate_204,interval = 600,tolerance = 50,img-url = https://raw.githubusercontent.com/Koolson/Qure/master/IconSet/Color/Japan.png
|
||||||
|
# ------------------------------------------------------------
|
||||||
|
# 新加坡
|
||||||
|
# ------------------------------------------------------------
|
||||||
|
🇸🇬 新加坡 = url-test,SG_Filter,url = https://www.gstatic.com/generate_204,interval = 600,tolerance = 50,img-url = https://raw.githubusercontent.com/Koolson/Qure/master/IconSet/Color/Singapore.png
|
||||||
|
# ------------------------------------------------------------
|
||||||
|
# 韩国
|
||||||
|
# ------------------------------------------------------------
|
||||||
|
🇰🇷 韩国 = url-test,KR_Filter,url = https://www.gstatic.com/generate_204,interval = 600,tolerance = 50,img-url = https://raw.githubusercontent.com/Koolson/Qure/master/IconSet/Color/Korea.png
|
||||||
|
# ------------------------------------------------------------
|
||||||
|
# 美国
|
||||||
|
# ------------------------------------------------------------
|
||||||
|
🇺🇸 美国 = url-test,US_Filter,url = https://www.gstatic.com/generate_204,interval = 600,tolerance = 50,img-url = https://raw.githubusercontent.com/Koolson/Qure/master/IconSet/Color/United_States.png
|
||||||
|
# ------------------------------------------------------------
|
||||||
|
# 其他
|
||||||
|
# ------------------------------------------------------------
|
||||||
|
# 真正的未分类节点兜底组。
|
||||||
|
#
|
||||||
|
# 未匹配:
|
||||||
|
# 香港 / 台湾 / 日本 / 新加坡 / 韩国 / 美国
|
||||||
|
#
|
||||||
|
# 的节点进入这里。
|
||||||
|
#
|
||||||
|
# 以下特殊节点不会进入:
|
||||||
|
# 回国 / 校园 / 游戏 / 通知 / 流量 / 到期 /
|
||||||
|
# 官网 / 客服 / 机场
|
||||||
|
🌐 其他 = url-test,OT_Filter,url = https://www.gstatic.com/generate_204,interval = 600,tolerance = 50,img-url = https://gitlab.com/lodepuly/iconlibrary/-/raw/main/Flag_icon/120px/WW.png
|
||||||
|
# ============================================================
|
||||||
|
# 05. 通用功能策略
|
||||||
|
# ============================================================
|
||||||
|
# ------------------------------------------------------------
|
||||||
|
# 广告
|
||||||
|
# ------------------------------------------------------------
|
||||||
|
🛑 广告拦截 = select,REJECT,img-url = https://raw.githubusercontent.com/Koolson/Qure/master/IconSet/Color/Advertising.png
|
||||||
|
# ------------------------------------------------------------
|
||||||
|
# 系统服务
|
||||||
|
# ------------------------------------------------------------
|
||||||
|
🍎 系统服务 = select,DIRECT,🚀 代理总入口,img-url = https://raw.githubusercontent.com/Koolson/Qure/master/IconSet/Color/Apple.png
|
||||||
|
# ------------------------------------------------------------
|
||||||
|
# 网络测试
|
||||||
|
# ------------------------------------------------------------
|
||||||
|
📶 网络测试 = select,DIRECT,🚀 代理总入口,img-url = https://raw.githubusercontent.com/Koolson/Qure/master/IconSet/Color/Speedtest.png
|
||||||
|
# ------------------------------------------------------------
|
||||||
|
# 国内直连
|
||||||
|
# ------------------------------------------------------------
|
||||||
|
🇨🇳 国内直连 = select,DIRECT,🚀 代理总入口,img-url = https://raw.githubusercontent.com/Koolson/Qure/master/IconSet/Color/China.png
|
||||||
|
# ------------------------------------------------------------
|
||||||
|
# 国际代理
|
||||||
|
# ------------------------------------------------------------
|
||||||
|
🌐 国际代理 = select,🚀 代理总入口,DIRECT,img-url = https://raw.githubusercontent.com/Koolson/Qure/master/IconSet/Color/Proxy.png
|
||||||
|
# ============================================================
|
||||||
|
# 06. AI
|
||||||
|
# ============================================================
|
||||||
|
# ------------------------------------------------------------
|
||||||
|
# AI 自动优选
|
||||||
|
# ------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# 香港不参与 AI。
|
||||||
|
#
|
||||||
|
# AI 可使用:
|
||||||
|
# 台湾 / 日本 / 新加坡 / 韩国 / 美国 / 其他
|
||||||
|
#
|
||||||
|
🤖 AI 自动优选 = url-test,🇹🇼 台湾,🇯🇵 日本,🇸🇬 新加坡,🇰🇷 韩国,🇺🇸 美国,🌐 其他,url = https://www.gstatic.com/generate_204,interval = 600,tolerance = 80,img-url = https://raw.githubusercontent.com/fmz200/wool_scripts/main/icons/apps/ChatGPT3.png
|
||||||
|
# ------------------------------------------------------------
|
||||||
|
# AI 手动选择
|
||||||
|
# ------------------------------------------------------------
|
||||||
|
🤖 人工智能 = select,🤖 AI 自动优选,🇹🇼 台湾,🇯🇵 日本,🇸🇬 新加坡,🇰🇷 韩国,🇺🇸 美国,🌐 其他,img-url = https://raw.githubusercontent.com/fmz200/wool_scripts/main/icons/apps/ChatGPT3.png
|
||||||
|
# ============================================================
|
||||||
|
# 07. 国际服务
|
||||||
|
# ============================================================
|
||||||
|
🌍 国际服务 = select,🚀 代理总入口,⚡ 自动优选,🛡️ 故障转移,🇹🇼 台湾,🇯🇵 日本,🇸🇬 新加坡,🇰🇷 韩国,🇺🇸 美国,🌐 其他,img-url = https://raw.githubusercontent.com/Koolson/Qure/master/IconSet/Color/Global.png
|
||||||
|
# ============================================================
|
||||||
|
# Remote Filter
|
||||||
|
# ============================================================
|
||||||
|
[Remote Filter]
|
||||||
|
# ============================================================
|
||||||
|
# 01. 其他节点
|
||||||
|
# ============================================================
|
||||||
|
OT_Filter = NameRegex, FilterKey = "^(?!.*((?i)🇭🇰|香港|\bHK\b|\bHKG\b|Hong Kong|🇹🇼|台湾|\bTW\b|\bTWN\b|Taiwan|🇯🇵|日本|\bJP\b|\bJPN\b|Japan|🇸🇬|新加坡|狮城|\bSG\b|\bSGP\b|Singapore|🇰🇷|韩国|首尔|\bKR\b|\bKOR\b|Korea|🇺🇸|美国|\bUS\b|\bUSA\b|United States|回国|校园|游戏|通知|流量|到期|官网|客服|机场)).*$"
|
||||||
|
# ============================================================
|
||||||
|
# 02. 香港
|
||||||
|
# ============================================================
|
||||||
|
HK_Filter = NameRegex, FilterKey = "^(?=.*((?i)🇭🇰|香港|\b(HK|HKG|Hong Kong)\b))(?!.*((?i)回国|校园|游戏|通知|流量|到期|官网|客服|机场)).*$"
|
||||||
|
# ============================================================
|
||||||
|
# 03. 台湾
|
||||||
|
# ============================================================
|
||||||
|
TW_Filter = NameRegex, FilterKey = "^(?=.*((?i)🇹🇼|台湾|\b(TW|TWN|Taiwan)\b))(?!.*((?i)回国|校园|游戏|通知|流量|到期|官网|客服|机场)).*$"
|
||||||
|
# ============================================================
|
||||||
|
# 04. 日本
|
||||||
|
# ============================================================
|
||||||
|
JP_Filter = NameRegex, FilterKey = "^(?=.*((?i)🇯🇵|日本|\b(JP|JPN|Japan)\b))(?!.*((?i)回国|校园|游戏|通知|流量|到期|官网|客服|机场)).*$"
|
||||||
|
# ============================================================
|
||||||
|
# 05. 新加坡
|
||||||
|
# ============================================================
|
||||||
|
SG_Filter = NameRegex, FilterKey = "^(?=.*((?i)🇸🇬|新加坡|狮城|\b(SG|SGP|Singapore)\b))(?!.*((?i)回国|校园|游戏|通知|流量|到期|官网|客服|机场)).*$"
|
||||||
|
# ============================================================
|
||||||
|
# 06. 韩国
|
||||||
|
# ============================================================
|
||||||
|
KR_Filter = NameRegex, FilterKey = "^(?=.*((?i)🇰🇷|韩国|首尔|\b(KR|KOR|Korea)\b))(?!.*((?i)回国|校园|游戏|通知|流量|到期|官网|客服|机场)).*$"
|
||||||
|
# ============================================================
|
||||||
|
# 07. 美国
|
||||||
|
# ============================================================
|
||||||
|
US_Filter = NameRegex, FilterKey = "^(?=.*((?i)🇺🇸|美国|\b(US|USA|United States)\b))(?!.*((?i)回国|校园|游戏|通知|流量|到期|官网|客服|机场)).*$"
|
||||||
|
# ============================================================
|
||||||
|
# Rule
|
||||||
|
# ============================================================
|
||||||
|
[Rule]
|
||||||
|
# ------------------------------------------------------------
|
||||||
|
# 日志 / 信息收集
|
||||||
|
# ------------------------------------------------------------
|
||||||
|
URL-REGEX,\.log\.,REJECT
|
||||||
|
# ------------------------------------------------------------
|
||||||
|
# 海角社区
|
||||||
|
# ------------------------------------------------------------
|
||||||
|
DOMAIN-KEYWORD,haijiao,🇺🇸 美国
|
||||||
|
# ------------------------------------------------------------
|
||||||
|
# 最终兜底
|
||||||
|
# ------------------------------------------------------------
|
||||||
|
FINAL,🚀 代理总入口
|
||||||
|
# ============================================================
|
||||||
|
# Remote Rule
|
||||||
|
# ============================================================
|
||||||
|
[Remote Rule]
|
||||||
|
# ------------------------------------------------------------
|
||||||
|
# 01. 广告
|
||||||
|
# ------------------------------------------------------------
|
||||||
|
https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Loon/Advertising/Advertising.list, policy=🛑 广告拦截, tag=Advertising, enabled=true
|
||||||
|
https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Loon/Advertising/Advertising_Domain.list, policy=🛑 广告拦截, tag=Advertising_Domain, enabled=true
|
||||||
|
# ------------------------------------------------------------
|
||||||
|
# 02. AI
|
||||||
|
# ------------------------------------------------------------
|
||||||
|
https://github.com/fmz200/wool_scripts/raw/main/Loon/rule/AI.list, policy=🤖 人工智能, tag=AI分流合集@奶思, enabled=true
|
||||||
|
# ------------------------------------------------------------
|
||||||
|
# 03. 国际媒体 / 社交
|
||||||
|
# ------------------------------------------------------------
|
||||||
|
https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Loon/Netflix/Netflix.list, policy=🌍 国际服务, tag=Netflix, enabled=true
|
||||||
|
https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Loon/YouTube/YouTube.list, policy=🌍 国际服务, tag=YouTube, enabled=true
|
||||||
|
https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Loon/Spotify/Spotify.list, policy=🌍 国际服务, tag=Spotify, enabled=true
|
||||||
|
https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Loon/Bahamut/Bahamut.list, policy=🌍 国际服务, tag=Bahamut, enabled=true
|
||||||
|
https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Loon/GlobalMedia/GlobalMedia.list, policy=🌐 国际代理, tag=GlobalMedia, enabled=true
|
||||||
|
https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Loon/Telegram/Telegram.list, policy=🌍 国际服务, tag=Telegram, enabled=true
|
||||||
|
# ------------------------------------------------------------
|
||||||
|
# 04. Apple / Microsoft / Google
|
||||||
|
# ------------------------------------------------------------
|
||||||
|
https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Loon/Apple/Apple.list, policy=🍎 系统服务, tag=Apple, enabled=true
|
||||||
|
https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Loon/Microsoft/Microsoft.list, policy=🍎 系统服务, tag=Microsoft, enabled=true
|
||||||
|
https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Loon/Google/Google.list, policy=🌍 国际服务, tag=Google, enabled=true
|
||||||
|
# ------------------------------------------------------------
|
||||||
|
# 05. 游戏 / TestFlight
|
||||||
|
# ------------------------------------------------------------
|
||||||
|
https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Loon/Game/Game.list, policy=🍎 系统服务, tag=Game, enabled=true
|
||||||
|
https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Loon/TestFlight/TestFlight.list, policy=🚀 代理总入口, tag=TestFlight, enabled=true
|
||||||
|
# ------------------------------------------------------------
|
||||||
|
# 06. 国内
|
||||||
|
# ------------------------------------------------------------
|
||||||
|
https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Loon/BiliBili/BiliBili.list, policy=🇨🇳 国内直连, tag=BiliBili, enabled=true
|
||||||
|
https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Loon/China/China.list, policy=DIRECT, tag=China, enabled=true
|
||||||
|
# ------------------------------------------------------------
|
||||||
|
# 07. 国际代理
|
||||||
|
# ------------------------------------------------------------
|
||||||
|
https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Loon/Proxy/Proxy.list, policy=🌐 国际代理, tag=Proxy, enabled=true
|
||||||
|
https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Loon/Proxy/Proxy_Domain.list, policy=🌐 国际代理, tag=Proxy_Domain, enabled=true
|
||||||
|
# ------------------------------------------------------------
|
||||||
|
# 08. 网络测试
|
||||||
|
# ------------------------------------------------------------
|
||||||
|
https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Loon/Speedtest/Speedtest.list, policy=📶 网络测试, tag=Speedtest, enabled=true
|
||||||
|
# ============================================================
|
||||||
|
# Rewrite
|
||||||
|
# ============================================================
|
||||||
|
[Rewrite]
|
||||||
|
# TestFlight 区域解锁
|
||||||
|
#
|
||||||
|
# ^https?://testflight\.apple\.com/v\d/accounts/.+?/install$ request-body-json-jq '.storefrontId = "143441-19,29"'
|
||||||
|
# ============================================================
|
||||||
|
# Script
|
||||||
|
# ============================================================
|
||||||
|
[Script]
|
||||||
|
# ============================================================
|
||||||
|
# Remote Script
|
||||||
|
# ============================================================
|
||||||
|
[Remote Script]
|
||||||
|
https://github.com/fmz200/wool_scripts/raw/main/Loon/script/tools.scripts, tag=脚本工具合集@fmz200, enabled=true
|
||||||
|
# ============================================================
|
||||||
|
# Plugin
|
||||||
|
# ============================================================
|
||||||
|
[Plugin]
|
||||||
|
# ------------------------------------------------------------
|
||||||
|
# 开屏去广告
|
||||||
|
# ------------------------------------------------------------
|
||||||
|
https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/startup/startup.lnplugin, tag=开屏去广告, enabled=true
|
||||||
|
# ------------------------------------------------------------
|
||||||
|
# 广告重写
|
||||||
|
# ------------------------------------------------------------
|
||||||
|
https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rewrite/Loon/Advertising/Advertising.plugin, tag=Advertising, enabled=true
|
||||||
|
# ------------------------------------------------------------
|
||||||
|
# 通用重写
|
||||||
|
# ------------------------------------------------------------
|
||||||
|
https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rewrite/Loon/Redirect/Redirect.plugin, tag=General, enabled=true
|
||||||
|
# ------------------------------------------------------------
|
||||||
|
# Skip Proxy
|
||||||
|
# ------------------------------------------------------------
|
||||||
|
https://raw.githubusercontent.com/Tartarus2014/Loon-Script/refs/heads/master/Plugin/skip-proxy.lpx, img-url=https://raw.githubusercontent.com/Orz-3/mini/master/Alpha/Imm.png, enabled=true
|
||||||
|
# ------------------------------------------------------------
|
||||||
|
# BoxJS
|
||||||
|
# ------------------------------------------------------------
|
||||||
|
https://raw.githubusercontent.com/chavyleung/scripts/master/box/rewrite/boxjs.rewrite.loon.plugin, policy=🚀 代理总入口, enabled=true
|
||||||
|
# ------------------------------------------------------------
|
||||||
|
# Sub-Store
|
||||||
|
# ------------------------------------------------------------
|
||||||
|
https://raw.githubusercontent.com/sub-store-org/Sub-Store/master/config/Loon.plugin, policy=🚀 代理总入口, enabled=true
|
||||||
|
# ------------------------------------------------------------
|
||||||
|
# Script-Hub
|
||||||
|
# ------------------------------------------------------------
|
||||||
|
https://raw.githubusercontent.com/Script-Hub-Org/Script-Hub/main/modules/script-hub.loon.plugin, policy=🚀 代理总入口, enabled=true
|
||||||
|
# ------------------------------------------------------------
|
||||||
|
# 节点检测
|
||||||
|
# ------------------------------------------------------------
|
||||||
|
https://raw.githubusercontent.com/Tartarus2014/Loon-Script/master/Plugin/MediaCheck.plugin, tag=Node Detection Tool, enabled=true
|
||||||
|
# ------------------------------------------------------------
|
||||||
|
# TestFlight 下载
|
||||||
|
# ------------------------------------------------------------
|
||||||
|
https://raw.githubusercontent.com/Tartarus2014/Loon-Script/master/Plugin/TF-Download.plugin, tag=TF-Download, enabled=true
|
||||||
|
# ============================================================
|
||||||
|
# Mitm
|
||||||
|
# ============================================================
|
||||||
|
[Mitm]
|
||||||
|
hostname = -www.google.com
|
||||||
|
ca-p12 =
|
||||||
|
ca-passphrase =
|
||||||
|
skip-server-cert-verify = false
|
||||||
Reference in New Issue
Block a user