-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathdiy-part2.sh
More file actions
executable file
·1161 lines (1060 loc) · 33.7 KB
/
diy-part2.sh
File metadata and controls
executable file
·1161 lines (1060 loc) · 33.7 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
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
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#!/bin/bash
#
# Copyright (c) 2019-2020 P3TERX <https://p3terx.com>
#
# This is free software, licensed under the MIT License.
# See /LICENSE for more information.
#
# https://github.com/P3TERX/Actions-OpenWrt
# File name: diy-part2.sh
# Description: OpenWrt DIY script part 2 (After Update feeds)
#
# Modify default IP
sed -i 's/192.168.1.1/192.168.2.1/g' package/base-files/files/bin/config_generate
LUCI_BRANCH=master
Arch="amd64"
CPU_MODEL="${Arch}-v3"
CLASH_META_REPOS_VERNESONG=${CLASH_META_REPOS_VERNESONG:-true}
rm -rf feeds/luci/themes/luci-theme-argon
git clone --depth 1 -b $LUCI_BRANCH https://github.com/jerrykuku/luci-theme-argon.git feeds/luci/themes/luci-theme-argon
sed -i "s/\$(TOPDIR)\/luci.mk/\$(TOPDIR)\/feeds\/luci\/luci.mk/g" feeds/luci/themes/luci-theme-argon/Makefile
rm -rf feeds/packages/net/smartdns/conf
mkdir -p feeds/packages/net/smartdns/conf
sed -i 's/PKG_BUILD_DIR)\/package\/openwrt\/custom.conf/CURDIR)\/conf\/custom.conf/g' feeds/packages/net/smartdns/Makefile
sed -i 's/PKG_BUILD_DIR)\/package\/openwrt\/files\/etc\/config\/smartdns/CURDIR)\/conf\/smartdns.conf/g' feeds/packages/net/smartdns/Makefile
cp $GITHUB_WORKSPACE/scripts/check_smartdns_connect.sh package/base-files/files/etc
# 降级 zerotier 到 1.14.2(服务端不兼容 1.16.0)
# 使用 immortalwrt 1.14.1 的 patches(适用于 1.14.x 系列)
if [ -d feeds/packages/net/zerotier ]; then
ZT_COMMIT="660b10f0dc9c"
ZT_URL="https://raw.githubusercontent.com/immortalwrt/packages/${ZT_COMMIT}/net/zerotier"
rm -rf feeds/packages/net/zerotier
mkdir -p feeds/packages/net/zerotier/files/etc/init.d feeds/packages/net/zerotier/files/etc/config feeds/packages/net/zerotier/files/etc/uci-defaults feeds/packages/net/zerotier/patches
# 1. 下载 Makefile + Config.in
curl -sL "${ZT_URL}/Makefile" -o feeds/packages/net/zerotier/Makefile
curl -sL "${ZT_URL}/Config.in" -o feeds/packages/net/zerotier/Config.in
# 2. 下载 files
curl -sL "https://api.github.com/repos/immortalwrt/packages/contents/net/zerotier/files/etc/init.d?ref=${ZT_COMMIT}" | python3 -c "import json,sys; d=json.load(sys.stdin); print([f['name'] for f in d if isinstance(d,list)][0])"
curl -sL "${ZT_URL}/files/etc/init.d/zerotier" -o feeds/packages/net/zerotier/files/etc/init.d/zerotier
curl -sL "${ZT_URL}/files/etc/config/zerotier" -o feeds/packages/net/zerotier/files/etc/config/zerotier 2>/dev/null || true
curl -sL "${ZT_URL}/files/etc/uci-defaults/zerotier" -o feeds/packages/net/zerotier/files/etc/uci-defaults/zerotier 2>/dev/null || true
# 3. 下载 patches(用 curl 按文件名下载)
for patch in 0001-fix-miniupnpc-natpmp-include-path.patch 0002-remove-PIE-options.patch 0003-fix-compilation-for-arm_cortex-a7-neon.patch 0004-add-missing-libatomic.patch 0005-remove-noexecstack.patch; do
curl -sL "${ZT_URL}/patches/${patch}" -o "feeds/packages/net/zerotier/patches/${patch}"
done
# 4. 修改 Makefile 版本为 1.14.2
sed -i 's/PKG_VERSION:=1.14.1/PKG_VERSION:=1.14.2/' feeds/packages/net/zerotier/Makefile
sed -i 's|4f9f40b27c5a78389ed3f3216c850921f6298749e5819e9f2edabb2672ce9ca0|c2f64339fccf5148a7af089b896678d655fbfccac52ddce7714314a59d7bddbb|' feeds/packages/net/zerotier/Makefile
echo "✅ zerotier 已降级到 1.14.2(使用 immortalwrt 1.14.1 patches)"
fi
cp $GITHUB_WORKSPACE/scripts/check_openclash_connect.sh package/base-files/files/etc
cp $GITHUB_WORKSPACE/scripts/check_wan_connect.sh package/base-files/files/etc
cp $GITHUB_WORKSPACE/scripts/reset_get_img.sh package/base-files/files/etc
cp $GITHUB_WORKSPACE/scripts/reset_latest.sh package/base-files/files/etc
cp $GITHUB_WORKSPACE/scripts/reset_offline.sh package/base-files/files/etc
cp $GITHUB_WORKSPACE/scripts/reset_upload.sh package/base-files/files/etc
chmod +x package/base-files/files/etc/check_smartdns_connect.sh
chmod +x package/base-files/files/etc/check_openclash_connect.sh
chmod +x package/base-files/files/etc/check_wan_connect.sh
chmod +x package/base-files/files/etc/reset_get_img.sh
chmod +x package/base-files/files/etc/reset_latest.sh
chmod +x package/base-files/files/etc/reset_offline.sh
chmod +x package/base-files/files/etc/reset_upload.sh
sed -i '/exit 0/i\if [[ "$(cat /etc/crontabs/root | grep "/etc/check_smartdns_connect.sh")" = "" ]]; then echo "#*/5 * * * * /etc/check_smartdns_connect.sh" >> /etc/crontabs/root; fi' package/lean/default-settings/files/zzz-default-settings
sed -i '/exit 0/i\if [[ "$(cat /etc/crontabs/root | grep "/etc/check_openclash_connect.sh")" = "" ]]; then echo "#*/5 * * * * /etc/check_openclash_connect.sh" >> /etc/crontabs/root; fi' package/lean/default-settings/files/zzz-default-settings
sed -i '/exit 0/i\if [[ "$(cat /etc/crontabs/root | grep "/etc/check_wan_connect.sh")" = "" ]]; then echo "#*/5 * * * * /etc/check_wan_connect.sh" >> /etc/crontabs/root; fi' package/lean/default-settings/files/zzz-default-settings
sed -i '/uci commit luci/i\uci set luci.main.mediaurlbase="/luci-static/argon"' package/lean/default-settings/files/zzz-default-settings
sed -i "s/uci -q set openclash.config.enable=0/uci -q set openclash.config.enable=\$(cat \/etc\/config\/openclash | grep -m 1 \"option enable\" | cut -d: -f2 | awk '{ print \$3}' | cut -d \"'\" -f 2)/g" package/lean/luci-app-openclash/root/etc/uci-defaults/luci-openclash
sed -i 's/login/login -f root/g' feeds/packages/utils/ttyd/files/ttyd.config
sed -i 's/\${interface:+-i \$interface\}/#\${interface:+-i \$interface\}/g' feeds/packages/utils/ttyd/files/ttyd.init
echo '
config openclash 'config'
option proxy_port '7892'
option tproxy_port '7895'
option mixed_port '7893'
option socks_port '7891'
option http_port '7890'
option dns_port '7874'
option update '0'
option auto_update '0'
option auto_update_time '0'
option cn_port '9090'
option ipv6_enable '0'
option ipv6_dns '0'
option release_branch 'dev'
option en_mode 'redir-host'
option servers_if_update '0'
option servers_update '0'
option log_level 'silent'
option proxy_mode 'rule'
option lan_ac_mode '0'
option operation_mode 'redir-host'
option small_flash_memory '0'
option interface_name '0'
option log_size '1024'
option tolerance '0'
option store_fakeip '1'
option custom_fallback_filter '0'
option append_wan_dns '0'
option stream_domains_prefetch '0'
option stream_auto_select '0'
option chnr6_custom_url 'https://ispip.clang.cn/all_cn_ipv6.txt'
option enable_udp_proxy '1'
option disable_udp_quic '0'
option enable_rule_proxy '1'
option common_ports '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'
option china_ip_route '1'
option intranet_allowed '1'
option enable_redirect_dns '1'
option enable_custom_dns '1'
option disable_masq_cache '1'
option dns_advanced_setting '1'
option rule_source '1'
option enable_custom_clash_rules '1'
option other_rule_auto_update '1'
option other_rule_update_week_time '*'
option other_rule_update_day_time '2'
option chnr_auto_update '1'
option chnr_update_week_time '*'
option chnr_update_day_time '4'
option chnr_custom_url 'https://fastly.jsdelivr.net/gh/Hackl0us/GeoIP2-CN@release/CN-ip-cidr.txt'
option auto_restart '0'
option auto_restart_week_time '1'
option auto_restart_day_time '0'
option config_path '/etc/openclash/config/config.yaml'
option restricted_mode '0'
option core_type 'Smart'
option bypass_gateway_compatible '0'
option github_address_mod '0'
option delay_start '0'
option filter_aaaa_dns '0'
option router_self_proxy '1'
option enable_meta_core '1'
option enable_meta_sniffer '1'
option enable_meta_sniffer_custom '0'
option enable_tcp_concurrent '1'
option geodata_loader 'standard'
option geosite_auto_update '1'
option geosite_update_week_time '*'
option geosite_update_day_time '6'
option geosite_custom_url 'https://fastly.jsdelivr.net/gh/Loyalsoldier/v2ray-rules-dat@release/geosite.dat'
option enable_geoip_dat '1'
option geoip_auto_update '1'
option geoip_update_week_time '*'
option geoip_update_day_time '5'
option geoip_custom_url 'https://fastly.jsdelivr.net/gh/Loyalsoldier/v2ray-rules-dat@release/geoip.dat'
option geo_auto_update '1'
option geo_update_week_time '*'
option geo_update_day_time '3'
option geo_custom_url 'https://testingcf.jsdelivr.net/gh/alecthw/mmdb_china_ip_list@release/Country.mmdb'
option dashboard_forward_ssl '0'
option enable_http3 '1'
option dashboard_type 'Smart'
option yacd_type 'Meta'
option append_default_dns '0'
option enable_meta_sniffer_pure_ip '0'
option cndomain_custom_url 'https://testingcf.jsdelivr.net/gh/felixonmars/dnsmasq-china-list@master/accelerated-domains.china.conf'
option urltest_address_mod '0'
option find_process_mode 'always'
option dnsmasq_noresolv '0'
option global_client_fingerprint '0'
option create_config '0'
option default_resolvfile '/tmp/resolv.conf.d/resolv.conf.auto'
option dnsmasq_resolvfile '/tmp/resolv.conf.d/resolv.conf.auto'
option urltest_interval_mod '0'
option enable_unified_delay '1'
option keep_alive_interval '0'
option config_reload '1'
option skip_proxy_address '1'
option proxy_dns_group 'Disable'
option lan_interface_name '0'
list intranet_allowed_wan_name 'pppoe-wan'
option core_version 'linux-amd64-v3'
option disable_quic_go_gso '0'
option dashboard_password 'openwrt'
option geoasn_auto_update '1'
option geoasn_update_week_time '*'
option geoasn_update_day_time '1'
option geoasn_custom_url 'https://fastly.jsdelivr.net/gh/xishang0128/geoip@release/GeoLite2-ASN.mmdb'
option enable '1'
option restart '0'
option enable_respect_rules '0'
option custom_host '1'
option enable_custom_domain_dns_server '1'
option custom_name_policy '0'
option custom_domain_dns_server '127.0.0.1#6053'
option smart_enable '1'
option auto_smart_switch '1'
option smart_strategy 'sticky-sessions'
option smart_collect '1'
option smart_collect_size '100'
option smart_collect_rate '1'
option lgbm_auto_update '1'
option lgbm_update_interval '12'
option lgbm_custom_url 'https://github.com/vernesong/mihomo/releases/download/LightGBM-Model/Model-large.bin'
option redirect_dns '1'
option dnsmasq_cachesize '0'
option cachesize_dns '1'
config dns_servers
option ip '119.29.29.29'
option type 'udp'
option interface 'Disable'
option direct_nameserver '0'
option node_resolve '0'
option enabled '0'
option group 'default'
config dns_servers
option ip '223.5.5.5'
option type 'udp'
option interface 'Disable'
option direct_nameserver '0'
option node_resolve '0'
option enabled '0'
option group 'default'
config dns_servers
option ip '119.29.29.29'
option type 'tcp'
option interface 'Disable'
option direct_nameserver '0'
option node_resolve '0'
option enabled '0'
option group 'default'
config dns_servers
option ip '223.5.5.5'
option type 'tcp'
option interface 'Disable'
option direct_nameserver '0'
option node_resolve '0'
option enabled '0'
option group 'default'
config dns_servers
option ip '8.8.8.8'
option type 'udp'
option interface 'Disable'
option direct_nameserver '0'
option node_resolve '0'
option enabled '0'
option group 'default'
config dns_servers
option ip '1.1.1.1'
option type 'udp'
option interface 'Disable'
option direct_nameserver '0'
option node_resolve '0'
option enabled '0'
option group 'default'
config dns_servers
option ip '1.1.1.1'
option type 'tcp'
option interface 'Disable'
option direct_nameserver '0'
option node_resolve '0'
option enabled '0'
option group 'default'
config dns_servers
option ip '8.8.8.8'
option type 'tcp'
option interface 'Disable'
option direct_nameserver '0'
option node_resolve '0'
option enabled '0'
option group 'default'
config dns_servers
option ip 'dot.pub'
option type 'tls'
option interface 'Disable'
option specific_group 'Disable'
option direct_nameserver '0'
option node_resolve '0'
option enabled '0'
option group 'nameserver'
config dns_servers
option ip 'dns.alidns.com'
option type 'tls'
option interface 'Disable'
option specific_group 'Disable'
option direct_nameserver '0'
option node_resolve '0'
option enabled '0'
option group 'nameserver'
config dns_servers
option ip 'doh.pub/dns-query'
option type 'https'
option interface 'Disable'
option specific_group 'Disable'
option direct_nameserver '0'
option skip_cert_verify '0'
option ecs_override '0'
option node_resolve '0'
option http3 '1'
option enabled '0'
option group 'nameserver'
config dns_servers
option ip 'dns.alidns.com/dns-query'
option type 'https'
option interface 'Disable'
option specific_group 'Disable'
option direct_nameserver '0'
option skip_cert_verify '0'
option ecs_override '0'
option node_resolve '0'
option http3 '1'
option enabled '0'
option group 'nameserver'
config dns_servers
option ip 'dns.alidns.com'
option type 'quic'
option interface 'Disable'
option specific_group 'Disable'
option direct_nameserver '0'
option node_resolve '0'
option enabled '0'
option group 'nameserver'
config dns_servers
option ip '127.0.0.1'
option port '6053'
option type 'tcp'
option interface 'Disable'
option specific_group 'Disable'
option node_resolve '0'
option enabled '1'
option group 'nameserver'
config dns_servers
option ip 'cloudflare-dns.com'
option type 'tls'
option interface 'Disable'
option specific_group 'Disable'
option direct_nameserver '0'
option node_resolve '0'
option enabled '0'
option group 'fallback'
config dns_servers
option ip 'dns.google'
option type 'tls'
option interface 'Disable'
option specific_group 'Disable'
option direct_nameserver '0'
option node_resolve '0'
option enabled '0'
option group 'fallback'
config dns_servers
option ip 'cloudflare-dns.com/dns-query'
option type 'https'
option interface 'Disable'
option specific_group 'Disable'
option direct_nameserver '0'
option skip_cert_verify '0'
option ecs_override '0'
option node_resolve '0'
option http3 '1'
option enabled '0'
option group 'fallback'
config dns_servers
option ip 'dns.google/dns-query'
option type 'https'
option interface 'Disable'
option specific_group 'Disable'
option direct_nameserver '0'
option skip_cert_verify '0'
option ecs_override '0'
option node_resolve '0'
option http3 '1'
option enabled '0'
option group 'fallback'
config dns_servers
option ip '127.0.0.1'
option port '7053'
option type 'tcp'
option interface 'Disable'
option specific_group 'Disable'
option node_resolve '0'
option enabled '0'
option group 'fallback'
config groups
option name 'Proxy'
option type 'select'
option enabled '1'
option config 'config.yaml'
list other_group 'AutoTest'
list other_group 'Fallback'
config groups
option name 'Domestic'
option type 'select'
option enabled '1'
option config 'config.yaml'
list other_group 'DIRECT'
list other_group 'Proxy'
config groups
option name 'Streaming'
option type 'select'
option enabled '1'
option config 'config.yaml'
list other_group 'AutoTest'
list other_group 'Fallback'
config groups
option name 'StreamingSE'
option type 'select'
option enabled '1'
option config 'config.yaml'
list other_group 'DIRECT'
list other_group 'Streaming'
config groups
option name 'Fallback'
option type 'fallback'
option enabled '1'
option disable_udp 'false'
option test_url 'http://cp.cloudflare.com/generate_204'
option test_interval '10'
option config 'config.yaml'
config groups
option name 'AutoTest'
option type 'smart'
option enabled '1'
option disable_udp 'false'
option test_url 'http://cp.cloudflare.com/generate_204'
option test_interval '10'
option config 'config.yaml'
config groups
option name 'Guard'
option type 'select'
option enabled '1'
option config 'config.yaml'
list other_group 'REJECT'
list other_group 'DIRECT'
config groups
option name 'Apple'
option type 'select'
option enabled '1'
option config 'config.yaml'
list other_group 'Domestic'
list other_group 'Proxy'
config groups
option name 'OpenAI'
option type 'select'
option enabled '1'
option config 'config.yaml'
list other_group 'Proxy'
list other_group 'Domestic'
config groups
option name 'Telegram'
option type 'select'
option enabled '1'
option config 'config.yaml'
list other_group 'Streaming'
list other_group 'StreamingSE'
config groups
option name 'Netflix'
option type 'select'
option enabled '1'
option config 'config.yaml'
list other_group 'Streaming'
list other_group 'StreamingSE'
config groups
option name 'Disney+'
option type 'select'
option enabled '1'
option config 'config.yaml'
list other_group 'Streaming'
list other_group 'StreamingSE'
config groups
option name 'YouTube'
option type 'select'
option enabled '1'
option config 'config.yaml'
list other_group 'Streaming'
list other_group 'StreamingSE'
config groups
option name 'TikTok'
option type 'select'
option enabled '1'
option config 'config.yaml'
list other_group 'Streaming'
list other_group 'StreamingSE'
config groups
option name 'Spotify'
option type 'select'
option enabled '1'
option config 'config.yaml'
list other_group 'Streaming'
list other_group 'StreamingSE'
config groups
option name 'Gamer'
option type 'select'
option enabled '1'
option config 'config.yaml'
list other_group 'Domestic'
list other_group 'Proxy'
config groups
option name 'Microsoft'
option type 'select'
option enabled '1'
option config 'config.yaml'
list other_group 'Domestic'
list other_group 'Proxy'
config groups
option name 'GlobalMedia'
option type 'select'
option enabled '1'
option config 'config.yaml'
list other_group 'Streaming'
list other_group 'StreamingSE'
config rule_providers
option enabled '1'
option config 'config.yaml'
option name 'AntiAd'
option type 'http'
option format 'yaml'
option behavior 'domain'
option url 'https://anti-ad.net/clash.yaml'
option interval '43200'
option position '1'
option group 'Guard'
config rule_providers
option enabled '1'
option config 'config.yaml'
option name 'RejectDomainset'
option type 'http'
option format 'text'
option behavior 'domain'
option url 'https://ruleset.skk.moe/Clash/domainset/reject.txt'
option interval '43200'
option position '1'
option group 'Guard'
config rule_providers
option enabled '1'
option config 'config.yaml'
option name 'RejectNonIp'
option type 'http'
option format 'text'
option behavior 'classical'
option url 'https://ruleset.skk.moe/Clash/non_ip/reject.txt'
option interval '43200'
option position '1'
option group 'Guard'
config rule_providers
option enabled '1'
option config 'config.yaml'
option name 'Apple'
option type 'http'
option format 'yaml'
option behavior 'classical'
option url 'https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/Apple/Apple_Classical_No_Resolve.yaml'
option interval '43200'
option position '1'
option group 'Apple'
config rule_providers
option enabled '1'
option config 'config.yaml'
option name 'Spotify'
option type 'http'
option format 'yaml'
option behavior 'classical'
option url 'https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/Spotify/Spotify.yaml'
option interval '43200'
option position '1'
option group 'Spotify'
config rule_providers
option enabled '1'
option config 'config.yaml'
option name 'TikTok'
option type 'http'
option format 'yaml'
option behavior 'classical'
option url 'https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/TikTok/TikTok_No_Resolve.yaml'
option interval '43200'
option position '1'
option group 'TikTok'
config rule_providers
option enabled '1'
option config 'config.yaml'
option name 'Netflix'
option type 'http'
option format 'yaml'
option behavior 'classical'
option url 'https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/Netflix/Netflix_Classical_No_Resolve.yaml'
option interval '43200'
option position '1'
option group 'Netflix'
config rule_providers
option enabled '1'
option config 'config.yaml'
option name 'Disney+'
option type 'http'
option format 'yaml'
option behavior 'classical'
option url 'https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/Disney/Disney_No_Resolve.yaml'
option interval '43200'
option position '1'
option group 'Disney+'
config rule_providers
option enabled '1'
option config 'config.yaml'
option name 'YouTube'
option type 'http'
option format 'yaml'
option behavior 'classical'
option url 'https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/YouTube/YouTube_No_Resolve.yaml'
option interval '43200'
option position '1'
option group 'YouTube'
config rule_providers
option enabled '1'
option config 'config.yaml'
option name 'ChinaMedia'
option type 'http'
option format 'yaml'
option behavior 'classical'
option url 'https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/ChinaMedia/ChinaMedia.yaml'
option interval '43200'
option position '1'
option group 'Domestic'
config rule_providers
option enabled '1'
option config 'config.yaml'
option name 'GlobalMedia'
option type 'http'
option format 'yaml'
option behavior 'classical'
option url 'https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/GlobalMedia/GlobalMedia_Classical.yaml'
option interval '43200'
option position '1'
option group 'GlobalMedia'
config rule_providers
option enabled '1'
option config 'config.yaml'
option name 'Nintendo'
option type 'http'
option format 'yaml'
option behavior 'classical'
option url 'https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/Nintendo/Nintendo.yaml'
option interval '43200'
option position '1'
option group 'Gamer'
config rule_providers
option enabled '1'
option config 'config.yaml'
option name 'PlayStation'
option type 'http'
option format 'yaml'
option behavior 'classical'
option url 'https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/PlayStation/PlayStation.yaml'
option interval '43200'
option position '1'
option group 'Gamer'
config rule_providers
option enabled '1'
option config 'config.yaml'
option name 'Epic'
option type 'http'
option format 'yaml'
option behavior 'classical'
option url 'https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/Epic/Epic.yaml'
option interval '43200'
option position '1'
option group 'Gamer'
config rule_providers
option enabled '1'
option config 'config.yaml'
option name 'Xbox'
option type 'http'
option format 'yaml'
option behavior 'classical'
option url 'https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/Xbox/Xbox.yaml'
option interval '43200'
option position '1'
option group 'Gamer'
config rule_providers
option enabled '1'
option config 'config.yaml'
option name 'OpenAI'
option type 'http'
option format 'yaml'
option behavior 'classical'
option url 'https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/OpenAI/OpenAI_No_Resolve.yaml'
option interval '43200'
option position '1'
option group 'OpenAI'
config rule_providers
option enabled '1'
option config 'config.yaml'
option name 'Microsoft'
option type 'http'
option format 'yaml'
option behavior 'classical'
option url 'https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/Microsoft/Microsoft_No_Resolve.yaml'
option interval '43200'
option position '1'
option group 'Microsoft'
config rule_providers
option enabled '1'
option config 'config.yaml'
option name 'Proxy'
option type 'http'
option format 'yaml'
option behavior 'classical'
option url 'https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/Proxy/Proxy_Classical_No_Resolve.yaml'
option interval '43200'
option position '1'
option group 'Proxy'
config rule_providers
option enabled '1'
option config 'config.yaml'
option name 'China'
option type 'http'
option format 'yaml'
option behavior 'classical'
option url 'https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/refs/heads/master/rule/Clash/ChinaMax/ChinaMax_Classical.yaml'
option interval '43200'
option position '1'
option group 'Domestic'
config rule_providers
option enabled '1'
option config 'config.yaml'
option name 'LAN'
option type 'http'
option format 'yaml'
option behavior 'classical'
option url 'https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/Lan/Lan.yaml'
option interval '43200'
option position '1'
option group 'DIRECT'
' >package/lean/luci-app-openclash/root/etc/config/openclash
mkdir -p package/lean/luci-app-openclash/root/etc/openclash/core
if ${CLASH_META_REPOS_VERNESONG}; then
curl --retry 5 -L https://github.com/vernesong/OpenClash/raw/core/dev/smart/clash-linux-${CPU_MODEL}.tar.gz | tar zxf -
mv clash package/lean/luci-app-openclash/root/etc/openclash/core/clash_meta
else
CLASH_META_VERSION="$(curl --retry 5 -L https://api.github.com/repos/MetaCubeX/mihomo/releases/latest 2>/dev/null|grep -E 'tag_name' |grep -E 'v[0-9.]+' -o 2>/dev/null)"
curl --retry 5 -L https://github.com/MetaCubeX/mihomo/releases/download/${CLASH_META_VERSION}/mihomo-linux-amd64-${CLASH_META_VERSION}.gz -O
gzip -d mihomo-linux-amd64-${CLASH_META_VERSION}.gz
mv mihomo-linux-amd64-${CLASH_META_VERSION} package/lean/luci-app-openclash/root/etc/openclash/core/clash_meta
fi
chmod +x package/lean/luci-app-openclash/root/etc/openclash/core/clash_meta
curl --retry 5 -L https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geoip.dat -o package/lean/luci-app-openclash/root/etc/openclash/GeoIP.dat
curl --retry 5 -L https://github.com/vernesong/mihomo/releases/download/LightGBM-Model/Model-large.bin -o package/lean/luci-app-openclash/root/etc/openclash/Model.bin
echo '
config smartdns
option server_name 'smartdns'
option port '6053'
option ipv6_server '0'
option dualstack_ip_selection '0'
option prefetch_domain '1'
option serve_expired '1'
option seconddns_port '7053'
option seconddns_no_rule_addr '0'
option seconddns_no_rule_nameserver '0'
option seconddns_no_rule_ipset '0'
option seconddns_no_rule_soa '0'
option coredump '0'
option enabled '1'
option seconddns_enabled '1'
option seconddns_no_dualstack_selection '1'
option force_aaaa_soa '1'
option seconddns_server_group 'foreign'
option tcp_server '1'
option seconddns_tcp_server '1'
option seconddns_no_cache '1'
option seconddns_no_speed_check '1'
option auto_set_dnsmasq '0'
option speed_check_mode 'ping,tcp:80,tcp:443'
option response_mode 'first-ping'
option bind_device '1'
option cache_persist '1'
option resolve_local_hostnames '1'
option force_https_soa '1'
option rr_ttl_min '600'
option seconddns_force_aaaa_soa '1'
option enable_auto_update '1'
option proxy_server 'socks5://127.0.0.1:7893'
list conf_files 'anti-ad.conf'
config server
option ip '119.29.29.29'
option type 'udp'
option enabled '0'
config server
option ip '223.5.5.5'
option type 'udp'
option enabled '0'
config server
option ip '119.29.29.29'
option type 'tcp'
option enabled '0'
config server
option ip '223.5.5.5'
option type 'tcp'
option enabled '0'
config server
option ip '120.53.53.53'
option type 'tls'
option exclude_default_group '0'
option no_check_certificate '0'
option blacklist_ip '0'
option host_name 'dot.pub'
option enabled '0'
config server
option ip '223.5.5.5'
option type 'tls'
option exclude_default_group '0'
option no_check_certificate '0'
option blacklist_ip '0'
option host_name 'dns.alidns.com'
option enabled '0'
config server
option ip '120.53.53.53/dns-query'
option type 'https'
option exclude_default_group '0'
option no_check_certificate '0'
option blacklist_ip '0'
option host_name 'doh.pub'
option http_host 'doh.pub'
option enabled '1'
config server
option ip '223.5.5.5/dns-query'
option type 'https'
option exclude_default_group '0'
option no_check_certificate '0'
option blacklist_ip '0'
option host_name 'dns.alidns.com'
option http_host 'dns.alidns.com'
option enabled '1'
config server
option ip '8.8.8.8'
option type 'udp'
option server_group 'foreign'
option exclude_default_group '1'
option blacklist_ip '0'
option enabled '0'
config server
option ip '1.1.1.1'
option type 'udp'
option server_group 'foreign'
option exclude_default_group '1'
option blacklist_ip '0'
option enabled '0'
config server
option ip '8.8.8.8'
option type 'tcp'
option server_group 'foreign'
option exclude_default_group '1'
option blacklist_ip '0'
option enabled '0'
config server
option ip '1.1.1.1'
option type 'tcp'
option server_group 'foreign'
option exclude_default_group '1'
option blacklist_ip '0'
option enabled '0'
config server
option ip '8.8.8.8'
option type 'tls'
option server_group 'foreign'
option exclude_default_group '1'
option no_check_certificate '0'
option blacklist_ip '0'
option host_name 'dns.google'
option enabled '0'
config server
option ip '1.1.1.1'
option type 'tls'
option server_group 'foreign'
option exclude_default_group '1'
option no_check_certificate '0'
option blacklist_ip '0'
option host_name 'cloudflare-dns.com'
option enabled '0'
config server
option ip '1.1.1.1/dns-query'
option type 'https'
option server_group 'foreign'
option exclude_default_group '1'
option no_check_certificate '0'
option blacklist_ip '0'
option host_name 'cloudflare-dns.com'
option http_host 'cloudflare-dns.com'
option enabled '1'
config server
option ip '8.8.8.8/dns-query'
option type 'https'
option server_group 'foreign'
option exclude_default_group '1'
option no_check_certificate '0'
option blacklist_ip '0'
option host_name 'dns.google'
option http_host 'dns.google'
option enabled '1'
config domain-rule
option no_speed_check '0'
option force_aaaa_soa '0'
config download-file
option type 'config'
option name 'anti-ad.conf'
option url 'https://raw.githubusercontent.com/privacy-protection-tools/anti-AD/master/anti-ad-smartdns.conf'
config client-rule
config ip-rule
' >feeds/packages/net/smartdns/conf/smartdns.conf
curl --retry 5 -L https://github.com/pymumu/smartdns/raw/master/package/openwrt/custom.conf -o feeds/packages/net/smartdns/conf/custom.conf
#latest_ver="$(curl --retry 5 https://api.github.com/repos/AdguardTeam/AdGuardHome/releases/latest 2>/dev/null|grep -E 'tag_name' |grep -E 'v[0-9.]+' -o 2>/dev/null)"
#curl --retry 5 -L https://github.com/AdguardTeam/AdGuardHome/releases/download/${latest_ver}/AdGuardHome_linux_${Arch}.tar.gz | tar zxf -
#mkdir -p package/base-files/files/usr/bin/AdGuardHome