whistle.easy-proxy 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,668 @@
1
+ /**
2
+ * 默认拦截规则配置
3
+ *
4
+ * 结构: { hostPattern: { pathPattern: { action1: value1, ... } } }
5
+ *
6
+ * 支持的 host 匹配方式:
7
+ * - 精确匹配: "github.com"
8
+ * - 通配符: "*.githubusercontent.com" / "*steamcommunity.com"
9
+ * - 正则表达式: "^.*\\.google\\.com(\\.\\w+)?$"
10
+ *
11
+ * 支持的 path 匹配方式:
12
+ * - 全匹配: "*" 或 ".*"
13
+ * - 精确路径: "/fluidicon.png"
14
+ * - 正则表达式: "^(/[^/]+){2,}/?(\\?.*)?$"
15
+ *
16
+ * 支持的动作 (action):
17
+ * sni — SNI 改写值 (如 "baidu.com";"none" 表示不改写)
18
+ * proxy — 代理到的目标主机
19
+ * backup — 备用代理主机列表
20
+ * proxy_backup — 备用代理 (支持 ${capture} 模板变量)
21
+ * cacheDays — 缓存天数
22
+ * responseReplace — 响应替换 { headers: {...}, doDownload: true }
23
+ * requestReplace — 请求替换 { headers: {...}, doDownload: true }
24
+ * success — 直接返回成功 (true 或 { script: "..." })
25
+ * abort — 中断请求 (true/false)
26
+ * redirect — 重定向 URL
27
+ * status — HTTP 状态码
28
+ * tampermonkeyScript — 油猴脚本注入 URL
29
+ * script — 脚本注入 URL
30
+ * options — 标记 OPTIONS 请求
31
+ * desc — 描述 (仅文档用途)
32
+ * remark — 备注 (仅文档用途)
33
+ * test — 测试 URL (仅文档用途)
34
+ */
35
+
36
+ module.exports = {
37
+ // ===== GitHub =====
38
+ 'github.com': {
39
+ '^(/[^/]+){2,}/?(\\?.*)?$': {
40
+ tampermonkeyScript:
41
+ 'https://raw.giteeusercontent.com/wangliang181230/dev-sidecar-config/raw/main/tampermonkey.js',
42
+ script:
43
+ 'https://raw.giteeusercontent.com/wangliang181230/dev-sidecar-config/raw/main/GithubEnhanced-High-Speed-Download.user.js',
44
+ remark: '注:上面所使用的脚本地址,为高速镜像地址。',
45
+ desc: '油猴脚本:高速下载 Git Clone/SSH、Release、Raw、Code(ZIP) 等文件 (公益加速)、项目列表单文件快捷下载、添加 git clone 命令',
46
+ },
47
+ '^((/[^/]+){2,})/raw((/[^/]+)+\\.(jpg|jpeg|png|gif))(\\?.*)?$': {
48
+ cacheDays: 365,
49
+ desc: '仓库内图片重定向,缓存1年。',
50
+ },
51
+ '^((/[^/]+){2,})/raw((/[^/]+)+\\.js)(\\?.*)?$': {
52
+ responseReplace: {
53
+ headers: {
54
+ 'content-type': 'application/javascript; charset=utf-8',
55
+ },
56
+ },
57
+ desc: '仓库内脚本,设置响应头Content-Type。作用:方便script拦截器直接使用,避免引起跨域问题和脚本内容限制问题。',
58
+ },
59
+ '.*': {
60
+ sni: 'baidu.com',
61
+ },
62
+ '/fluidicon.png': {
63
+ cacheDays: 365,
64
+ desc: 'Github那只猫的图片,缓存1年',
65
+ },
66
+ '^(/[^/]+){2}/pull/\\d+/open_with_menu.*$': {
67
+ cacheDays: 7,
68
+ desc: 'PR详情页:标题右边那个Code按钮的HTML代码请求地址,感觉上应该可以缓存。暂时先设置为缓存7天',
69
+ },
70
+ },
71
+
72
+ 'api.github.com': {
73
+ '.*': {
74
+ sni: 'baidu.com',
75
+ },
76
+ '^/_private/browser/stats$': {
77
+ success: true,
78
+ desc: 'github的访问速度分析上传,没有必要,直接返回成功',
79
+ },
80
+ },
81
+
82
+ 'github.githubassets.com': {
83
+ '/assets/fakefile.js': {
84
+ success: {
85
+ script: ';',
86
+ },
87
+ cacheDays: 365,
88
+ },
89
+ '^(/[^/]+)*/[^./]+\\.(svg|png|gif|jpg|jpeg|ico|js|css)(\\?.*)?$': {
90
+ cacheDays: 365,
91
+ desc: '图片、JS文件、CSS文件,缓存1年',
92
+ },
93
+ '.*.backup': {
94
+ desc: 'github.com域名下,该请求已经不存在,此配置暂时先备份掉。',
95
+ proxy: 'github.com',
96
+ sni: 'baidu.com',
97
+ responseReplace: {
98
+ headers: {
99
+ 'access-control-allow-origin': '*',
100
+ 'cross-origin-resource-policy': 'cross-origin',
101
+ 'set-cookie': '[remove]',
102
+ },
103
+ },
104
+ },
105
+ '.*': {
106
+ sni: 'baidu.com',
107
+ },
108
+ },
109
+
110
+ 'opengraph.githubassets.com': {
111
+ '^/(([^/]+/){3}issues/\\d+)?(\\?.*)?$': {
112
+ cacheDays: 365,
113
+ },
114
+ '.*': {
115
+ sni: 'baidu.com',
116
+ },
117
+ },
118
+
119
+ '*.githubusercontent.com': {
120
+ '.*': {
121
+ sni: 'baidu.com',
122
+ requestReplace: {
123
+ headers: {
124
+ 'accept-language': 'en-US,en;q=0.8',
125
+ },
126
+ },
127
+ },
128
+ },
129
+
130
+ 'collector.github.com': {
131
+ '/github/collect': {
132
+ success: true,
133
+ status: 204,
134
+ desc: '采集数据,快速成功',
135
+ },
136
+ '.*': {
137
+ sni: 'baidu.com',
138
+ },
139
+ },
140
+
141
+ 'gist.github.com': {
142
+ '.*': {
143
+ sni: 'baidu.com',
144
+ },
145
+ },
146
+
147
+ '*.github.io': {
148
+ '.*': {
149
+ sni: 'baidu.com',
150
+ },
151
+ },
152
+
153
+ '*.gravatar.com': {
154
+ '.*': {
155
+ sni: 'baidu.com',
156
+ },
157
+ },
158
+
159
+ '*.windows.net': {
160
+ '.*': {
161
+ sni: 'baidu.com',
162
+ },
163
+ },
164
+
165
+ // ===== Google Fonts =====
166
+ 'fonts.googleapis.com': {
167
+ '.*': {
168
+ proxy: 'fonts.googleapis.cn',
169
+ backup: ['gstatic.loli.net', 'fonts-gstatic.proxy.ustclug.org'],
170
+ test: 'https://fonts.googleapis.com/css?family=Oswald',
171
+ },
172
+ },
173
+
174
+ 'fonts.gstatic.com': {
175
+ '.*': {
176
+ proxy: 'fonts.gstatic.cn',
177
+ backup: ['gstatic.loli.net', 'fonts-gstatic.proxy.ustclug.org'],
178
+ test: 'https://fonts.gstatic.com/s/pacifico/v12/FwZY7-Qmy14u9lezJ-6H6MmBp0u-.woff2',
179
+ },
180
+ },
181
+
182
+ '*.googleapis.com': {
183
+ '.*': {
184
+ sni: 'www.google.cn',
185
+ },
186
+ },
187
+
188
+ 'ajax.googleapis.com': {
189
+ '.*': {
190
+ proxy: 'ajax.proxy.ustclug.org',
191
+ desc: '根据2026年4月24日时访问https://mirrors.ustc.edu.cn 的说明,修正internal v202604122348中指向ajax.lug.ustc.edu.cn的配置',
192
+ backup: ['gapis.geekzu.org'],
193
+ test: 'ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js',
194
+ },
195
+ },
196
+
197
+ 'kubernetes-charts.storage.googleapis.com': {
198
+ '.*': {
199
+ proxy: 'kubernetes-charts.proxy.ustclug.org',
200
+ },
201
+ },
202
+
203
+ '^(?!.*(translate-pa).google(?:apis|usercontent)?.com).*google(?:apis|usercontent)?.com$': {
204
+ '.*': {
205
+ sni: 'www.google.cn',
206
+ desc: '部分需要走其它代理的服务',
207
+ },
208
+ },
209
+
210
+ // ===== Google 系 =====
211
+ '^.*\\.(youtube\\.com|gstatic\\.com|youtube\\.nocookie\\.com|youtu\\.be|ggpht\\.com|i\\.ytimg\\.com|blogger\\.com|doodles\\.google|about\\.google|android\\.com)$':
212
+ {
213
+ '.*': {
214
+ sni: 'baidu.com',
215
+ },
216
+ },
217
+
218
+ '^.*\\.google\\.com(\\.\\w+)?$': {
219
+ '.*': {
220
+ sni: 'www.google.cn',
221
+ },
222
+ },
223
+
224
+ '^(?<pre>.*).googlevideo.com$': {
225
+ '*': {
226
+ proxy_backup: '${pre}.gvt1.com',
227
+ sni: 'g.cn',
228
+ options: true,
229
+ },
230
+ '/generate_204': {
231
+ success: true,
232
+ },
233
+ },
234
+
235
+ 'www.gstatic.com': {
236
+ '/recaptcha/.*': {
237
+ proxy: 'www.recaptcha.net',
238
+ },
239
+ },
240
+
241
+ 'www.google.com': {
242
+ '/recaptcha/.*': {
243
+ proxy: 'www.recaptcha.net',
244
+ },
245
+ },
246
+
247
+ 'themes.googleapis.com': {
248
+ '.*': {
249
+ proxy: 'themes.loli.net',
250
+ backup: ['themes.proxy.ustclug.org'],
251
+ },
252
+ },
253
+
254
+ 'themes.googleusercontent.com': {
255
+ '.*': {
256
+ proxy: 'google-themes.proxy.ustclug.org',
257
+ },
258
+ },
259
+
260
+ 'clients*.google.com': {
261
+ '.*': {
262
+ abort: false,
263
+ desc: '设置abort:true可以快速失败,节省时间',
264
+ },
265
+ },
266
+
267
+ 'www.googleapis.com': {
268
+ '.*': {
269
+ abort: false,
270
+ desc: '设置abort:true可以快速失败,节省时间',
271
+ },
272
+ },
273
+
274
+ 'lh*.googleusercontent.com': {
275
+ '.*': {
276
+ abort: false,
277
+ desc: '设置abort:true可以快速失败,节省时间',
278
+ },
279
+ },
280
+
281
+ // ===== Microsoft / Docker =====
282
+ 'ms-sso.copilot.microsoft.com': {
283
+ '.*': {
284
+ sni: 'microsoft.com',
285
+ },
286
+ },
287
+
288
+ 'www.docker.com': {
289
+ '.*': {
290
+ sni: 'www.docker.com',
291
+ },
292
+ },
293
+
294
+ 'login.docker.com': {
295
+ '.*': {
296
+ sni: 'login.docker.com',
297
+ },
298
+ '/favicon.ico': {
299
+ proxy: 'hub.docker.com',
300
+ sni: 'baidu.com',
301
+ desc: '登录页面的ico,采用hub.docker.com的',
302
+ },
303
+ },
304
+
305
+ 'download.docker.com': {
306
+ '.*': {
307
+ sni: 'download.docker.com',
308
+ },
309
+ },
310
+
311
+ 'hub.docker.com': {
312
+ '.*': {
313
+ sni: 'none',
314
+ },
315
+ },
316
+
317
+ '*.docker.com': {
318
+ '.*': {
319
+ sni: 'www.docker.com',
320
+ },
321
+ },
322
+
323
+ // ===== Pixiv =====
324
+ '*.pixiv.net': {
325
+ '.*': {
326
+ sni: 'baidu.com',
327
+ },
328
+ },
329
+
330
+ '*.pixiv.org': {
331
+ '.*': {
332
+ sni: 'baidu.com',
333
+ },
334
+ },
335
+
336
+ '*.pximg.net': {
337
+ '.*': {
338
+ sni: 'baidu.com',
339
+ },
340
+ },
341
+
342
+ '*.ads-pixiv.net': {
343
+ '.*': {
344
+ sni: 'baidu.com',
345
+ },
346
+ },
347
+
348
+ '*.nikke-global.com': {
349
+ '.*': {
350
+ sni: 'baidu.com',
351
+ },
352
+ },
353
+
354
+ 'i.pximg.net': {
355
+ '.*': {
356
+ cacheDays: 365,
357
+ requestReplace: {
358
+ headers: {
359
+ referer: 'https://www.pixiv.net/',
360
+ },
361
+ desc: "篡改请求头'Referer',使Pixiv图片链接可以单独在浏览器打开",
362
+ },
363
+ },
364
+ },
365
+
366
+ // ===== YouTube =====
367
+ '*.youtube.com': {
368
+ '.*': {
369
+ sni: 'baidu.com',
370
+ },
371
+ },
372
+
373
+ '*.youtu.be': {
374
+ '.*': {
375
+ sni: 'baidu.com',
376
+ },
377
+ },
378
+
379
+ '*.youtube-nocookie.com': {
380
+ '.*': {
381
+ sni: 'baidu.com',
382
+ },
383
+ },
384
+
385
+ '*.ggpht.com': {
386
+ '.*': {
387
+ sni: 'baidu.com',
388
+ },
389
+ },
390
+
391
+ 'i.ytimg.com': {
392
+ '.*': {
393
+ sni: 'baidu.com',
394
+ },
395
+ },
396
+
397
+ // ===== CDN / 镜像 =====
398
+ 'cdn.jsdelivr.net': {
399
+ '^/.*\\.(js|css|png|jpg|jpeg|gif|json)(\\?.*)?$': {
400
+ proxy: 'fastly.jsdelivr.net',
401
+ backup: ['gcore.jsdelivr.net'],
402
+ },
403
+ },
404
+
405
+ '*.greasyfork.org': {
406
+ '.*': {
407
+ sni: 'baidu.com',
408
+ },
409
+ },
410
+
411
+ '*.cn-greasyfork.org': {
412
+ '.*': {
413
+ sni: 'baidu.com',
414
+ },
415
+ },
416
+
417
+ '*.huggingface.co': {
418
+ '.*': {
419
+ sni: 'huggingface.cn',
420
+ },
421
+ },
422
+
423
+ 'cn.vuejs.org': {
424
+ '.*': {
425
+ sni: 'vuejs.org',
426
+ },
427
+ },
428
+
429
+ '*z-library.sk': {
430
+ '.*': {
431
+ sni: 'www.baidu.com',
432
+ },
433
+ },
434
+
435
+ '*z-lib.help': {
436
+ '.*': {
437
+ sni: 'www.baidu.com',
438
+ },
439
+ },
440
+
441
+ // ===== Steam =====
442
+ '*.steamserver.net': {
443
+ '.*': {
444
+ sni: 'www.baidu.com',
445
+ desc: 'steam登录不稳定?无法复现先这么写',
446
+ },
447
+ },
448
+
449
+ 'images.steamusercontent.com': {
450
+ '.*': {
451
+ sni: 'baidu.com',
452
+ },
453
+ },
454
+
455
+ '*steamcommunity.com': {
456
+ '^(?!/discussions|/Profile|/app.*/discussions).*$': {
457
+ sni: 'www.baidu.com',
458
+ desc: '讨论区锁区,考虑不拦截丢给彩蛋',
459
+ },
460
+ },
461
+
462
+ '^(?!.*cloudflare).*steamstatic.com$': {
463
+ '.*': {
464
+ sni: 'baidu.com',
465
+ desc: 'steam社区数据不能也不需调整sni,直接直连',
466
+ },
467
+ },
468
+
469
+ '*.steampowered.com': {
470
+ '.*': {
471
+ sni: 'www.baidu.com',
472
+ },
473
+ },
474
+
475
+ // ===== 其他 =====
476
+ 'external-content.duckduckgo.com': {
477
+ '.*': {
478
+ sni: 'www.baidu.com',
479
+ },
480
+ },
481
+
482
+ '*duckduckgo.com': {
483
+ '.*': {
484
+ sni: 'www.baidu.com',
485
+ },
486
+ },
487
+
488
+ '*onedrive.live.com': {
489
+ '.*': {
490
+ sni: 'www.baidu.com',
491
+ },
492
+ },
493
+
494
+ '*dropbox.com': {
495
+ '.*': {
496
+ sni: 'www.baidu.com',
497
+ },
498
+ },
499
+
500
+ '*f-droid.org': {
501
+ '.*': {
502
+ sni: 'www.baidu.com',
503
+ },
504
+ },
505
+
506
+ 'fdroid.org': {
507
+ '.*': {
508
+ sni: 'www.baidu.com',
509
+ },
510
+ },
511
+
512
+ '*apkmirror.com': {
513
+ '.*': {
514
+ sni: 'none',
515
+ },
516
+ },
517
+
518
+ 'jsd.proxy.aks.moe': {
519
+ '^.*\\?DS_DOWNLOAD$': {
520
+ requestReplace: { doDownload: true },
521
+ responseReplace: { doDownload: true },
522
+ },
523
+ },
524
+
525
+ 'fastly.jsdelivr.net': {
526
+ '^.*\\?DS_DOWNLOAD$': {
527
+ requestReplace: { doDownload: true },
528
+ responseReplace: { doDownload: true },
529
+ },
530
+ },
531
+
532
+ 'jsdelivr.pai233.top': {
533
+ '^.*\\?DS_DOWNLOAD$': {
534
+ requestReplace: { doDownload: true },
535
+ responseReplace: { doDownload: true },
536
+ },
537
+ },
538
+
539
+ 'raw.incept.pw': {
540
+ '^.*\\?DS_DOWNLOAD$': {
541
+ requestReplace: { doDownload: true },
542
+ responseReplace: { doDownload: true },
543
+ },
544
+ },
545
+
546
+ 'packages.elastic.co': {
547
+ '.*': {
548
+ proxy: 'elastic.proxy.ustclug.org',
549
+ },
550
+ },
551
+
552
+ 'ppa.launchpad.net': {
553
+ '.*': {
554
+ proxy: 'launchpad.proxy.ustclug.org',
555
+ },
556
+ },
557
+
558
+ 'downloads.openwrt.org': {
559
+ '.*': {
560
+ proxy: 'openwrt.proxy.ustclug.org',
561
+ },
562
+ },
563
+
564
+ 'registry.npmjs.org': {
565
+ '.*': {
566
+ desc: '既然ds有NPM镜像了,这个就没什么必要了,先不配置了',
567
+ },
568
+ },
569
+
570
+ 'repo1.maven.org': {
571
+ '.*': {
572
+ proxy: 'maven.proxy.ustclug.org',
573
+ },
574
+ },
575
+
576
+ '*.msecnd.net': {
577
+ '.*': {
578
+ sni: 'baidu.com',
579
+ },
580
+ },
581
+
582
+ '*.instagram.com': {
583
+ '.*': {
584
+ sni: 'g.cn',
585
+ },
586
+ },
587
+
588
+ '*.cdninstagram.com': {
589
+ '.*': {
590
+ sni: 'g.cn',
591
+ },
592
+ },
593
+
594
+ '*.intercom.io': {
595
+ '.*': {
596
+ sni: 'g.cn',
597
+ },
598
+ },
599
+
600
+ '*startpage.com': {
601
+ '.*': {
602
+ sni: 'www.baidu.com',
603
+ },
604
+ },
605
+
606
+ '*.brave.com': {
607
+ '.*': {
608
+ sni: 'www.baidu.com',
609
+ },
610
+ },
611
+
612
+ // ===== GitHub 子域名 =====
613
+ 'camo.githubusercontent.com': {
614
+ '^[a-zA-Z0-9/]+(\\?.*)?$': {
615
+ cacheDays: 365,
616
+ desc: '图片,缓存1年',
617
+ },
618
+ },
619
+
620
+ 'customer-stories-feed.github.com': {
621
+ '.*': {
622
+ proxy: 'customer-stories-feed.fastgit.org',
623
+ },
624
+ },
625
+
626
+ 'user-images.githubusercontent.com': {
627
+ '^/.*\\.png(\\?.*)?$': {
628
+ cacheDays: 365,
629
+ desc: '用户在PR或issue等内容中上传的图片,缓存1年。注:每张图片都有唯一的ID,不会重复,可以安心缓存',
630
+ },
631
+ },
632
+
633
+ 'private-user-images.githubusercontent.com': {
634
+ '^/.*\\.png(\\?.*)?$': {
635
+ cacheDays: 30,
636
+ desc: '用户在PR或issue等内容中上传的图片,缓存30天',
637
+ },
638
+ },
639
+
640
+ 'avatars.githubusercontent.com': {
641
+ '^/u/\\d+(\\?.*)?$': {
642
+ cacheDays: 365,
643
+ desc: '用户头像,缓存1年',
644
+ },
645
+ },
646
+
647
+ // ===== AWS / SQLite =====
648
+ '*.s3.1amazonaws1.com': {
649
+ '/sqlite3/.*': {
650
+ redirect: 'npm.taobao.org/mirrors',
651
+ },
652
+ },
653
+
654
+ // ===== 广告拦截 =====
655
+ '*.carbonads.com': {
656
+ '/carbon.*': {
657
+ abort: true,
658
+ desc: '广告拦截',
659
+ },
660
+ },
661
+
662
+ '*.buysellads.com': {
663
+ '/ads/.*': {
664
+ abort: true,
665
+ desc: '广告拦截',
666
+ },
667
+ },
668
+ };