forked from f3liiix/clash
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig.yaml
More file actions
291 lines (271 loc) · 8.48 KB
/
config.yaml
File metadata and controls
291 lines (271 loc) · 8.48 KB
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
# 全局配置
mixed-port: 7890 # HTTP(S) 和 SOCKS 代理混合端口
# redir-port: 7891 # 透明代理端口,用于 Linux 和 MacOS
# tproxy-port: 7892 # 透明代理端口,用于 Linux (TProxy TCP and TProxy UDP)
# port: 7893 # HTTP(S) 代理服务器端口
# socks-port: 7894 # SOCKS5 代理端口
allow-lan: true # 允许局域网连接
bind-address: "*" # 绑定 IP 地址,仅作用于 allow-lan 为 true 时,'*'表示所有地址
skip-auth-prefixes: # 设置跳过验证的 IP 段
- 127.0.0.1/8
- ::1/128
lan-allowed-ips: # 允许连接的 IP 地址段,仅作用于 allow-lan 为 true, 默认值为 0.0.0.0/0 和::/0
- 0.0.0.0/0
- ::/0
mode: rule # 'rule' 规则 / 'global' 全局 / 'direct' 直连
log-level: warning # 日志等级 silent/error/warning/info/debug
ipv6: false # IPv6 总开关,关闭阻断所有 IPv6 链接和屏蔽 DNS 请求 AAAA 记录
keep-alive-interval: 1800 #TCP Keep Alive 包的间隔,单位为秒
keep-alive-idle: 60 # TCP Keep Alive 的最大空闲时间
disable-keep-alive: false # 禁用 TCP Keep Alive
# 缓存
profile:
store-selected: true # 存储 select 选择记录
store-fake-ip: true # 持久化 fake-ip
unified-delay: true # 统一延迟,更换延迟计算方式,通过去除握手等额外开销来降低延迟数值
tcp-concurrent: true # TCP 并发,TCP 并发请求所有 IP 地址,然后选择延迟最低的一个进行连接
# GEOIP 数据模式
geodata-mode: true # 更改 geoip 使用文件,mmdb 或者 dat,可选 true/false,true为dat
geodata-loader: memconservative # GEO 文件加载模式
geo-auto-update: true # 是否自动更新 GEO
geo-update-interval: 720 # 更新间隔,单位:小时
# 自定义 GEO 下载地址
geox-url:
geoip: "https://cdn.jsdelivr.net/gh/Loyalsoldier/v2ray-rules-dat@release/geoip.dat"
geosite: "https://cdn.jsdelivr.net/gh/Loyalsoldier/v2ray-rules-dat@release/geosite.dat"
mmdb: "https://cdn.jsdelivr.net/gh/Loyalsoldier/geoip@release/Country.mmdb"
asn: "https://cdn.jsdelivr.net/gh/Loyalsoldier/geoip@release/GeoLite2-ASN.mmdb"
global-ua: clash.meta # 自定义外部资源下载时使用的的 UA
# TUN 配置
tun:
enable: true
stack: mixed
dns-hijack:
- "any:53"
- "tcp://any:53"
auto-route: true
auto-redirect: true
auto-detect-interface: true
strict-route: true
mtu: 9000
gso: true
# DNS 配置
dns:
enable: true
prefer-h3: false # 建议启用 HTTP/3,更快
listen: 0.0.0.0:53 # 开启 DNS 服务器监听
ipv6: false
respect-rules: true # 遵循规则
enhanced-mode: fake-ip # 使用fake-ip模式
behavior: strict
fake-ip-range: 198.18.0.1/16 # Fake IP 池设置
fake-ip-filter-mode: blacklist
default-nameserver:
- 223.5.5.5
- 119.29.29.29
# 主 DNS:国外流量使用的 DNS(走代理)
nameserver:
- https://dns.cloudflare.com/dns-query
- https://dns.google/dns-query
# DNS 策略:精确控制
nameserver-policy:
# 国内域名 → 国内DNS(保证速度)
"geosite:cn,private,apple":
- https://doh.pub/dns-query
- https://dns.alidns.com/dns-query
# .cn 后缀域名
"+.cn":
- https://doh.pub/dns-query
- https://dns.alidns.com/dns-query
# 国外域名 → 国外DNS(防泄露)
"geosite:geolocation-!cn":
- https://dns.cloudflare.com/dns-query
- https://dns.google/dns-query
# 代理服务器域名解析(必须直连)
proxy-server-nameserver:
- https://doh.pub/dns-query
- https://dns.alidns.com/dns-query
- 223.5.5.5
- 119.29.29.29
# 配置不使用 fake-ip 的域名
fake-ip-filter:
- "*.lan"
- "*.local"
- "*.localdomain"
- localhost.ptlogin2.qq.com
- "+.stun.*.*"
- "+.stun.*.*.*"
- "+.stun.*.*.*.*"
- "stun.*.*"
- "stun.*.*.*"
- "+.msftconnecttest.com"
- "+.msftncsi.com"
- time.*.com
- ntp.*.com
- geosite:private
- geosite:cn
- "+.fun.ss"
- "+.qq.com"
- "+.wechat.com"
- "+.weixin.qq.com"
- "+.qpic.cn"
- "+.qlogo.cn"
- "+.servicewechat.com"
- "+.tenpay.com"
- "+.wxpay.wxutil.com"
- "+.oss.hk"
# 嗅探配置
sniffer:
enable: true
sniff:
HTTP:
ports: [80, 8080-8880]
override-destination: true
TLS:
ports: [443, 8443]
QUIC:
ports: [443, 8443]
skip-domain:
- "+.push.apple.com"
- "+.qq.com"
- "+.wechat.com"
- "+.qpic.cn"
# 策略组引用
Pro:
&a1 {
type: http,
interval: 28800,
health-check:
{
enable: true,
url: "https://www.google.com/generate_204",
interval: 1800,
},
lazy: true,
override: { skip-cert-verify: true, udp: true },
}
manual: &a2 { type: select, use: [Subscribe] }
proxy-providers:
Subscribe:
<<: *a1
url: $suburl
path: ./SelfHost.yaml
proxy-groups:
# 默认
- {
name: 默认,
<<: *a2,
exclude-filter: "公司|公司网络|公司内网",
icon: "https://img.hoofei.com/clash/icons/Manual.png",
}
# 地区
- {
name: 香港,
<<: *a2,
filter: "香港|HK|hk|(?i)Hong",
icon: "https://img.hoofei.com/clash/icons/HK.png",
}
# - {name: 台湾, <<: *a2, filter: "台湾|TW|tw", icon: "https://img.hoofei.com/clash/icons/TW.png"}
- {
name: 日本,
<<: *a2,
filter: "日本|JP|jp|东京|大阪|Tokyo|Osaka",
icon: "https://img.hoofei.com/clash/icons/JP.png",
}
- {
name: 新加坡,
<<: *a2,
filter: "新加坡|SG|sg|新加坡|Singapore",
icon: "https://img.hoofei.com/clash/icons/SG.png",
}
- {
name: 美国,
<<: *a2,
filter: "美国|美西|美东|洛杉矶|US|us|(?i)States|American",
icon: "https://img.hoofei.com/clash/icons/US.png",
}
- {
name: 家宽,
<<: *a2,
filter: "家宽|住宅|(?i)ISP|isp|AT&T|Verizon|Spectrum|CenturyLink|Comcast|Xfinity|Sprint|T-Mobile|HKT|HGC|HKBN|CMHK|Hinet|Softbank|KDDI|Singtel|M1|Starhub",
icon: "https://img.hoofei.com/clash/icons/ISP.png",
}
- {
name: Claude,
<<: *a2,
filter: "家宽|住宅|(?i)ISP|isp|AT&T|Verizon|Spectrum|CenturyLink|Comcast|Xfinity|Sprint|T-Mobile|HKT|HGC|HKBN|CMHK|Hinet|Softbank|KDDI|Singtel|M1|Starhub",
icon: "https://img.hoofei.com/clash/icons/Claude.png",
}
- {
name: 公司,
type: url-test,
use: [Subscribe],
filter: "公司|公司网络|公司内网|公司网络内网|公司网络外网|公司内网外网|公司网络内网外网",
url: "https://connect.rom.miui.com/generate_204",
interval: 300,
icon: "https://img.hoofei.com/clash/icons/CN.png",
}
rule-providers:
custom-direct:
type: http
behavior: classical
url: "https://raw.githubusercontent.com/f3liiix/clash/main/rules/custom-direct.yaml"
path: ./rules/custom-direct.yaml
interval: 86400
custom-us:
type: http
behavior: classical
url: "https://raw.githubusercontent.com/f3liiix/clash/main/rules/custom-us.yaml"
path: ./rules/custom-us.yaml
interval: 86400
custom-claude:
type: http
behavior: classical
url: "https://raw.githubusercontent.com/f3liiix/clash/main/rules/custom-claude.yaml"
path: ./rules/custom-claude.yaml
interval: 86400
custom-proxy:
type: http
behavior: classical
url: "https://raw.githubusercontent.com/f3liiix/clash/main/rules/custom-proxy.yaml"
path: ./rules/custom-proxy.yaml
interval: 86400
rules:
# DNS 查询规则(优先级最高)
- DOMAIN-SUFFIX,doh.pub,DIRECT
- DOMAIN-SUFFIX,alidns.com,DIRECT
- DOMAIN-SUFFIX,cloudflare.com,默认
- DOMAIN,dns.google,默认
- IP-CIDR,1.1.1.1/32,默认,no-resolve
- IP-CIDR,1.0.0.1/32,默认,no-resolve
- IP-CIDR,8.8.8.8/32,默认,no-resolve
- IP-CIDR,8.8.4.4/32,默认,no-resolve
- IP-CIDR,223.5.5.5/32,DIRECT,no-resolve
- IP-CIDR,223.6.6.6/32,DIRECT,no-resolve
- IP-CIDR,119.29.29.29/32,DIRECT,no-resolve
# 私有网络
- GEOIP,PRIVATE,DIRECT,no-resolve
# 自定义分流规则
- RULE-SET,custom-claude,Claude
- RULE-SET,custom-direct,DIRECT
- RULE-SET,custom-us,美国
- RULE-SET,custom-proxy,默认
# 分流规则
- DOMAIN-SUFFIX,google,美国
- GEOSITE,google,美国
- GEOSITE,category-ai-!cn,家宽
- GEOSITE,category-cryptocurrency,美国
- GEOSITE,tiktok,家宽
- GEOSITE,netflix,家宽
- GEOIP,netflix,家宽
- GEOSITE,disney,家宽
- GEOSITE,youtube,香港
- GEOSITE,telegram,美国
- GEOIP,telegram,美国
- GEOSITE,whatsapp,美国
- GEOSITE,paypal,美国
- GEOSITE,reddit,美国
- GEOSITE,steam,DIRECT
- GEOSITE,CN,DIRECT
- GEOIP,CN,DIRECT,no-resolve
- MATCH,默认