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

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

写在前面

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

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

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

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
// 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;
}