【科学上网】在Clash Verge中达成Clash for Windows的Parsers功能

  1. 1. 写在前面
  2. 2. 配置文件(个人修改版,仅实现简单功能)
    1. 2.1. Script部分(GEOSITE)
    2. 2.2. Merge部分
  3. 3. 大佬原版配置文件(实现多地区多平台分流)
    1. 3.1. Script部分
    2. 3.2. 完整Rule-Provider配置

写在前面

在Clash for Windows删库跑路后,Clash Verge成为了大众的主流选择(不代表Clash for Windows不能用了,只是没有后续更新而已)。我在转到这个软件后,发现它居然没有**Parsers功能**,这让我感到十分遗憾。

于是我找到了一个解决方案,通过Clash Verge的配置文件,将类似Parsers功能添加到Clash Verge中。

配置文件(个人修改版,仅实现简单功能)

Script部分(GEOSITE)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
// Define the `main` function

// function main(params) {
// return params;
// }

// Define the `main` function

function main(params) {
// 所有地区
const allRegex = /自动|故障|流量|官网|套餐|机场|订阅/;
const allProxies = params.proxies
.filter((e) => !allRegex.test(e.name))
.map((e) => e.name);
// Emby
const embyRegex = /香港|🇭🇰|HK|HongKong|港|美|美国|US|United States|America|🇺🇸|Los Angeles|San Jose|Phoenix|洛杉矶|圣何塞|凤凰城|斯巴达|UnitedStates/;
const embyProxies = params.proxies
.filter((e) => embyRegex.test(e.name))
.map((e) => e.name);
// 狮城地区
const singaporeRegex = /新加坡|狮城|SG|Singapore|🇸🇬|Singapore|坡/;
const singaporeProxies = params.proxies
.filter((e) => singaporeRegex.test(e.name))
.map((e) => e.name);
// 日本地区
const japanRegex = /日本|JP|Japan|🇯🇵|Tokyo|Osaka|霓虹|小日子/;
const japanProxies = params.proxies
.filter((e) => japanRegex.test(e.name))
.map((e) => e.name);
// 美国地区
const americaRegex = /美国|US|United States|America|🇺🇸|Los Angeles|San Jose|Phoenix|洛杉矶|圣何塞|凤凰城|斯巴达|UnitedStates/;
const americaProxies = params.proxies
.filter((e) => americaRegex.test(e.name))
.map((e) => e.name);
// 节点选择
const Proxy = {
name: "全球代理",
type: "select",
icon: 'https://gcore.jsdelivr.net/gh/Orz-3/mini/Color/Global.png',
proxies: allProxies.length > 0 ? allProxies : ["DIRECT"]
};
// 日本流媒体
const JMedia = {
name: "日本媒体",
type: "select",
url: "https://www.gstatic.com/generate_204",
icon: "https://gcore.jsdelivr.net/gh/Orz-3/mini/Color/JP.png",
interval: 300,
tolerance: 20,
timeout: 2000,
lazy: true,
proxies: japanProxies.length > 0 ? japanProxies : ["全球代理"]
};
// Emby
const Emby = {
name: "Emby媒体",
type: "select",
url: "https://www.gstatic.com/generate_204",
icon: "https://gcore.jsdelivr.net/gh/Orz-3/mini/Color/Emby.png",
interval: 300,
tolerance: 20,
timeout: 2000,
lazy: true,
proxies: embyProxies.length > 0 ? embyProxies : ["全球代理"]
};
// AI应用
const AIGC = {
name: "AIGC",
type: "url-test",
url: "https://www.gstatic.com/generate_204",
icon: "https://gcore.jsdelivr.net/gh/Orz-3/mini/Color/OpenAI.png",
interval: 300,
tolerance: 20,
timeout: 2000,
lazy: true,
proxies: americaProxies.length > 0 ? americaProxies : ["全球代理"]
};
// 成人网站
const Porn = {
name: "成人网站",
type: "select",
url: "https://www.gstatic.com/generate_204",
icon: "https://gcore.jsdelivr.net/gh/Orz-3/mini/Color/Pornhub.png",
interval: 300,
tolerance: 20,
timeout: 2000,
lazy: true,
proxies: embyProxies.length > 0 ? embyProxies : ["全球代理"]
};
// TG消息
const Telegram = {
name: "TG消息",
type: "select",
icon: "https://gcore.jsdelivr.net/gh/Orz-3/mini/Color/SG.png",
proxies: singaporeProxies.length > 0 ? singaporeProxies : ["全球代理"]
};
// 广告屏蔽
const AdBlock = {
name: "广告屏蔽",
type: "select",
icon: "https://gcore.jsdelivr.net/gh/Orz-3/mini/Color/Adblock.png",
proxies: ["REJECT"]
};
// 国内直连
const Direct = {
name: "国内直连",
type: "select",
icon: "https://gcore.jsdelivr.net/gh/Orz-3/mini/Color/CN.png",
proxies: ["DIRECT"]
};
const groups = params["proxy-groups"] = [];
// 规则
const rules = [
// 屏蔽国外Quic流量
"AND,(AND,(DST-PORT,443),(NETWORK,UDP)),(NOT,((GEOIP,CN))),广告屏蔽",
// 屏蔽Adobe注册服务器
"DOMAIN-SUFFIX,adobe.io,广告屏蔽",
"DOMAIN-SUFFIX,adobestats.io,广告屏蔽",
"DOMAIN,prod.adobegenuine.com,广告屏蔽",
"DOMAIN,uf0onoepoe.adobestats.io,广告屏蔽",
// 放行
"DOMAIN-SUFFIX,baomitu.com,国内直连",
"DOMAIN-SUFFIX,qhimg.com,国内直连",
"IP-CIDR,60.164.220.222/32,国内直连,no-resolve",
"DOMAIN-SUFFIX,chinagwy.org,国内直连",
"DOMAIN-SUFFIX,gov.cn,国内直连",
"DOMAIN-SUFFIX,qhpta.com,国内直连",
"DOMAIN-SUFFIX,nomax.vip,国内直连",
"DOMAIN-SUFFIX,pc.wiki,国内直连",
// 屏蔽搜狗 & 360
"GEOSITE,sogou,广告屏蔽",
"GEOSITE,qihoo360,广告屏蔽",
// 蓝奏云的怪域名
"DOMAIN-SUFFIX,wwentua.com,国内直连",
// Palworld
"DOMAIN-SUFFIX,palworldgame.com,广告屏蔽",
"DOMAIN-SUFFIX,pocketpair,广告屏蔽",
// 屏蔽腾讯遥测
"DOMAIN-SUFFIX,otheve.beacon.qq.com,广告屏蔽",
"DOMAIN-SUFFIX,tpstelemetry.tencent.com,广告屏蔽",
"DOMAIN-SUFFIX,h.trace.qq.com,广告屏蔽",
"DOMAIN-SUFFIX,report.gamecenter.qq.com,广告屏蔽",
// 老鹰讲AE
"DOMAIN-SUFFIX,aic4d.com,国内直连",
// 日本流媒体
"DOMAIN-SUFFIX,jp,日本媒体",
"DOMAIN-KEYWORD,asobistage,日本媒体",
"GEOSITE,abema,日本媒体",
"GEOSITE,niconico,日本媒体",
"GEOSITE,dmm,日本媒体",
"GEOSITE,pixiv,日本媒体",
"GEOSITE,apple,日本媒体",
// AI应用
"GEOSITE,openai,AIGC",
"GEOSITE,anthropic,AIGC",
"DOMAIN-SUFFIX,bard.google.com,AIGC",
"DOMAIN-SUFFIX,g4f.icu,AIGC",
// Emby
"DOMAIN-SUFFIX,pilipiliultra.top,Emby媒体",
"DOMAIN-SUFFIX,pilipiliultra.com,Emby媒体",
"DOMAIN-SUFFIX,jmsooo.com,Emby媒体",
"DOMAIN-SUFFIX,misakaf.org,Emby媒体",
"DOMAIN-SUFFIX,gp.ii00.cc,Emby媒体",
"DOMAIN-SUFFIX,gg.ii00.cc,Emby媒体",
"DOMAIN-SUFFIX,sp.ii00.cc,国内直连",
"DOMAIN-SUFFIX,sg.ii00.cc,国内直连",
"DOMAIN-SUFFIX,bili.rip,Emby媒体",
// GEOSITE
"GEOSITE,category-porn,成人网站",
"GEOSITE,tracker,国内直连",
"GEOSITE,youtube,全球代理",
"GEOSITE,google,全球代理",
"GEOSITE,biliintl,全球代理",
"GEOSITE,xbox,全球代理",
"GEOSITE,microsoft@cn,国内直连",
"GEOSITE,microsoft,全球代理",
"GEOSITE,telegram,TG消息",
"GEOSITE,private,国内直连",
"DOMAIN-SUFFIX,steamusercontent.com,全球代理",
"GEOSITE,steam@cn,国内直连",
"GEOSITE,steam,全球代理",
"GEOSITE,steamunlocked,全球代理",
"GEOSITE,category-game-accelerator-cn,国内直连",
"GEOSITE,epicgames,国内直连",
"DOMAIN-SUFFIX,cn,国内直连",
"GEOSITE,geolocation-!cn,全球代理",
"GEOSITE,cn,国内直连",
"GEOIP,private,国内直连,no-resolve",
"GEOIP,telegram,TG消息,no-resolve",
"GEOIP,google,全球代理,no-resolve",
"GEOIP,twitter,全球代理,no-resolve",
"GEOIP,cn,国内直连,no-resolve",
"MATCH,全球代理"
];

// 插入分组
groups.unshift(Proxy, JMedia, AIGC, Telegram, Emby, Porn, AdBlock, Direct)
// 插入规则
params.rules = rules;

return params;
}

Merge部分

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
mode: rule                            # 规则模式:rule(规则) / global(全局代理)/ direct(全局直连)/ script (脚本)
ipv6: true # 开启 IPv6 总开关,关闭阻断所有 IPv6 链接和屏蔽 DNS 请求 AAAA 记录
log-level: info # 设置日志输出级别 (5 个级别:silent / error / warning / info / debug)
mixed-port: 20810 # 混合端口,HTTP和SOCKS5用一个端口
unified-delay: true # 统一延迟,更换延迟计算方式,去除握手等额外延迟
tcp-concurrent: true # 【Meta专属】TCP 并发连接所有 IP, 将使用最快握手的 TCP
keep-alive-interval: 15 # TCP keep alive interval

geodata-mode: true # 【Meta专属】使用geoip.dat数据库(默认:false使用mmdb数据库)
geox-url:
geoip: "https://fastly.jsdelivr.net/gh/MetaCubeX/meta-rules-dat@release/geoip.dat"
geosite: "https://fastly.jsdelivr.net/gh/MetaCubeX/meta-rules-dat@release/geosite.dat"
mmdb: "https://fastly.jsdelivr.net/gh/MetaCubeX/meta-rules-dat@release/geoip.metadb"
geo-auto-update: true # 【Meta专属】启用自动更新GEO文件
geo-update-interval: 24 # 【Meta专属】自动更新GEO文件间隔

find-process-mode: strict # 匹配所有进程(always/strict/off)
global-client-fingerprint: chrome # 全局 TLS 指纹,优先低于 proxy 内的 client-fingerprint
# 可选: "chrome","firefox","safari","ios","random","none" options.

profile:
store-selected: true # 存储 select 选择记录
store-fake-ip: true # 持久化 fake-ip

dns:
enable: true # 关闭将使用系统 DNS
ipv6: true # IPV6解析开关;如果为false,将返回ipv6结果为空
enhanced-mode: fake-ip # 模式:redir-host或fake-ip
listen: 0.0.0.0:1053 # DNS 监听地址
use-hosts: true # 是否查询系统 hosts
fake-ip-range: 198.18.0.1/16 # fakeip 下的 IP 段设置,tun 网卡的默认 ip 也使用此值
fake-ip-filter: ['+.lan', '+.msftncsi.com', 'msftconnecttest.com', '+.msftconnecttest.com', '*.msftncsi.com', '*.msftconnecttest.com']
# Fake-ip 过滤,列表中的域名返回真实IP
default-nameserver: [223.5.5.5, 119.29.29.29]
# 解析非IP的dns用的dns服务器,只支持纯IP,(Meta可为其加密)
nameserver: ["https://doh.dns.sb/dns-query#全球代理", "https://1.1.1.1/dns-query#全球代理"]
# 默认DNS服务器,支持udp/tcp/dot/doh/doq
proxy-server-nameserver: [223.5.5.5, 119.29.29.29]
# 代理DNS服务器,支持udp/tcp/dot/doh/doq
nameserver-policy:
"geosite:cn,private,bytedance,steam@cn,epicgames,microsoft@cn,apple@cn": ['https://doh.pub/dns-query', 'https://dns.alidns.com/dns-query']
"geosite:steam,speedtest": ["https://dns.google/dns-query#全球代理"]
# 指定域名查询的解析服务器,可使用 geosite, 优先于 nameserver/fallback 查询

大佬原版配置文件(实现多地区多平台分流)

Script部分

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
// Define the `main` function

// function main(params) {
// return params;
// }

// Define the `main` function

function main(params) {

// 香港地区
const hongKongRegex = /香港|HK|Hong|🇭🇰/;
const hongKongProxies = params.proxies
.filter((e) => hongKongRegex.test(e.name))
.map((e) => e.name);
// 台湾地区
const taiwanRegex = /台湾|TW|Taiwan|Wan|🇨🇳|🇹🇼/;
const taiwanProxies = params.proxies
.filter((e) => taiwanRegex.test(e.name))
.map((e) => e.name);
// 狮城地区
const singaporeRegex = /新加坡|狮城|SG|Singapore|🇸🇬/;
const singaporeProxies = params.proxies
.filter((e) => singaporeRegex.test(e.name))
.map((e) => e.name);
// 日本地区
const japanRegex = /日本|JP|Japan|🇯🇵/;
const japanProxies = params.proxies
.filter((e) => japanRegex.test(e.name))
.map((e) => e.name);
// 美国地区
const americaRegex = /美国|US|United States|America|🇺🇸/;
const americaProxies = params.proxies
.filter((e) => americaRegex.test(e.name))
.map((e) => e.name);
// 其他地区
const othersRegex = /香港|HK|Hong|🇭🇰|台湾|TW|Taiwan|Wan|🇨🇳|🇹🇼|新加坡|SG|Singapore|狮城|🇸🇬|日本|JP|Japan|🇯🇵|美国|US|States|America|🇺🇸|自动|故障|流量|官网|套餐|机场|订阅/;
const othersProxies = params.proxies
.filter((e) => !othersRegex.test(e.name))
.map((e) => e.name);
// 所有地区
const allRegex = /自动|故障|流量|官网|套餐|机场|订阅/;
const allProxies = params.proxies
.filter((e) => !allRegex.test(e.name))
.map((e) => e.name);

// 香港
const HongKong = {
name: "HongKong",
type: "url-test",
url: "http://www.gstatic.com/generate_204",
interval: 300,
tolerance: 20,
lazy: true,
proxies: hongKongProxies.length > 0 ? hongKongProxies : ["DIRECT"]
};
// 台湾
const TaiWan = {
name: "TaiWan",
type: "url-test",
url: "http://www.gstatic.com/generate_204",
interval: 300,
tolerance: 20,
lazy: true,
proxies: taiwanProxies.length > 0 ? taiwanProxies : ["DIRECT"]
};
// 狮城
const Singapore = {
name: "Singapore",
type: "url-test",
url: "http://www.gstatic.com/generate_204",
interval: 300,
tolerance: 20,
lazy: true,
proxies: singaporeProxies.length > 0 ? singaporeProxies : ["DIRECT"]
};
// 日本
const Japan = {
name: "Japan",
type: "url-test",
url: "http://www.gstatic.com/generate_204",
interval: 300,
tolerance: 20,
lazy: true,
proxies: japanProxies.length > 0 ? japanProxies : ["DIRECT"]
};
// 美国
const America = {
name: "America",
type: "url-test",
url: "http://www.gstatic.com/generate_204",
interval: 300,
tolerance: 20,
lazy: true,
proxies: americaProxies.length > 0 ? americaProxies : ["DIRECT"]
};
// 其他
const Others = {
name: "Others",
type: "url-test",
url: "http://www.gstatic.com/generate_204",
interval: 300,
tolerance: 20,
lazy: true,
proxies: othersProxies.length > 0 ? othersProxies : ["DIRECT"]
};
// 自动
const Auto = {
name: "Auto",
type: "url-test",
url: "http://www.gstatic.com/generate_204",
interval: 300,
tolerance: 20,
lazy: true,
proxies: allProxies.length > 0 ? allProxies : ["DIRECT"]
};
// 负载均衡
const Balance = {
name: "Balance",
type: "load-balance",
url: "http://www.gstatic.com/generate_204",
interval: 300,
strategy: "consistent-hashing",
lazy: true,
proxies: allProxies.length > 0 ? allProxies : ["DIRECT"]
};
// 故障转移
const Fallback = {
name: "Fallback",
type: "fallback",
url: "http://www.gstatic.com/generate_204",
interval: 300,
lazy: true,
proxies: allProxies.length > 0 ? allProxies : ["DIRECT"]
};


// 国外分组
const G = ["Proxy", "Auto", "Balance", "Fallback", "HongKong", "TaiWan", "Singapore", "Japan", "America", "Others"];
// 国内分组
const M = ["DIRECT", "Proxy", "Auto", "Balance", "Fallback", "HongKong", "TaiWan", "Singapore", "Japan", "America", "Others"];
// AI分组
const AI = ["Proxy", "America", "Japan", "Singapore", "TaiWan", "HongKong", "Others"];


// 漏网之鱼
const Final = { name: "Final", type: "select", proxies: ["DIRECT", "Global", "Proxy"] };
// 手动选择
const Proxy = { name: "Proxy", type: "select", proxies: allProxies.length > 0 ? allProxies : ["DIRECT"] };
// 国外网站
const Global = { name: "Global", type: "select", proxies: G };
// 国内网站
const Mainland = { name: "Mainland", type: "select", proxies: M };
// 人工智能
const ArtIntel = { name: "ArtIntel", type: "select", proxies: AI };
// 油管视频
const YouTube = { name: "YouTube", type: "select", proxies: G };
// 哔哩哔哩
const BiliBili = { name: "BiliBili", type: "select", proxies: ["DIRECT", "HongKong", "TaiWan"] };
// 国际媒体
const Streaming = { name: "Streaming", type: "select", proxies: G };
// 电报信息
const Telegram = { name: "Telegram", type: "select", proxies: G };
// 谷歌服务
const Google = { name: "Google", type: "select", proxies: G };
// 游戏平台
const Games = { name: "Games", type: "select", proxies: G };


const groups = params["proxy-groups"] = [];
// 规则
const rules = [
"AND,(AND,(DST-PORT,443),(NETWORK,UDP)),(NOT,((GEOIP,CN))),REJECT",// quic
// "GEOSITE,Category-ads-all,REJECT", // 可能导致某些网站无法访问
"GEOSITE,Private,DIRECT",
"GEOSITE,Category-games@cn,Mainland",
"GEOSITE,Microsoft@cn,Mainland",
"GEOSITE,Apple@cn,Mainland",
"GEOSITE,Bing,ArtIntel",
"GEOSITE,Openai,ArtIntel",
"GEOSITE,Category-games,Games",
"GEOSITE,Github,Global",
"GEOSITE,Telegram,Telegram",
"GEOSITE,Youtube,YouTube",
"GEOSITE,Disney,Streaming",
"GEOSITE,Netflix,Streaming",
"GEOSITE,HBO,Streaming",
"GEOSITE,Primevideo,Streaming",
"GEOSITE,Bilibili,BiliBili",
"GEOSITE,Google,Google",
"GEOSITE,Geolocation-!cn,Global",
"GEOIP,CN,Mainland,no-resolve",
"MATCH,Final"
];

// 插入分组
groups.unshift(HongKong, TaiWan, Japan, Singapore, America, Others, Auto, Balance, Fallback);
groups.unshift(Final, Proxy, Global, Mainland, ArtIntel, YouTube, BiliBili, Streaming, Telegram, Google, Games);
// 插入规则
params.rules = rules;

return params;
}

完整Rule-Provider配置

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
// https://mihomo.party/guides/function/override/js/
// DNS配置
const dnsConfig = {
"enable": true,
"listen": "0.0.0.0:1053",
"ipv6": true,
"enhanced-mode": "fake-ip",
"fake-ip-range": "198.18.0.1/16",
"fake-ip-filter":[
"*.lan",
"*.direct",
"*.localdomain",
"*.example",
"*.invalid",
"*.localhost",
"*.test",
"*.local",
"*.home.arpa",
"time.*.com",
"time.*.gov",
"time.*.edu.cn",
"time.*.apple.com",
"ntp.*.com",
"*.time.edu.cn",
"*.ntp.org.cn",
"+.pool.ntp.org",
"time1.cloud.tencent.com",
"*.cn",
"cable.auth.com",
"*.msftconnecttest.com",
"*.msftncsi.com",
"network-test.debian.org",
"detectportal.firefox.com",
"resolver1.opendns.com",
"*.srv.nintendo.net",
"*.stun.playstation.net",
"xbox.*.microsoft.com",
"*.xboxlive.com",
"stun.*",
"global.turn.twilio.com",
"global.stun.twilio.com",
"app.yinxiang.com",
"injections.adguard.org",
"local.adguard.org",
"cable.auth.com",
"localhost.*.qq.com",
"localhost.*.weixin.qq.com",
"*.logon.battlenet.com.cn",
"*.logon.battle.net",
"*.blzstatic.cn",
"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.qqmusic.qq.com",
"aqqmusic.tc.qq.com",
"amobile.music.tc.qq.com",
"*.xiami.com",
"*.music.migu.cn",
"music.migu.cn",
"proxy.golang.org",
"*.mcdn.bilivideo.cn",
"*.cmpassport.com",
"id6.me",
"open.e.189.cn",
"mdn.open.wo.cn",
"opencloud.wostore.cn",
"auth.wosms.cn",
"*.jegotrip.com.cn",
"*.icitymobile.mobi",
"*.pingan.com.cn",
"*.cmbchina.com",
"*.10099.com.cn",
"pool.ntp.org",
"*.pool.ntp.org",
"ntp.*.com",
"time.*.com",
"ntp?.*.com",
"time?.*.com",
"time.*.gov",
"time.*.edu.cn",
"*.ntp.org.cn",
"PDC._msDCS.*.*",
"DC._msDCS.*.*",
"GC._msDCS.*.*",
],
"nameserver": ["https://120.53.53.53/dns-query", "https://223.5.5.5/dns-query"],
"proxy-server-nameserver": ["https://120.53.53.53/dns-query", "https://223.5.5.5/dns-query"],
"nameserver-policy":{
"geosite:cn,private": ["https://120.53.53.53/dns-query", "https://223.5.5.5/dns-query"],
"geosite:gfw,geolocation-!cn": ["https://dns.cloudflare.com/dns-query", "https://dns.google/dns-query"]
}
};
// 规则集通用配置
const ruleProviderCommon = {
"type": "http",
"format": "yaml",
"interval": 86400
};
// 规则集配置
const ruleProviders = {
"unbreak": {
...ruleProviderCommon,
"behavior": "classical",
"url": "https://raw.githubusercontent.com/ddgksf2013/Filter/master/Unbreak.list",
"path": "./ruleset/unbreak.yaml"
},
"abema": {
...ruleProviderCommon,
"behavior": "classical",
"url": "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/Abema/Abema.yaml",
"path": "./ruleset/abema.yaml"
},
"niconico": {
...ruleProviderCommon,
"behavior": "classical",
"url": "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/Niconico/Niconico.yaml",
"path": "./ruleset/niconico.yaml"
},
"dmm": {
...ruleProviderCommon,
"behavior": "classical",
"url": "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/DMM/DMM.yaml",
"path": "./ruleset/dmm.yaml"
},
"pixiv": {
...ruleProviderCommon,
"behavior": "classical",
"url": "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/Pixiv/Pixiv.yaml",
"path": "./ruleset/pixiv.yaml"
},
"applemusic": {
...ruleProviderCommon,
"behavior": "classical",
"url": "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/AppleMusic/AppleMusic.yaml",
"path": "./ruleset/applemusic.yaml"
},
"apple": {
...ruleProviderCommon,
"behavior": "classical",
"url": "https://raw.githubusercontent.com/MetaCubeX/meta-rules-dat/meta/geo/geosite/classical/apple.yaml",
"path": "./ruleset/apple.yaml"
},
"twitter": {
...ruleProviderCommon,
"behavior": "classical",
"url": "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/Twitter/Twitter.yaml",
"path": "./ruleset/twitter.yaml"
},
"tiktok": {
...ruleProviderCommon,
"behavior": "classical",
"url": "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/TikTok/TikTok.yaml",
"path": "./ruleset/tiktok.yaml"
},
"category-porn": {
...ruleProviderCommon,
"behavior": "classical",
"url": "https://raw.githubusercontent.com/MetaCubeX/meta-rules-dat/meta/geo/geosite/classical/category-porn.yaml",
"path": "./ruleset/category-porn.yaml"
},
"ai": {
...ruleProviderCommon,
"behavior": "classical",
"url": "https://gitlab.com/lodepuly/vpn_tool/-/raw/master/Tool/Clash/Rule/AI.yaml",
"path": "./ruleset/AI.yaml"
},
"cnmicrosoft": {
...ruleProviderCommon,
"behavior": "classical",
"url": "https://raw.githubusercontent.com/MetaCubeX/meta-rules-dat/meta/geo/geosite/classical/microsoft%40cn.yaml",
"path": "./ruleset/cnmicrosoft.yaml"
},
"private": {
...ruleProviderCommon,
"behavior": "classical",
"url": "https://raw.githubusercontent.com/MetaCubeX/meta-rules-dat/meta/geo/geosite/classical/private.yaml",
"path": "./ruleset/private.yaml"
},
"category-game-accelerator-cn": {
...ruleProviderCommon,
"behavior": "classical",
"url": "https://raw.githubusercontent.com/MetaCubeX/meta-rules-dat/meta/geo/geosite/classical/category-game-accelerator-cn.yaml",
"path": "./ruleset/accelerator.yaml"
},
"steamcn": {
...ruleProviderCommon,
"behavior": "classical",
"url": "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/SteamCN/SteamCN.yaml",
"path": "./ruleset/steamcn.yaml"
},
"steam": {
...ruleProviderCommon,
"behavior": "classical",
"url": "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/Steam/Steam.yaml",
"path": "./ruleset/steam.yaml"
},
"proxylist": {
...ruleProviderCommon,
"behavior": "classical",
"url": "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/Proxy/Proxy_Classical.yaml",
"path": "./ruleset/proxy.yaml"
},
"telegram": {
...ruleProviderCommon,
"behavior": "classical",
"url": "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/Telegram/Telegram.yaml",
"path": "./ruleset/telegram.yaml"
},
"cn": {
...ruleProviderCommon,
"behavior": "classical",
"url": "https://raw.githubusercontent.com/MetaCubeX/meta-rules-dat/meta/geo/geosite/classical/cn.yaml",
"path": "./ruleset/cn.yaml",
},
"google": {
...ruleProviderCommon,
"behavior": "classical",
"url": "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/Google/Google.yaml",
"path": "./ruleset/google.yaml"
},
"youtube": {
...ruleProviderCommon,
"behavior": "classical",
"url": "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/YouTube/YouTube.yaml",
"path": "./ruleset/youtube.yaml"
},
"twitch": {
...ruleProviderCommon,
"behavior": "classical",
"url": "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/Twitch/Twitch.yaml",
"path": "./ruleset/twitch.yaml"
}
};
// 规则
const rules = [
// 屏蔽Adobe注册服务器
"DOMAIN-SUFFIX,adobe.io,广告屏蔽",
"DOMAIN-SUFFIX,adobestats.io,广告屏蔽",
"DOMAIN,prod.adobegenuine.com,广告屏蔽",
"DOMAIN,uf0onoepoe.adobestats.io,广告屏蔽",
// 自定义域名规则
"DOMAIN-SUFFIX,baomitu.com,国内直连", //360图片CDN-1
"DOMAIN-SUFFIX,qhimg.com,国内直连", //360图片CDN-2
"IP-CIDR,60.164.220.222/32,国内直连,no-resolve", //青海事业单位报名地址
"DOMAIN-SUFFIX,chinagwy.org,国内直连", //第三方机构公务员招考信息发布
"DOMAIN-SUFFIX,gov.cn,国内直连", //政府网站
"DOMAIN-SUFFIX,qhpta.com,国内直连", //青海人事信息网
"DOMAIN-SUFFIX,nomax.vip,国内直连", //诺玛信集团(公考报名后台)
"DOMAIN-SUFFIX,pc.wiki,国内直连", //老弟一号
"DOMAIN-KEYWORD,ggmedia,全球代理", //GGMedia相关网站
"DOMAIN-KEYWORD,monknow,国内直连", //Monknow新标签页
"DOMAIN-SUFFIX,winos.me,国内直连", //WinOS下系统
"DOMAIN-SUFFIX,xiuxitong.com,国内直连", //小修Windows
"DOMAIN-SUFFIX,wwentua.com,国内直连", // 蓝奏云的怪域名
"DOMAIN-SUFFIX,db.laomoe.com,全球代理", //流量消耗器
// Emby
"DOMAIN-SUFFIX,pilipiliultra.top,Emby媒体", //pilipili 德国服务器
"DOMAIN-SUFFIX,pilipiliultra.com,Emby媒体", //pilipili CF线路
"DOMAIN-SUFFIX,emby.wtf,Emby媒体", //终点站
"DOMAIN-SUFFIX,emby.aca.best,Emby媒体", //ACA机场服前端
"DOMAIN-SUFFIX,misakaf.org,Emby媒体", //MisakaF后端
"DOMAIN-SUFFIX,ii00.cc,Emby媒体", //PornEmby 国外线路
"DOMAIN-SUFFIX,bili.rip,Emby媒体", //HXDEMBY
"IP-CIDR,210.51.27.46/32,国内直连", //PornEmby 国内线路-1
"IP-CIDR,98.126.27.164/32,国内直连", //PornEmby 国内线路-2
"DOMAIN-SUFFIX,embyplus.org,Emby媒体", //纸片人Emby前端
"DOMAIN,gd.9521732.xyz,Emby媒体", //纸片人Emby后端
"DOMAIN-SUFFIX,histar.tv,Emby媒体", //星视界
// 部分游戏KEY网站直连
"DOMAIN-KEYWORD,greenmangaming,国内直连",
"DOMAIN-KEYWORD,gamersgate,国内直连",
// 幻兽帕鲁屏蔽正版验证,防止掉档
"DOMAIN-SUFFIX,palworldgame.com,广告屏蔽",
"DOMAIN-KEYWORD,pocketpair,广告屏蔽",
// 屏蔽腾讯遥测
"DOMAIN-SUFFIX,otheve.beacon.qq.com,广告屏蔽",
"DOMAIN-SUFFIX,tpstelemetry.tencent.com,广告屏蔽",
"DOMAIN-SUFFIX,h.trace.qq.com,广告屏蔽",
"DOMAIN-SUFFIX,report.gamecenter.qq.com,广告屏蔽",
// 老鹰讲AE
"DOMAIN-SUFFIX,aic4d.com,国内直连",
// 日本流媒体
"DOMAIN-SUFFIX,jp,日本媒体",
"DOMAIN-KEYWORD,asobistage,日本媒体",
"DOMAIN-KEYWORD,bandainamco,日本媒体",
"DOMAIN-SUFFIX,bangumi.tv,日本媒体",
"DOMAIN-SUFFIX,bgm.tv,日本媒体",
"DOMAIN-SUFFIX,bangumi.online,日本媒体",
"RULE-SET,abema,日本媒体",
"RULE-SET,niconico,日本媒体",
"RULE-SET,dmm,日本媒体",
"RULE-SET,pixiv,日本媒体",
"RULE-SET,applemusic,日本媒体",
"RULE-SET,twitter,日本媒体",
"RULE-SET,tiktok,日本媒体",
// 成人网站
"RULE-SET,category-porn,成人网站",
"DOMAIN-SUFFIX,18comic.vip,成人网站",
"DOMAIN-SUFFIX,jmcomic.me,成人网站",
"DOMAIN-SUFFIX,jm365.work,成人网站",
"DOMAIN-SUFFIX,loli.net,成人网站",
// AI应用
"RULE-SET,ai,AI应用",
"DOMAIN-SUFFIX,deepseek.com,国内直连",
"DOMAIN-SUFFIX,g4f.icu,AI应用",
"DOMAIN-SUFFIX,api.790093.xyz,AI应用",
// 国外代理集合
//"RULE-SET,cnmicrosoft,国内直连",
"RULE-SET,private,国内直连",
"RULE-SET,category-game-accelerator-cn,国内直连",
"RULE-SET,steamcn,国内直连",
"RULE-SET,apple,国内直连",
"RULE-SET,youtube,谷歌服务",
"RULE-SET,google,谷歌服务",
"RULE-SET,twitch,Twitch",
"RULE-SET,telegram,电报消息",
"RULE-SET,proxylist,全球代理",
"RULE-SET,steam,全球代理",
"RULE-SET,cn,国内直连",
// 其他规则
"GEOIP,LAN,国内直连,no-resolve",
"GEOIP,CN,国内直连,no-resolve",
"MATCH,全球代理"
];
// 代理组通用配置
const groupBaseOption = {
};

// 程序入口
function main(config) {
const proxyCount = config?.proxies?.length ?? 0;
const proxyProviderCount =
typeof config?.["proxy-providers"] === "object" ? Object.keys(config["proxy-providers"]).length : 0;
if (proxyCount === 0 && proxyProviderCount === 0) {
throw new Error("配置文件中未找到任何代理");
}

// 覆盖原配置中DNS配置
config["dns"] = dnsConfig;

// 覆盖原配置中的代理组
config["proxy-groups"] = [
{
...groupBaseOption,
"name": "全球代理",
"type": "select",
"include-all": true,
"icon": "https://gcore.jsdelivr.net/gh/Orz-3/mini/Color/Global.png"
},
{
...groupBaseOption,
"name": "谷歌服务",
"type": "select",
"filter": "香港|🇭🇰|HK|HongKong|Hong Kong|港|新加坡|SG|狮城|坡|Singapore|SGP|🇸🇬|美|美国|US|United States|America|🇺🇸|Los Angeles|San Jose|Phoenix|洛杉矶|圣何塞|凤凰城|斯巴达|UnitedStates",
"proxies": ["全球代理"],
"include-all": true,
"icon": "https://gcore.jsdelivr.net/gh/Orz-3/mini/Color/Google.png"
},
{
...groupBaseOption,
"name": "日本媒体",
"type": "select",
"filter": "日本|JP|Japan|Osaka|Tokyo|樱花|霓虹|xtom|🇯🇵",
"proxies": ["全球代理"],
"include-all": true,
"icon": "https://gcore.jsdelivr.net/gh/Orz-3/mini/Color/JP.png"
},
{
...groupBaseOption,
"name": "Twitch",
"type": "select",
"filter": "香港|🇭🇰|HK|HongKong|Hong Kong|港",
"proxies": ["全球代理"],
"include-all": true,
"icon": "https://gcore.jsdelivr.net/gh/Orz-3/mini/Alpha/Twich.png"
},
{
...groupBaseOption,
"name": "Emby媒体",
"type": "select",
"proxies": ["全球代理"],
"filter": "美|美国|US|United States|America|🇺🇸|Los Angeles|San Jose|Phoenix|洛杉矶|圣何塞|凤凰城|斯巴达|UnitedStates",
"include-all": true,
"icon": "https://gcore.jsdelivr.net/gh/Orz-3/mini/Color/Emby.png"
},
{
...groupBaseOption,
"name": "成人网站",
"type": "select",
"filter": "香港|🇭🇰|HK|HongKong|Hong Kong|港|新加坡|SG|狮城|坡|Singapore|SGP|🇸🇬",
"proxies": ["全球代理"],
"include-all": true,
"icon": "https://gcore.jsdelivr.net/gh/Orz-3/mini/Color/Pornhub.png"
},
{
...groupBaseOption,
"name": "电报消息",
"type": "select",
"filter": "新加坡|狮城|SG|Singapore|🇸🇬|Singapore|坡",
"proxies": ["全球代理"],
"include-all": true,
"icon": "https://gcore.jsdelivr.net/gh/Orz-3/mini/Color/Telegram.png"
},
{
...groupBaseOption,
"name": "AI应用",
"type": "select",
"include-all": true,
"filter": "日本|JP|Japan|Osaka|Tokyo|樱花|霓虹|xtom|🇯🇵|新加坡|SG|狮城|坡|Singapore|SGP|🇸🇬|美国|US|UnitedStates|United States|凤凰城|洛杉矶|圣何塞|San Jose|Los Angeles|Phoenix|🇺🇸|韩国|Korea|KR|🇰🇷",
"proxies": ["全球代理"],
"icon": "https://gcore.jsdelivr.net/gh/Orz-3/mini/Color/OpenAI.png"
},
{
...groupBaseOption,
"name": "苹果服务",
"type": "select",
"filter": "日本|JP|Japan|🇯🇵|Tokyo|Osaka|霓虹|小日子",
"proxies": ["国内直连", "全球代理"],
"include-all": true,
"icon": "https://gcore.jsdelivr.net/gh/Orz-3/mini/Color/Apple.png"
},
{
...groupBaseOption,
"name": "广告屏蔽",
"type": "select",
"proxies": ["REJECT"],
"icon": "https://gcore.jsdelivr.net/gh/Orz-3/mini/Color/Adblock.png"
},
{
...groupBaseOption,
"name": "国内直连",
"type": "select",
"proxies": ["DIRECT"],
"icon": "https://gcore.jsdelivr.net/gh/Orz-3/mini/Color/CN.png"
}
];

// 覆盖原配置中的规则
config["rule-providers"] = ruleProviders;
config["rules"] = rules;

// 返回修改后的配置
return config
}