forked from KarlZeo/Surge_rules
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathextrarules.yaml
401 lines (392 loc) · 11.8 KB
/
extrarules.yaml
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
rules:
- RULE-SET,Reject,AdBlock
- RULE-SET,Special,DIRECT
- RULE-SET,Netflix,Netflix
- RULE-SET,Spotify,Spotify
- RULE-SET,YouTube,YouTube
- RULE-SET,Bilibili,AsianTV
- RULE-SET,iQiyi,AsianTV
- RULE-SET,Letv,AsianTV
- RULE-SET,Netease Music,AsianTV
- RULE-SET,Tencent Video,AsianTV
- RULE-SET,Youku,AsianTV
- RULE-SET,ABC,GlobalTV
- RULE-SET,Abema TV,GlobalTV
- RULE-SET,Amazon,GlobalTV
- RULE-SET,Apple News,GlobalTV
- RULE-SET,Apple TV,GlobalTV
- RULE-SET,Bahamut,GlobalTV
- RULE-SET,BBC iPlayer,GlobalTV
- RULE-SET,DAZN,GlobalTV
- RULE-SET,Disney Plus,GlobalTV
- RULE-SET,encoreTVB,GlobalTV
- RULE-SET,Fox Now,GlobalTV
- RULE-SET,Fox+,GlobalTV
- RULE-SET,HBO,GlobalTV
- RULE-SET,Hulu Japan,GlobalTV
- RULE-SET,Hulu,GlobalTV
- RULE-SET,Japonx,GlobalTV
- RULE-SET,JOOX,GlobalTV
- RULE-SET,KKBOX,GlobalTV
- RULE-SET,KKTV,GlobalTV
- RULE-SET,Line TV,GlobalTV
- RULE-SET,myTV SUPER,GlobalTV
- RULE-SET,Pandora,GlobalTV
- RULE-SET,PBS,GlobalTV
- RULE-SET,Pornhub,GlobalTV
- RULE-SET,Soundcloud,GlobalTV
- RULE-SET,ViuTV,GlobalTV
- RULE-SET,Telegram,Telegram
- RULE-SET,Steam,Steam
- RULE-SET,Speedtest,Speedtest
- RULE-SET,PayPal,PayPal
- RULE-SET,Microsoft,Microsoft
- RULE-SET,PROXY,Proxy
- RULE-SET,Apple,Apple
- RULE-SET,Domestic,Domestic
- RULE-SET,Domestic IPs,Domestic
- GEOIP,CN,Domestic
- MATCH,Others
script:
code: |
def main(ctx, metadata):
port_list = [21, 22, 23, 53, 80, 123, 143, 194, 443, 465, 587, 853, 993, 995, 998, 2052, 2053, 2082, 2083, 2086, 2095, 2096, 5222, 5228, 5229, 5230, 8080, 8443, 8880, 8888, 8889]
ruleset_action = {"Reject": "AdBlock",
"Special": "DIRECT",
"Netflix": "Netflix",
"Spotify": "Spotify",
"YouTube": "YouTube",
"Bilibili": "AsianTV",
"iQiyi": "AsianTV",
"Letv": "AsianTV",
"Netease Music": "AsianTV",
"Tencent Video": "AsianTV",
"Youku": "AsianTV",
"ABC": "GlobalTV",
"Abema TV": "GlobalTV",
"Amazon": "GlobalTV",
"Apple News": "GlobalTV",
"Apple TV": "GlobalTV",
"Bahamut": "GlobalTV",
"BBC iPlayer": "GlobalTV",
"DAZN": "GlobalTV",
"Disney Plus": "GlobalTV",
"encoreTVB": "GlobalTV",
"Fox Now": "GlobalTV",
"Fox+": "GlobalTV",
"HBO": "GlobalTV",
"Hulu Japan": "GlobalTV",
"Hulu": "GlobalTV",
"Japonx": "GlobalTV",
"JOOX": "GlobalTV",
"KKBOX": "GlobalTV",
"KKTV": "GlobalTV",
"Line TV": "GlobalTV",
"myTV SUPER": "GlobalTV",
"Pandora": "GlobalTV",
"PBS": "GlobalTV",
"Pornhub": "GlobalTV",
"Soundcloud": "GlobalTV",
"ViuTV": "GlobalTV",
"Telegram": "Telegram",
"Steam": "Steam",
"Speedtest": "Speedtest",
"PayPal": "PayPal",
"Microsoft": "Microsoft",
"PROXY": "Proxy",
"Apple": "Apple",
"Domestic": "Domestic",
"Domestic IPs": "Domestic"
}
port = int(metadata["dst_port"])
if port not in port_list:
return "DIRECT"
for rule_name in ctx.rule_providers.keys():
if ctx.rule_providers[rule_name].match(metadata):
return ruleset_action[rule_name]
ip = metadata["dst_ip"] or ctx.resolve_ip(metadata["host"])
if ip == "":
return "DIRECT"
code = ctx.geoip(ip)
if code == "LAN":
return "DIRECT"
if code == "CN":
return "Domestic"
return "Others"
rule-providers:
Reject:
type: http
behavior: classical
url: https://git.dler.io/lhie1/Rules/master/Clash/Provider/Reject.yaml
path: ./Rules/Reject
interval: 86400
Special:
type: http
behavior: classical
url: https://git.dler.io/lhie1/Rules/master/Clash/Provider/Special.yaml
path: ./Rules/Special
interval: 86400
Netflix:
type: http
behavior: classical
url: https://git.dler.io/lhie1/Rules/master/Clash/Provider/Media/Netflix.yaml
path: ./Rules/Media/Netflix
interval: 86400
Spotify:
type: http
behavior: classical
url: https://git.dler.io/lhie1/Rules/master/Clash/Provider/Media/Spotify.yaml
path: ./Rules/Media/Spotify
interval: 86400
YouTube:
type: http
behavior: classical
url: https://git.dler.io/lhie1/Rules/master/Clash/Provider/Media/YouTube.yaml
path: ./Rules/Media/YouTube
interval: 86400
Bilibili:
type: http
behavior: classical
url: https://git.dler.io/lhie1/Rules/master/Clash/Provider/Media/Bilibili.yaml
path: ./Rules/Media/Bilibili
interval: 86400
iQiyi:
type: http
behavior: classical
url: https://git.dler.io/lhie1/Rules/master/Clash/Provider/Media/iQiyi.yaml
path: ./Rules/Media/iQiyi
interval: 86400
Letv:
type: http
behavior: classical
url: https://git.dler.io/lhie1/Rules/master/Clash/Provider/Media/Letv.yaml
path: ./Rules/Media/Letv
interval: 86400
Netease Music:
type: http
behavior: classical
url: https://git.dler.io/lhie1/Rules/master/Clash/Provider/Media/Netease%20Music.yaml
path: ./Rules/Media/Netease_Music
interval: 86400
Tencent Video:
type: http
behavior: classical
url: https://git.dler.io/lhie1/Rules/master/Clash/Provider/Media/Tencent%20Video.yaml
path: ./Rules/Media/Tencent_Video
interval: 86400
Youku:
type: http
behavior: classical
url: https://git.dler.io/lhie1/Rules/master/Clash/Provider/Media/Youku.yaml
path: ./Rules/Media/Youku
interval: 86400
ABC:
type: http
behavior: classical
url: https://git.dler.io/lhie1/Rules/master/Clash/Provider/Media/ABC.yaml
path: ./Rules/Media/ABC
interval: 86400
Abema TV:
type: http
behavior: classical
url: https://git.dler.io/lhie1/Rules/master/Clash/Provider/Media/Abema%20TV.yaml
path: ./Rules/Media/Abema_TV
interval: 86400
Amazon:
type: http
behavior: classical
url: https://git.dler.io/lhie1/Rules/master/Clash/Provider/Media/Amazon.yaml
path: ./Rules/Media/Amazon
interval: 86400
Apple News:
type: http
behavior: classical
url: https://git.dler.io/lhie1/Rules/master/Clash/Provider/Media/Apple%20News.yaml
path: ./Rules/Media/Apple_News
interval: 86400
Apple TV:
type: http
behavior: classical
url: https://git.dler.io/lhie1/Rules/master/Clash/Provider/Media/Apple%20TV.yaml
path: ./Rules/Media/Apple_TV
interval: 86400
Bahamut:
type: http
behavior: classical
url: https://git.dler.io/lhie1/Rules/master/Clash/Provider/Media/Bahamut.yaml
path: ./Rules/Media/Bahamut
interval: 86400
BBC iPlayer:
type: http
behavior: classical
url: https://git.dler.io/lhie1/Rules/master/Clash/Provider/Media/BBC%20iPlayer.yaml
path: ./Rules/Media/BBC_iPlayer
interval: 86400
DAZN:
type: http
behavior: classical
url: https://git.dler.io/lhie1/Rules/master/Clash/Provider/Media/DAZN.yaml
path: ./Rules/Media/DAZN
interval: 86400
Disney Plus:
type: http
behavior: classical
url: https://git.dler.io/lhie1/Rules/master/Clash/Provider/Media/Disney%20Plus.yaml
path: ./Rules/Media/Disney_Plus
interval: 86400
encoreTVB:
type: http
behavior: classical
url: https://git.dler.io/lhie1/Rules/master/Clash/Provider/Media/encoreTVB.yaml
path: ./Rules/Media/encoreTVB
interval: 86400
Fox Now:
type: http
behavior: classical
url: https://git.dler.io/lhie1/Rules/master/Clash/Provider/Media/Fox%20Now.yaml
path: ./Rules/Media/Fox_Now
interval: 86400
Fox+:
type: http
behavior: classical
url: https://git.dler.io/lhie1/Rules/master/Clash/Provider/Media/Fox%2B.yaml
path: ./Rules/Media/Fox+
interval: 86400
HBO:
type: http
behavior: classical
url: https://git.dler.io/lhie1/Rules/master/Clash/Provider/Media/HBO.yaml
path: ./Rules/Media/HBO
interval: 86400
Hulu Japan:
type: http
behavior: classical
url: https://git.dler.io/lhie1/Rules/master/Clash/Provider/Media/Hulu%20Japan.yaml
path: ./Rules/Media/Hulu_Japan
interval: 86400
Hulu:
type: http
behavior: classical
url: https://git.dler.io/lhie1/Rules/master/Clash/Provider/Media/Hulu.yaml
path: ./Rules/Media/Hulu
interval: 86400
Japonx:
type: http
behavior: classical
url: https://git.dler.io/lhie1/Rules/master/Clash/Provider/Media/Japonx.yaml
path: ./Rules/Media/Japonx
interval: 86400
JOOX:
type: http
behavior: classical
url: https://git.dler.io/lhie1/Rules/master/Clash/Provider/Media/JOOX.yaml
path: ./Rules/Media/JOOX
interval: 86400
KKBOX:
type: http
behavior: classical
url: https://git.dler.io/lhie1/Rules/master/Clash/Provider/Media/KKBOX.yaml
path: ./Rules/Media/KKBOX
interval: 86400
KKTV:
type: http
behavior: classical
url: https://git.dler.io/lhie1/Rules/master/Clash/Provider/Media/KKTV.yaml
path: ./Rules/Media/KKTV
interval: 86400
Line TV:
type: http
behavior: classical
url: https://git.dler.io/lhie1/Rules/master/Clash/Provider/Media/Line%20TV.yaml
path: ./Rules/Media/Line_TV
interval: 86400
myTV SUPER:
type: http
behavior: classical
url: https://git.dler.io/lhie1/Rules/master/Clash/Provider/Media/myTV%20SUPER.yaml
path: ./Rules/Media/myTV_SUPER
interval: 86400
Pandora:
type: http
behavior: classical
url: https://git.dler.io/lhie1/Rules/master/Clash/Provider/Media/Pandora.yaml
path: ./Rules/Media/Pandora
interval: 86400
PBS:
type: http
behavior: classical
url: https://git.dler.io/lhie1/Rules/master/Clash/Provider/Media/PBS.yaml
path: ./Rules/Media/PBS
interval: 86400
Pornhub:
type: http
behavior: classical
url: https://git.dler.io/lhie1/Rules/master/Clash/Provider/Media/Pornhub.yaml
path: ./Rules/Media/Pornhub
interval: 86400
Soundcloud:
type: http
behavior: classical
url: https://git.dler.io/lhie1/Rules/master/Clash/Provider/Media/Soundcloud.yaml
path: ./Rules/Media/Soundcloud
interval: 86400
ViuTV:
type: http
behavior: classical
url: https://git.dler.io/lhie1/Rules/master/Clash/Provider/Media/ViuTV.yaml
path: ./Rules/Media/ViuTV
interval: 86400
Telegram:
type: http
behavior: classical
url: https://git.dler.io/lhie1/Rules/master/Clash/Provider/Telegram.yaml
path: ./Rules/Telegram
interval: 86400
Steam:
type: http
behavior: classical
url: https://git.dler.io/lhie1/Rules/master/Clash/Provider/Steam.yaml
path: ./Rules/Steam
interval: 86400
Speedtest:
type: http
behavior: classical
url: https://git.dler.io/lhie1/Rules/master/Clash/Provider/Speedtest.yaml
path: ./Rules/Speedtest
interval: 86400
PayPal:
type: http
behavior: classical
url: https://git.dler.io/lhie1/Rules/master/Clash/Provider/PayPal.yaml
path: ./Rules/PayPal
interval: 86400
Microsoft:
type: http
behavior: classical
url: https://git.dler.io/lhie1/Rules/master/Clash/Provider/Microsoft.yaml
path: ./Rules/Microsoft
interval: 86400
PROXY:
type: http
behavior: classical
url: https://git.dler.io/lhie1/Rules/master/Clash/Provider/Proxy.yaml
path: ./Rules/Proxy
interval: 86400
Domestic:
type: http
behavior: classical
url: https://git.dler.io/lhie1/Rules/master/Clash/Provider/Domestic.yaml
path: ./Rules/Domestic
interval: 86400
Apple:
type: http
behavior: classical
url: https://git.dler.io/lhie1/Rules/master/Clash/Provider/Apple.yaml
path: ./Rules/Apple
interval: 86400
Domestic IPs:
type: http
behavior: ipcidr
url: https://git.dler.io/lhie1/Rules/master/Clash/Provider/Domestic%20IPs.yaml
path: ./Rules/Domestic_IPs
interval: 86400