自建 SSR 进行科学上网

自建 SSR 进行科学上网

购买服务器

首先需要需要一台在国外并且能够正常访问的服务器,可以使用 vultr 这个服务提供商,也可以选择其他的。

安装 SSR

先在服务器上安装一下 SSR 的服务端,嗯,其实也就是复制一下命令的事情(具体的操作由脚本帮忙执行了)

1
2
yum -y install wget
wget -N --no-check-certificate https://raw.githubusercontent.com/ToyoDAdoubi/doubi/master/ssr.sh && chmod +x ssr.sh && bash ssr.sh

如果上面的链接失效,请将以下 bash 命令复制到 .sh 文件中执行

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
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
#!/usr/bin/env bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH

#=================================================
# System Required: CentOS 6+/Debian 6+/Ubuntu 14.04+
# Description: Install the ShadowsocksR server
# Version: 2.0.38
# Author: Toyo
# Blog: https://doub.io/ss-jc42/
#=================================================

sh_ver="2.0.38"
filepath=$(cd "$(dirname "$0")"; pwd)
file=$(echo -e "${filepath}"|awk -F "$0" '{print $1}')
ssr_folder="/usr/local/shadowsocksr"
ssr_ss_file="${ssr_folder}/shadowsocks"
config_file="${ssr_folder}/config.json"
config_folder="/etc/shadowsocksr"
config_user_file="${config_folder}/user-config.json"
ssr_log_file="${ssr_ss_file}/ssserver.log"
Libsodiumr_file="/usr/local/lib/libsodium.so"
Libsodiumr_ver_backup="1.0.13"
Server_Speeder_file="/serverspeeder/bin/serverSpeeder.sh"
LotServer_file="/appex/bin/serverSpeeder.sh"
BBR_file="${file}/bbr.sh"
jq_file="${ssr_folder}/jq"
Green_font_prefix="\033[32m" && Red_font_prefix="\033[31m" && Green_background_prefix="\033[42;37m" && Red_background_prefix="\033[41;37m" && Font_color_suffix="\033[0m"
Info="${Green_font_prefix}[信息]${Font_color_suffix}"
Error="${Red_font_prefix}[错误]${Font_color_suffix}"
Tip="${Green_font_prefix}[注意]${Font_color_suffix}"
Separator_1="——————————————————————————————"

check_root(){
[[ $EUID != 0 ]] && echo -e "${Error} 当前账号非ROOT(或没有ROOT权限),无法继续操作,请使用${Green_background_prefix} sudo su ${Font_color_suffix}来获取临时ROOT权限(执行后会提示输入当前账号的密码)。" && exit 1
}
check_sys(){
if [[ -f /etc/redhat-release ]]; then
release="centos"
elif cat /etc/issue | grep -q -E -i "debian"; then
release="debian"
elif cat /etc/issue | grep -q -E -i "ubuntu"; then
release="ubuntu"
elif cat /etc/issue | grep -q -E -i "centos|red hat|redhat"; then
release="centos"
elif cat /proc/version | grep -q -E -i "debian"; then
release="debian"
elif cat /proc/version | grep -q -E -i "ubuntu"; then
release="ubuntu"
elif cat /proc/version | grep -q -E -i "centos|red hat|redhat"; then
release="centos"
fi
bit=`uname -m`
}
check_pid(){
PID=`ps -ef |grep -v grep | grep server.py |awk '{print $2}'`
}
SSR_installation_status(){
[[ ! -e ${config_user_file} ]] && echo -e "${Error} 没有发现 ShadowsocksR 配置文件,请检查 !" && exit 1
[[ ! -e ${ssr_folder} ]] && echo -e "${Error} 没有发现 ShadowsocksR 文件夹,请检查 !" && exit 1
}
Server_Speeder_installation_status(){
[[ ! -e ${Server_Speeder_file} ]] && echo -e "${Error} 没有安装 锐速(Server Speeder),请检查 !" && exit 1
}
LotServer_installation_status(){
[[ ! -e ${LotServer_file} ]] && echo -e "${Error} 没有安装 LotServer,请检查 !" && exit 1
}
BBR_installation_status(){
if [[ ! -e ${BBR_file} ]]; then
echo -e "${Error} 没有发现 BBR脚本,开始下载..."
cd "${file}"
if ! wget -N --no-check-certificate https://raw.githubusercontent.com/ToyoDAdoubi/doubi/master/bbr.sh; then
echo -e "${Error} BBR 脚本下载失败 !" && exit 1
else
echo -e "${Info} BBR 脚本下载完成 !"
chmod +x bbr.sh
fi
fi
}
# 设置 防火墙规则
Add_iptables(){
iptables -I INPUT -m state --state NEW -m tcp -p tcp --dport ${ssr_port} -j ACCEPT
iptables -I INPUT -m state --state NEW -m udp -p udp --dport ${ssr_port} -j ACCEPT
ip6tables -I INPUT -m state --state NEW -m tcp -p tcp --dport ${ssr_port} -j ACCEPT
ip6tables -I INPUT -m state --state NEW -m udp -p udp --dport ${ssr_port} -j ACCEPT
}
Del_iptables(){
iptables -D INPUT -m state --state NEW -m tcp -p tcp --dport ${port} -j ACCEPT
iptables -D INPUT -m state --state NEW -m udp -p udp --dport ${port} -j ACCEPT
ip6tables -D INPUT -m state --state NEW -m tcp -p tcp --dport ${port} -j ACCEPT
ip6tables -D INPUT -m state --state NEW -m udp -p udp --dport ${port} -j ACCEPT
}
Save_iptables(){
if [[ ${release} == "centos" ]]; then
service iptables save
service ip6tables save
else
iptables-save > /etc/iptables.up.rules
ip6tables-save > /etc/ip6tables.up.rules
fi
}
Set_iptables(){
if [[ ${release} == "centos" ]]; then
service iptables save
service ip6tables save
chkconfig --level 2345 iptables on
chkconfig --level 2345 ip6tables on
else
iptables-save > /etc/iptables.up.rules
ip6tables-save > /etc/ip6tables.up.rules
echo -e '#!/bin/bash\n/sbin/iptables-restore < /etc/iptables.up.rules\n/sbin/ip6tables-restore < /etc/ip6tables.up.rules' > /etc/network/if-pre-up.d/iptables
chmod +x /etc/network/if-pre-up.d/iptables
fi
}
# 读取 配置信息
Get_IP(){
ip=$(wget -qO- -t1 -T2 ipinfo.io/ip)
if [[ -z "${ip}" ]]; then
ip=$(wget -qO- -t1 -T2 api.ip.sb/ip)
if [[ -z "${ip}" ]]; then
ip=$(wget -qO- -t1 -T2 members.3322.org/dyndns/getip)
if [[ -z "${ip}" ]]; then
ip="VPS_IP"
fi
fi
fi
}
Get_User(){
[[ ! -e ${jq_file} ]] && echo -e "${Error} JQ解析器 不存在,请检查 !" && exit 1
port=`${jq_file} '.server_port' ${config_user_file}`
password=`${jq_file} '.password' ${config_user_file} | sed 's/^.//;s/.$//'`
method=`${jq_file} '.method' ${config_user_file} | sed 's/^.//;s/.$//'`
protocol=`${jq_file} '.protocol' ${config_user_file} | sed 's/^.//;s/.$//'`
obfs=`${jq_file} '.obfs' ${config_user_file} | sed 's/^.//;s/.$//'`
protocol_param=`${jq_file} '.protocol_param' ${config_user_file} | sed 's/^.//;s/.$//'`
speed_limit_per_con=`${jq_file} '.speed_limit_per_con' ${config_user_file}`
speed_limit_per_user=`${jq_file} '.speed_limit_per_user' ${config_user_file}`
connect_verbose_info=`${jq_file} '.connect_verbose_info' ${config_user_file}`
}
urlsafe_base64(){
date=$(echo -n "$1"|base64|sed ':a;N;s/\n/ /g;ta'|sed 's/ //g;s/=//g;s/+/-/g;s/\//_/g')
echo -e "${date}"
}
ss_link_qr(){
SSbase64=$(urlsafe_base64 "${method}:${password}@${ip}:${port}")
SSurl="ss://${SSbase64}"
SSQRcode="http://doub.pw/qr/qr.php?text=${SSurl}"
ss_link=" SS 链接 : ${Green_font_prefix}${SSurl}${Font_color_suffix} \n SS 二维码 : ${Green_font_prefix}${SSQRcode}${Font_color_suffix}"
}
ssr_link_qr(){
SSRprotocol=$(echo ${protocol} | sed 's/_compatible//g')
SSRobfs=$(echo ${obfs} | sed 's/_compatible//g')
SSRPWDbase64=$(urlsafe_base64 "${password}")
SSRbase64=$(urlsafe_base64 "${ip}:${port}:${SSRprotocol}:${method}:${SSRobfs}:${SSRPWDbase64}")
SSRurl="ssr://${SSRbase64}"
SSRQRcode="http://doub.pw/qr/qr.php?text=${SSRurl}"
ssr_link=" SSR 链接 : ${Red_font_prefix}${SSRurl}${Font_color_suffix} \n SSR 二维码 : ${Red_font_prefix}${SSRQRcode}${Font_color_suffix} \n "
}
ss_ssr_determine(){
protocol_suffix=`echo ${protocol} | awk -F "_" '{print $NF}'`
obfs_suffix=`echo ${obfs} | awk -F "_" '{print $NF}'`
if [[ ${protocol} = "origin" ]]; then
if [[ ${obfs} = "plain" ]]; then
ss_link_qr
ssr_link=""
else
if [[ ${obfs_suffix} != "compatible" ]]; then
ss_link=""
else
ss_link_qr
fi
fi
else
if [[ ${protocol_suffix} != "compatible" ]]; then
ss_link=""
else
if [[ ${obfs_suffix} != "compatible" ]]; then
if [[ ${obfs_suffix} = "plain" ]]; then
ss_link_qr
else
ss_link=""
fi
else
ss_link_qr
fi
fi
fi
ssr_link_qr
}
# 显示 配置信息
View_User(){
SSR_installation_status
Get_IP
Get_User
now_mode=$(cat "${config_user_file}"|grep '"port_password"')
[[ -z ${protocol_param} ]] && protocol_param="0(无限)"
if [[ -z "${now_mode}" ]]; then
ss_ssr_determine
clear && echo "===================================================" && echo
echo -e " ShadowsocksR账号 配置信息:" && echo
echo -e " I P\t : ${Green_font_prefix}${ip}${Font_color_suffix}"
echo -e " 端口\t : ${Green_font_prefix}${port}${Font_color_suffix}"
echo -e " 密码\t : ${Green_font_prefix}${password}${Font_color_suffix}"
echo -e " 加密\t : ${Green_font_prefix}${method}${Font_color_suffix}"
echo -e " 协议\t : ${Red_font_prefix}${protocol}${Font_color_suffix}"
echo -e " 混淆\t : ${Red_font_prefix}${obfs}${Font_color_suffix}"
echo -e " 设备数限制 : ${Green_font_prefix}${protocol_param}${Font_color_suffix}"
echo -e " 单线程限速 : ${Green_font_prefix}${speed_limit_per_con} KB/S${Font_color_suffix}"
echo -e " 端口总限速 : ${Green_font_prefix}${speed_limit_per_user} KB/S${Font_color_suffix}"
echo -e "${ss_link}"
echo -e "${ssr_link}"
echo -e " ${Green_font_prefix} 提示: ${Font_color_suffix}
在浏览器中,打开二维码链接,就可以看到二维码图片。
协议和混淆后面的[ _compatible ],指的是 兼容原版协议/混淆。"
echo && echo "==================================================="
else
user_total=`${jq_file} '.port_password' ${config_user_file} | sed '$d' | sed "1d" | wc -l`
[[ ${user_total} = "0" ]] && echo -e "${Error} 没有发现 多端口用户,请检查 !" && exit 1
clear && echo "===================================================" && echo
echo -e " ShadowsocksR账号 配置信息:" && echo
echo -e " I P\t : ${Green_font_prefix}${ip}${Font_color_suffix}"
echo -e " 加密\t : ${Green_font_prefix}${method}${Font_color_suffix}"
echo -e " 协议\t : ${Red_font_prefix}${protocol}${Font_color_suffix}"
echo -e " 混淆\t : ${Red_font_prefix}${obfs}${Font_color_suffix}"
echo -e " 设备数限制 : ${Green_font_prefix}${protocol_param}${Font_color_suffix}"
echo -e " 单线程限速 : ${Green_font_prefix}${speed_limit_per_con} KB/S${Font_color_suffix}"
echo -e " 端口总限速 : ${Green_font_prefix}${speed_limit_per_user} KB/S${Font_color_suffix}" && echo
for((integer = ${user_total}; integer >= 1; integer--))
do
port=`${jq_file} '.port_password' ${config_user_file} | sed '$d' | sed "1d" | awk -F ":" '{print $1}' | sed -n "${integer}p" | sed -r 's/.*\"(.+)\".*/\1/'`
password=`${jq_file} '.port_password' ${config_user_file} | sed '$d' | sed "1d" | awk -F ":" '{print $2}' | sed -n "${integer}p" | sed -r 's/.*\"(.+)\".*/\1/'`
ss_ssr_determine
echo -e ${Separator_1}
echo -e " 端口\t : ${Green_font_prefix}${port}${Font_color_suffix}"
echo -e " 密码\t : ${Green_font_prefix}${password}${Font_color_suffix}"
echo -e "${ss_link}"
echo -e "${ssr_link}"
done
echo -e " ${Green_font_prefix} 提示: ${Font_color_suffix}
在浏览器中,打开二维码链接,就可以看到二维码图片。
协议和混淆后面的[ _compatible ],指的是 兼容原版协议/混淆。"
echo && echo "==================================================="
fi
}
# 设置 配置信息
Set_config_port(){
while true
do
echo -e "请输入要设置的ShadowsocksR账号 端口"
read -e -p "(默认: 2333):" ssr_port
[[ -z "$ssr_port" ]] && ssr_port="2333"
echo $((${ssr_port}+0)) &>/dev/null
if [[ $? == 0 ]]; then
if [[ ${ssr_port} -ge 1 ]] && [[ ${ssr_port} -le 65535 ]]; then
echo && echo ${Separator_1} && echo -e " 端口 : ${Green_font_prefix}${ssr_port}${Font_color_suffix}" && echo ${Separator_1} && echo
break
else
echo -e "${Error} 请输入正确的数字(1-65535)"
fi
else
echo -e "${Error} 请输入正确的数字(1-65535)"
fi
done
}
Set_config_password(){
echo "请输入要设置的ShadowsocksR账号 密码"
read -e -p "(默认: doub.io):" ssr_password
[[ -z "${ssr_password}" ]] && ssr_password="doub.io"
echo && echo ${Separator_1} && echo -e " 密码 : ${Green_font_prefix}${ssr_password}${Font_color_suffix}" && echo ${Separator_1} && echo
}
Set_config_method(){
echo -e "请选择要设置的ShadowsocksR账号 加密方式

${Green_font_prefix} 1.${Font_color_suffix} none
${Tip} 如果使用 auth_chain_a 协议,请加密方式选择 none,混淆随意(建议 plain)

${Green_font_prefix} 2.${Font_color_suffix} rc4
${Green_font_prefix} 3.${Font_color_suffix} rc4-md5
${Green_font_prefix} 4.${Font_color_suffix} rc4-md5-6

${Green_font_prefix} 5.${Font_color_suffix} aes-128-ctr
${Green_font_prefix} 6.${Font_color_suffix} aes-192-ctr
${Green_font_prefix} 7.${Font_color_suffix} aes-256-ctr

${Green_font_prefix} 8.${Font_color_suffix} aes-128-cfb
${Green_font_prefix} 9.${Font_color_suffix} aes-192-cfb
${Green_font_prefix}10.${Font_color_suffix} aes-256-cfb

${Green_font_prefix}11.${Font_color_suffix} aes-128-cfb8
${Green_font_prefix}12.${Font_color_suffix} aes-192-cfb8
${Green_font_prefix}13.${Font_color_suffix} aes-256-cfb8

${Green_font_prefix}14.${Font_color_suffix} salsa20
${Green_font_prefix}15.${Font_color_suffix} chacha20
${Green_font_prefix}16.${Font_color_suffix} chacha20-ietf
${Tip} salsa20/chacha20-*系列加密方式,需要额外安装依赖 libsodium ,否则会无法启动ShadowsocksR !" && echo
read -e -p "(默认: 5. aes-128-ctr):" ssr_method
[[ -z "${ssr_method}" ]] && ssr_method="5"
if [[ ${ssr_method} == "1" ]]; then
ssr_method="none"
elif [[ ${ssr_method} == "2" ]]; then
ssr_method="rc4"
elif [[ ${ssr_method} == "3" ]]; then
ssr_method="rc4-md5"
elif [[ ${ssr_method} == "4" ]]; then
ssr_method="rc4-md5-6"
elif [[ ${ssr_method} == "5" ]]; then
ssr_method="aes-128-ctr"
elif [[ ${ssr_method} == "6" ]]; then
ssr_method="aes-192-ctr"
elif [[ ${ssr_method} == "7" ]]; then
ssr_method="aes-256-ctr"
elif [[ ${ssr_method} == "8" ]]; then
ssr_method="aes-128-cfb"
elif [[ ${ssr_method} == "9" ]]; then
ssr_method="aes-192-cfb"
elif [[ ${ssr_method} == "10" ]]; then
ssr_method="aes-256-cfb"
elif [[ ${ssr_method} == "11" ]]; then
ssr_method="aes-128-cfb8"
elif [[ ${ssr_method} == "12" ]]; then
ssr_method="aes-192-cfb8"
elif [[ ${ssr_method} == "13" ]]; then
ssr_method="aes-256-cfb8"
elif [[ ${ssr_method} == "14" ]]; then
ssr_method="salsa20"
elif [[ ${ssr_method} == "15" ]]; then
ssr_method="chacha20"
elif [[ ${ssr_method} == "16" ]]; then
ssr_method="chacha20-ietf"
else
ssr_method="aes-128-ctr"
fi
echo && echo ${Separator_1} && echo -e " 加密 : ${Green_font_prefix}${ssr_method}${Font_color_suffix}" && echo ${Separator_1} && echo
}
Set_config_protocol(){
echo -e "请选择要设置的ShadowsocksR账号 协议插件

${Green_font_prefix}1.${Font_color_suffix} origin
${Green_font_prefix}2.${Font_color_suffix} auth_sha1_v4
${Green_font_prefix}3.${Font_color_suffix} auth_aes128_md5
${Green_font_prefix}4.${Font_color_suffix} auth_aes128_sha1
${Green_font_prefix}5.${Font_color_suffix} auth_chain_a
${Green_font_prefix}6.${Font_color_suffix} auth_chain_b
${Tip} 如果使用 auth_chain_a 协议,请加密方式选择 none,混淆随意(建议 plain)" && echo
read -e -p "(默认: 2. auth_sha1_v4):" ssr_protocol
[[ -z "${ssr_protocol}" ]] && ssr_protocol="2"
if [[ ${ssr_protocol} == "1" ]]; then
ssr_protocol="origin"
elif [[ ${ssr_protocol} == "2" ]]; then
ssr_protocol="auth_sha1_v4"
elif [[ ${ssr_protocol} == "3" ]]; then
ssr_protocol="auth_aes128_md5"
elif [[ ${ssr_protocol} == "4" ]]; then
ssr_protocol="auth_aes128_sha1"
elif [[ ${ssr_protocol} == "5" ]]; then
ssr_protocol="auth_chain_a"
elif [[ ${ssr_protocol} == "6" ]]; then
ssr_protocol="auth_chain_b"
else
ssr_protocol="auth_sha1_v4"
fi
echo && echo ${Separator_1} && echo -e " 协议 : ${Green_font_prefix}${ssr_protocol}${Font_color_suffix}" && echo ${Separator_1} && echo
if [[ ${ssr_protocol} != "origin" ]]; then
if [[ ${ssr_protocol} == "auth_sha1_v4" ]]; then
read -e -p "是否设置 协议插件兼容原版(_compatible)?[Y/n]" ssr_protocol_yn
[[ -z "${ssr_protocol_yn}" ]] && ssr_protocol_yn="y"
[[ $ssr_protocol_yn == [Yy] ]] && ssr_protocol=${ssr_protocol}"_compatible"
echo
fi
fi
}
Set_config_obfs(){
echo -e "请选择要设置的ShadowsocksR账号 混淆插件

${Green_font_prefix}1.${Font_color_suffix} plain
${Green_font_prefix}2.${Font_color_suffix} http_simple
${Green_font_prefix}3.${Font_color_suffix} http_post
${Green_font_prefix}4.${Font_color_suffix} random_head
${Green_font_prefix}5.${Font_color_suffix} tls1.2_ticket_auth
${Tip} 如果使用 ShadowsocksR 加速游戏,请选择 混淆兼容原版或 plain 混淆,然后客户端选择 plain,否则会增加延迟 !
另外, 如果你选择了 tls1.2_ticket_auth,那么客户端可以选择 tls1.2_ticket_fastauth,这样即能伪装又不会增加延迟 !
如果你是在日本、美国等热门地区搭建,那么选择 plain 混淆可能被墙几率更低 !" && echo
read -e -p "(默认: 1. plain):" ssr_obfs
[[ -z "${ssr_obfs}" ]] && ssr_obfs="1"
if [[ ${ssr_obfs} == "1" ]]; then
ssr_obfs="plain"
elif [[ ${ssr_obfs} == "2" ]]; then
ssr_obfs="http_simple"
elif [[ ${ssr_obfs} == "3" ]]; then
ssr_obfs="http_post"
elif [[ ${ssr_obfs} == "4" ]]; then
ssr_obfs="random_head"
elif [[ ${ssr_obfs} == "5" ]]; then
ssr_obfs="tls1.2_ticket_auth"
else
ssr_obfs="plain"
fi
echo && echo ${Separator_1} && echo -e " 混淆 : ${Green_font_prefix}${ssr_obfs}${Font_color_suffix}" && echo ${Separator_1} && echo
if [[ ${ssr_obfs} != "plain" ]]; then
read -e -p "是否设置 混淆插件兼容原版(_compatible)?[Y/n]" ssr_obfs_yn
[[ -z "${ssr_obfs_yn}" ]] && ssr_obfs_yn="y"
[[ $ssr_obfs_yn == [Yy] ]] && ssr_obfs=${ssr_obfs}"_compatible"
echo
fi
}
Set_config_protocol_param(){
while true
do
echo -e "请输入要设置的ShadowsocksR账号 欲限制的设备数 (${Green_font_prefix} auth_* 系列协议 不兼容原版才有效 ${Font_color_suffix})"
echo -e "${Tip} 设备数限制:每个端口同一时间能链接的客户端数量(多端口模式,每个端口都是独立计算),建议最少 2个。"
read -e -p "(默认: 无限):" ssr_protocol_param
[[ -z "$ssr_protocol_param" ]] && ssr_protocol_param="" && echo && break
echo $((${ssr_protocol_param}+0)) &>/dev/null
if [[ $? == 0 ]]; then
if [[ ${ssr_protocol_param} -ge 1 ]] && [[ ${ssr_protocol_param} -le 9999 ]]; then
echo && echo ${Separator_1} && echo -e " 设备数限制 : ${Green_font_prefix}${ssr_protocol_param}${Font_color_suffix}" && echo ${Separator_1} && echo
break
else
echo -e "${Error} 请输入正确的数字(1-9999)"
fi
else
echo -e "${Error} 请输入正确的数字(1-9999)"
fi
done
}
Set_config_speed_limit_per_con(){
while true
do
echo -e "请输入要设置的每个端口 单线程 限速上限(单位:KB/S)"
echo -e "${Tip} 单线程限速:每个端口 单线程的限速上限,多线程即无效。"
read -e -p "(默认: 无限):" ssr_speed_limit_per_con
[[ -z "$ssr_speed_limit_per_con" ]] && ssr_speed_limit_per_con=0 && echo && break
echo $((${ssr_speed_limit_per_con}+0)) &>/dev/null
if [[ $? == 0 ]]; then
if [[ ${ssr_speed_limit_per_con} -ge 1 ]] && [[ ${ssr_speed_limit_per_con} -le 131072 ]]; then
echo && echo ${Separator_1} && echo -e " 单线程限速 : ${Green_font_prefix}${ssr_speed_limit_per_con} KB/S${Font_color_suffix}" && echo ${Separator_1} && echo
break
else
echo -e "${Error} 请输入正确的数字(1-131072)"
fi
else
echo -e "${Error} 请输入正确的数字(1-131072)"
fi
done
}
Set_config_speed_limit_per_user(){
while true
do
echo
echo -e "请输入要设置的每个端口 总速度 限速上限(单位:KB/S)"
echo -e "${Tip} 端口总限速:每个端口 总速度 限速上限,单个端口整体限速。"
read -e -p "(默认: 无限):" ssr_speed_limit_per_user
[[ -z "$ssr_speed_limit_per_user" ]] && ssr_speed_limit_per_user=0 && echo && break
echo $((${ssr_speed_limit_per_user}+0)) &>/dev/null
if [[ $? == 0 ]]; then
if [[ ${ssr_speed_limit_per_user} -ge 1 ]] && [[ ${ssr_speed_limit_per_user} -le 131072 ]]; then
echo && echo ${Separator_1} && echo -e " 端口总限速 : ${Green_font_prefix}${ssr_speed_limit_per_user} KB/S${Font_color_suffix}" && echo ${Separator_1} && echo
break
else
echo -e "${Error} 请输入正确的数字(1-131072)"
fi
else
echo -e "${Error} 请输入正确的数字(1-131072)"
fi
done
}
Set_config_all(){
Set_config_port
Set_config_password
Set_config_method
Set_config_protocol
Set_config_obfs
Set_config_protocol_param
Set_config_speed_limit_per_con
Set_config_speed_limit_per_user
}
# 修改 配置信息
Modify_config_port(){
sed -i 's/"server_port": '"$(echo ${port})"'/"server_port": '"$(echo ${ssr_port})"'/g' ${config_user_file}
}
Modify_config_password(){
sed -i 's/"password": "'"$(echo ${password})"'"/"password": "'"$(echo ${ssr_password})"'"/g' ${config_user_file}
}
Modify_config_method(){
sed -i 's/"method": "'"$(echo ${method})"'"/"method": "'"$(echo ${ssr_method})"'"/g' ${config_user_file}
}
Modify_config_protocol(){
sed -i 's/"protocol": "'"$(echo ${protocol})"'"/"protocol": "'"$(echo ${ssr_protocol})"'"/g' ${config_user_file}
}
Modify_config_obfs(){
sed -i 's/"obfs": "'"$(echo ${obfs})"'"/"obfs": "'"$(echo ${ssr_obfs})"'"/g' ${config_user_file}
}
Modify_config_protocol_param(){
sed -i 's/"protocol_param": "'"$(echo ${protocol_param})"'"/"protocol_param": "'"$(echo ${ssr_protocol_param})"'"/g' ${config_user_file}
}
Modify_config_speed_limit_per_con(){
sed -i 's/"speed_limit_per_con": '"$(echo ${speed_limit_per_con})"'/"speed_limit_per_con": '"$(echo ${ssr_speed_limit_per_con})"'/g' ${config_user_file}
}
Modify_config_speed_limit_per_user(){
sed -i 's/"speed_limit_per_user": '"$(echo ${speed_limit_per_user})"'/"speed_limit_per_user": '"$(echo ${ssr_speed_limit_per_user})"'/g' ${config_user_file}
}
Modify_config_connect_verbose_info(){
sed -i 's/"connect_verbose_info": '"$(echo ${connect_verbose_info})"'/"connect_verbose_info": '"$(echo ${ssr_connect_verbose_info})"'/g' ${config_user_file}
}
Modify_config_all(){
Modify_config_port
Modify_config_password
Modify_config_method
Modify_config_protocol
Modify_config_obfs
Modify_config_protocol_param
Modify_config_speed_limit_per_con
Modify_config_speed_limit_per_user
}
Modify_config_port_many(){
sed -i 's/"'"$(echo ${port})"'":/"'"$(echo ${ssr_port})"'":/g' ${config_user_file}
}
Modify_config_password_many(){
sed -i 's/"'"$(echo ${password})"'"/"'"$(echo ${ssr_password})"'"/g' ${config_user_file}
}
# 写入 配置信息
Write_configuration(){
cat > ${config_user_file}<<-EOF
{
"server": "0.0.0.0",
"server_ipv6": "::",
"server_port": ${ssr_port},
"local_address": "127.0.0.1",
"local_port": 1080,

"password": "${ssr_password}",
"method": "${ssr_method}",
"protocol": "${ssr_protocol}",
"protocol_param": "${ssr_protocol_param}",
"obfs": "${ssr_obfs}",
"obfs_param": "",
"speed_limit_per_con": ${ssr_speed_limit_per_con},
"speed_limit_per_user": ${ssr_speed_limit_per_user},

"additional_ports" : {},
"timeout": 120,
"udp_timeout": 60,
"dns_ipv6": false,
"connect_verbose_info": 0,
"redirect": "",
"fast_open": false
}
EOF
}
Write_configuration_many(){
cat > ${config_user_file}<<-EOF
{
"server": "0.0.0.0",
"server_ipv6": "::",
"local_address": "127.0.0.1",
"local_port": 1080,

"port_password":{
"${ssr_port}":"${ssr_password}"
},
"method": "${ssr_method}",
"protocol": "${ssr_protocol}",
"protocol_param": "${ssr_protocol_param}",
"obfs": "${ssr_obfs}",
"obfs_param": "",
"speed_limit_per_con": ${ssr_speed_limit_per_con},
"speed_limit_per_user": ${ssr_speed_limit_per_user},

"additional_ports" : {},
"timeout": 120,
"udp_timeout": 60,
"dns_ipv6": false,
"connect_verbose_info": 0,
"redirect": "",
"fast_open": false
}
EOF
}
Check_python(){
python_ver=`python -h`
if [[ -z ${python_ver} ]]; then
echo -e "${Info} 没有安装Python,开始安装..."
if [[ ${release} == "centos" ]]; then
yum install -y python
else
apt-get install -y python
fi
fi
}
Centos_yum(){
yum update
cat /etc/redhat-release |grep 7\..*|grep -i centos>/dev/null
if [[ $? = 0 ]]; then
yum install -y vim unzip net-tools
else
yum install -y vim unzip
fi
}
Debian_apt(){
apt-get update
cat /etc/issue |grep 9\..*>/dev/null
if [[ $? = 0 ]]; then
apt-get install -y vim unzip net-tools
else
apt-get install -y vim unzip
fi
}
# 下载 ShadowsocksR
Download_SSR(){
cd "/usr/local/"
wget -N --no-check-certificate "https://github.com/ToyoDAdoubiBackup/shadowsocksr/archive/manyuser.zip"
#git config --global http.sslVerify false
#env GIT_SSL_NO_VERIFY=true git clone -b manyuser https://github.com/ToyoDAdoubiBackup/shadowsocksr.git
#[[ ! -e ${ssr_folder} ]] && echo -e "${Error} ShadowsocksR服务端 下载失败 !" && exit 1
[[ ! -e "manyuser.zip" ]] && echo -e "${Error} ShadowsocksR服务端 压缩包 下载失败 !" && rm -rf manyuser.zip && exit 1
unzip "manyuser.zip"
[[ ! -e "/usr/local/shadowsocksr-manyuser/" ]] && echo -e "${Error} ShadowsocksR服务端 解压失败 !" && rm -rf manyuser.zip && exit 1
mv "/usr/local/shadowsocksr-manyuser/" "/usr/local/shadowsocksr/"
[[ ! -e "/usr/local/shadowsocksr/" ]] && echo -e "${Error} ShadowsocksR服务端 重命名失败 !" && rm -rf manyuser.zip && rm -rf "/usr/local/shadowsocksr-manyuser/" && exit 1
rm -rf manyuser.zip
[[ -e ${config_folder} ]] && rm -rf ${config_folder}
mkdir ${config_folder}
[[ ! -e ${config_folder} ]] && echo -e "${Error} ShadowsocksR配置文件的文件夹 建立失败 !" && exit 1
echo -e "${Info} ShadowsocksR服务端 下载完成 !"
}
Service_SSR(){
if [[ ${release} = "centos" ]]; then
if ! wget --no-check-certificate https://raw.githubusercontent.com/ToyoDAdoubi/doubi/master/service/ssr_centos -O /etc/init.d/ssr; then
echo -e "${Error} ShadowsocksR服务 管理脚本下载失败 !" && exit 1
fi
chmod +x /etc/init.d/ssr
chkconfig --add ssr
chkconfig ssr on
else
if ! wget --no-check-certificate https://raw.githubusercontent.com/ToyoDAdoubi/doubi/master/service/ssr_debian -O /etc/init.d/ssr; then
echo -e "${Error} ShadowsocksR服务 管理脚本下载失败 !" && exit 1
fi
chmod +x /etc/init.d/ssr
update-rc.d -f ssr defaults
fi
echo -e "${Info} ShadowsocksR服务 管理脚本下载完成 !"
}
# 安装 JQ解析器
JQ_install(){
if [[ ! -e ${jq_file} ]]; then
cd "${ssr_folder}"
if [[ ${bit} = "x86_64" ]]; then
mv "jq-linux64" "jq"
#wget --no-check-certificate "https://github.com/stedolan/jq/releases/download/jq-1.5/jq-linux64" -O ${jq_file}
else
mv "jq-linux32" "jq"
#wget --no-check-certificate "https://github.com/stedolan/jq/releases/download/jq-1.5/jq-linux32" -O ${jq_file}
fi
[[ ! -e ${jq_file} ]] && echo -e "${Error} JQ解析器 重命名失败,请检查 !" && exit 1
chmod +x ${jq_file}
echo -e "${Info} JQ解析器 安装完成,继续..."
else
echo -e "${Info} JQ解析器 已安装,继续..."
fi
}
# 安装 依赖
Installation_dependency(){
if [[ ${release} == "centos" ]]; then
Centos_yum
else
Debian_apt
fi
[[ ! -e "/usr/bin/unzip" ]] && echo -e "${Error} 依赖 unzip(解压压缩包) 安装失败,多半是软件包源的问题,请检查 !" && exit 1
Check_python
#echo "nameserver 8.8.8.8" > /etc/resolv.conf
#echo "nameserver 8.8.4.4" >> /etc/resolv.conf
\cp -f /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
}
Install_SSR(){
check_root
[[ -e ${config_user_file} ]] && echo -e "${Error} ShadowsocksR 配置文件已存在,请检查( 如安装失败或者存在旧版本,请先卸载 ) !" && exit 1
[[ -e ${ssr_folder} ]] && echo -e "${Error} ShadowsocksR 文件夹已存在,请检查( 如安装失败或者存在旧版本,请先卸载 ) !" && exit 1
echo -e "${Info} 开始设置 ShadowsocksR账号配置..."
Set_config_all
echo -e "${Info} 开始安装/配置 ShadowsocksR依赖..."
Installation_dependency
echo -e "${Info} 开始下载/安装 ShadowsocksR文件..."
Download_SSR
echo -e "${Info} 开始下载/安装 ShadowsocksR服务脚本(init)..."
Service_SSR
echo -e "${Info} 开始下载/安装 JSNO解析器 JQ..."
JQ_install
echo -e "${Info} 开始写入 ShadowsocksR配置文件..."
Write_configuration
echo -e "${Info} 开始设置 iptables防火墙..."
Set_iptables
echo -e "${Info} 开始添加 iptables防火墙规则..."
Add_iptables
echo -e "${Info} 开始保存 iptables防火墙规则..."
Save_iptables
echo -e "${Info} 所有步骤 安装完毕,开始启动 ShadowsocksR服务端..."
Start_SSR
}
Update_SSR(){
SSR_installation_status
echo -e "因破娃暂停更新ShadowsocksR服务端,所以此功能临时禁用。"
#cd ${ssr_folder}
#git pull
#Restart_SSR
}
Uninstall_SSR(){
[[ ! -e ${config_user_file} ]] && [[ ! -e ${ssr_folder} ]] && echo -e "${Error} 没有安装 ShadowsocksR,请检查 !" && exit 1
echo "确定要 卸载ShadowsocksR?[y/N]" && echo
read -e -p "(默认: n):" unyn
[[ -z ${unyn} ]] && unyn="n"
if [[ ${unyn} == [Yy] ]]; then
check_pid
[[ ! -z "${PID}" ]] && kill -9 ${PID}
if [[ -z "${now_mode}" ]]; then
port=`${jq_file} '.server_port' ${config_user_file}`
Del_iptables
Save_iptables
else
user_total=`${jq_file} '.port_password' ${config_user_file} | sed '$d' | sed "1d" | wc -l`
for((integer = 1; integer <= ${user_total}; integer++))
do
port=`${jq_file} '.port_password' ${config_user_file} | sed '$d' | sed "1d" | awk -F ":" '{print $1}' | sed -n "${integer}p" | sed -r 's/.*\"(.+)\".*/\1/'`
Del_iptables
done
Save_iptables
fi
if [[ ${release} = "centos" ]]; then
chkconfig --del ssr
else
update-rc.d -f ssr remove
fi
rm -rf ${ssr_folder} && rm -rf ${config_folder} && rm -rf /etc/init.d/ssr
echo && echo " ShadowsocksR 卸载完成 !" && echo
else
echo && echo " 卸载已取消..." && echo
fi
}
Check_Libsodium_ver(){
echo -e "${Info} 开始获取 libsodium 最新版本..."
Libsodiumr_ver=$(wget -qO- "https://github.com/jedisct1/libsodium/tags"|grep "/jedisct1/libsodium/releases/tag/"|head -1|sed -r 's/.*tag\/(.+)\">.*/\1/')
[[ -z ${Libsodiumr_ver} ]] && Libsodiumr_ver=${Libsodiumr_ver_backup}
echo -e "${Info} libsodium 最新版本为 ${Green_font_prefix}${Libsodiumr_ver}${Font_color_suffix} !"
}
Install_Libsodium(){
if [[ -e ${Libsodiumr_file} ]]; then
echo -e "${Error} libsodium 已安装 , 是否覆盖安装(更新)?[y/N]"
read -e -p "(默认: n):" yn
[[ -z ${yn} ]] && yn="n"
if [[ ${yn} == [Nn] ]]; then
echo "已取消..." && exit 1
fi
else
echo -e "${Info} libsodium 未安装,开始安装..."
fi
Check_Libsodium_ver
if [[ ${release} == "centos" ]]; then
yum update
echo -e "${Info} 安装依赖..."
yum -y groupinstall "Development Tools"
echo -e "${Info} 下载..."
wget --no-check-certificate -N "https://github.com/jedisct1/libsodium/releases/download/${Libsodiumr_ver}/libsodium-${Libsodiumr_ver}.tar.gz"
echo -e "${Info} 解压..."
tar -xzf libsodium-${Libsodiumr_ver}.tar.gz && cd libsodium-${Libsodiumr_ver}
echo -e "${Info} 编译安装..."
./configure --disable-maintainer-mode && make -j2 && make install
echo /usr/local/lib > /etc/ld.so.conf.d/usr_local_lib.conf
else
apt-get update
echo -e "${Info} 安装依赖..."
apt-get install -y build-essential
echo -e "${Info} 下载..."
wget --no-check-certificate -N "https://github.com/jedisct1/libsodium/releases/download/${Libsodiumr_ver}/libsodium-${Libsodiumr_ver}.tar.gz"
echo -e "${Info} 解压..."
tar -xzf libsodium-${Libsodiumr_ver}.tar.gz && cd libsodium-${Libsodiumr_ver}
echo -e "${Info} 编译安装..."
./configure --disable-maintainer-mode && make -j2 && make install
fi
ldconfig
cd .. && rm -rf libsodium-${Libsodiumr_ver}.tar.gz && rm -rf libsodium-${Libsodiumr_ver}
[[ ! -e ${Libsodiumr_file} ]] && echo -e "${Error} libsodium 安装失败 !" && exit 1
echo && echo -e "${Info} libsodium 安装成功 !" && echo
}
# 显示 连接信息
debian_View_user_connection_info(){
format_1=$1
if [[ -z "${now_mode}" ]]; then
now_mode="单端口" && user_total="1"
IP_total=`netstat -anp |grep 'ESTABLISHED' |grep 'python' |grep 'tcp6' |awk '{print $5}' |awk -F ":" '{print $1}' |sort -u |grep -E -o "([0-9]{1,3}[\.]){3}[0-9]{1,3}" |wc -l`
user_port=`${jq_file} '.server_port' ${config_user_file}`
user_IP_1=`netstat -anp |grep 'ESTABLISHED' |grep 'python' |grep 'tcp6' |grep ":${user_port} " |awk '{print $5}' |awk -F ":" '{print $1}' |sort -u |grep -E -o "([0-9]{1,3}[\.]){3}[0-9]{1,3}" `
if [[ -z ${user_IP_1} ]]; then
user_IP_total="0"
else
user_IP_total=`echo -e "${user_IP_1}"|wc -l`
if [[ ${format_1} == "IP_address" ]]; then
get_IP_address
else
user_IP=`echo -e "\n${user_IP_1}"`
fi
fi
user_list_all="端口: ${Green_font_prefix}"${user_port}"${Font_color_suffix}\t 链接IP总数: ${Green_font_prefix}"${user_IP_total}"${Font_color_suffix}\t 当前链接IP: ${Green_font_prefix}${user_IP}${Font_color_suffix}\n"
user_IP=""
echo -e "当前模式: ${Green_background_prefix} "${now_mode}" ${Font_color_suffix} 链接IP总数: ${Green_background_prefix} "${IP_total}" ${Font_color_suffix}"
echo -e "${user_list_all}"
else
now_mode="多端口" && user_total=`${jq_file} '.port_password' ${config_user_file} |sed '$d;1d' | wc -l`
IP_total=`netstat -anp |grep 'ESTABLISHED' |grep 'python' |grep 'tcp6' |awk '{print $5}' |awk -F ":" '{print $1}' |sort -u |grep -E -o "([0-9]{1,3}[\.]){3}[0-9]{1,3}" |wc -l`
user_list_all=""
for((integer = ${user_total}; integer >= 1; integer--))
do
user_port=`${jq_file} '.port_password' ${config_user_file} |sed '$d;1d' |awk -F ":" '{print $1}' |sed -n "${integer}p" |sed -r 's/.*\"(.+)\".*/\1/'`
user_IP_1=`netstat -anp |grep 'ESTABLISHED' |grep 'python' |grep 'tcp6' |grep "${user_port}" |awk '{print $5}' |awk -F ":" '{print $1}' |sort -u |grep -E -o "([0-9]{1,3}[\.]){3}[0-9]{1,3}"`
if [[ -z ${user_IP_1} ]]; then
user_IP_total="0"
else
user_IP_total=`echo -e "${user_IP_1}"|wc -l`
if [[ ${format_1} == "IP_address" ]]; then
get_IP_address
else
user_IP=`echo -e "\n${user_IP_1}"`
fi
fi
user_list_all=${user_list_all}"端口: ${Green_font_prefix}"${user_port}"${Font_color_suffix}\t 链接IP总数: ${Green_font_prefix}"${user_IP_total}"${Font_color_suffix}\t 当前链接IP: ${Green_font_prefix}${user_IP}${Font_color_suffix}\n"
user_IP=""
done
echo -e "当前模式: ${Green_background_prefix} "${now_mode}" ${Font_color_suffix} 用户总数: ${Green_background_prefix} "${user_total}" ${Font_color_suffix} 链接IP总数: ${Green_background_prefix} "${IP_total}" ${Font_color_suffix} "
echo -e "${user_list_all}"
fi
}
centos_View_user_connection_info(){
format_1=$1
if [[ -z "${now_mode}" ]]; then
now_mode="单端口" && user_total="1"
IP_total=`netstat -anp |grep 'ESTABLISHED' |grep 'python' |grep 'tcp' |grep '::ffff:' |awk '{print $5}' |awk -F ":" '{print $4}' |sort -u |grep -E -o "([0-9]{1,3}[\.]){3}[0-9]{1,3}" |wc -l`
user_port=`${jq_file} '.server_port' ${config_user_file}`
user_IP_1=`netstat -anp |grep 'ESTABLISHED' |grep 'python' |grep 'tcp' |grep ":${user_port} " | grep '::ffff:' |awk '{print $5}' |awk -F ":" '{print $4}' |sort -u |grep -E -o "([0-9]{1,3}[\.]){3}[0-9]{1,3}"`
if [[ -z ${user_IP_1} ]]; then
user_IP_total="0"
else
user_IP_total=`echo -e "${user_IP_1}"|wc -l`
if [[ ${format_1} == "IP_address" ]]; then
get_IP_address
else
user_IP=`echo -e "\n${user_IP_1}"`
fi
fi
user_list_all="端口: ${Green_font_prefix}"${user_port}"${Font_color_suffix}\t 链接IP总数: ${Green_font_prefix}"${user_IP_total}"${Font_color_suffix}\t 当前链接IP: ${Green_font_prefix}${user_IP}${Font_color_suffix}\n"
user_IP=""
echo -e "当前模式: ${Green_background_prefix} "${now_mode}" ${Font_color_suffix} 链接IP总数: ${Green_background_prefix} "${IP_total}" ${Font_color_suffix}"
echo -e "${user_list_all}"
else
now_mode="多端口" && user_total=`${jq_file} '.port_password' ${config_user_file} |sed '$d;1d' | wc -l`
IP_total=`netstat -anp |grep 'ESTABLISHED' |grep 'python' |grep 'tcp' | grep '::ffff:' |awk '{print $5}' |awk -F ":" '{print $4}' |sort -u |grep -E -o "([0-9]{1,3}[\.]){3}[0-9]{1,3}" |wc -l`
user_list_all=""
for((integer = 1; integer <= ${user_total}; integer++))
do
user_port=`${jq_file} '.port_password' ${config_user_file} |sed '$d;1d' |awk -F ":" '{print $1}' |sed -n "${integer}p" |sed -r 's/.*\"(.+)\".*/\1/'`
user_IP_1=`netstat -anp |grep 'ESTABLISHED' |grep 'python' |grep 'tcp' |grep "${user_port}"|grep '::ffff:' |awk '{print $5}' |awk -F ":" '{print $4}' |sort -u |grep -E -o "([0-9]{1,3}[\.]){3}[0-9]{1,3}" `
if [[ -z ${user_IP_1} ]]; then
user_IP_total="0"
else
user_IP_total=`echo -e "${user_IP_1}"|wc -l`
if [[ ${format_1} == "IP_address" ]]; then
get_IP_address
else
user_IP=`echo -e "\n${user_IP_1}"`
fi
fi
user_list_all=${user_list_all}"端口: ${Green_font_prefix}"${user_port}"${Font_color_suffix}\t 链接IP总数: ${Green_font_prefix}"${user_IP_total}"${Font_color_suffix}\t 当前链接IP: ${Green_font_prefix}${user_IP}${Font_color_suffix}\n"
user_IP=""
done
echo -e "当前模式: ${Green_background_prefix} "${now_mode}" ${Font_color_suffix} 用户总数: ${Green_background_prefix} "${user_total}" ${Font_color_suffix} 链接IP总数: ${Green_background_prefix} "${IP_total}" ${Font_color_suffix} "
echo -e "${user_list_all}"
fi
}
View_user_connection_info(){
SSR_installation_status
echo && echo -e "请选择要显示的格式:
${Green_font_prefix}1.${Font_color_suffix} 显示 IP 格式
${Green_font_prefix}2.${Font_color_suffix} 显示 IP+IP归属地 格式" && echo
read -e -p "(默认: 1):" ssr_connection_info
[[ -z "${ssr_connection_info}" ]] && ssr_connection_info="1"
if [[ ${ssr_connection_info} == "1" ]]; then
View_user_connection_info_1 ""
elif [[ ${ssr_connection_info} == "2" ]]; then
echo -e "${Tip} 检测IP归属地(ipip.net),如果IP较多,可能时间会比较长..."
View_user_connection_info_1 "IP_address"
else
echo -e "${Error} 请输入正确的数字(1-2)" && exit 1
fi
}
View_user_connection_info_1(){
format=$1
if [[ ${release} = "centos" ]]; then
cat /etc/redhat-release |grep 7\..*|grep -i centos>/dev/null
if [[ $? = 0 ]]; then
debian_View_user_connection_info "$format"
else
centos_View_user_connection_info "$format"
fi
else
debian_View_user_connection_info "$format"
fi
}
get_IP_address(){
#echo "user_IP_1=${user_IP_1}"
if [[ ! -z ${user_IP_1} ]]; then
#echo "user_IP_total=${user_IP_total}"
for((integer_1 = ${user_IP_total}; integer_1 >= 1; integer_1--))
do
IP=`echo "${user_IP_1}" |sed -n "$integer_1"p`
#echo "IP=${IP}"
IP_address=`wget -qO- -t1 -T2 http://freeapi.ipip.net/${IP}|sed 's/\"//g;s/,//g;s/\[//g;s/\]//g'`
#echo "IP_address=${IP_address}"
user_IP="${user_IP}\n${IP}(${IP_address})"
#echo "user_IP=${user_IP}"
sleep 1s
done
fi
}
# 修改 用户配置
Modify_Config(){
SSR_installation_status
if [[ -z "${now_mode}" ]]; then
echo && echo -e "当前模式: 单端口,你要做什么?
${Green_font_prefix}1.${Font_color_suffix} 修改 用户端口
${Green_font_prefix}2.${Font_color_suffix} 修改 用户密码
${Green_font_prefix}3.${Font_color_suffix} 修改 加密方式
${Green_font_prefix}4.${Font_color_suffix} 修改 协议插件
${Green_font_prefix}5.${Font_color_suffix} 修改 混淆插件
${Green_font_prefix}6.${Font_color_suffix} 修改 设备数限制
${Green_font_prefix}7.${Font_color_suffix} 修改 单线程限速
${Green_font_prefix}8.${Font_color_suffix} 修改 端口总限速
${Green_font_prefix}9.${Font_color_suffix} 修改 全部配置" && echo
read -e -p "(默认: 取消):" ssr_modify
[[ -z "${ssr_modify}" ]] && echo "已取消..." && exit 1
Get_User
if [[ ${ssr_modify} == "1" ]]; then
Set_config_port
Modify_config_port
Add_iptables
Del_iptables
Save_iptables
elif [[ ${ssr_modify} == "2" ]]; then
Set_config_password
Modify_config_password
elif [[ ${ssr_modify} == "3" ]]; then
Set_config_method
Modify_config_method
elif [[ ${ssr_modify} == "4" ]]; then
Set_config_protocol
Modify_config_protocol
elif [[ ${ssr_modify} == "5" ]]; then
Set_config_obfs
Modify_config_obfs
elif [[ ${ssr_modify} == "6" ]]; then
Set_config_protocol_param
Modify_config_protocol_param
elif [[ ${ssr_modify} == "7" ]]; then
Set_config_speed_limit_per_con
Modify_config_speed_limit_per_con
elif [[ ${ssr_modify} == "8" ]]; then
Set_config_speed_limit_per_user
Modify_config_speed_limit_per_user
elif [[ ${ssr_modify} == "9" ]]; then
Set_config_all
Modify_config_all
else
echo -e "${Error} 请输入正确的数字(1-9)" && exit 1
fi
else
echo && echo -e "当前模式: 多端口,你要做什么?
${Green_font_prefix}1.${Font_color_suffix} 添加 用户配置
${Green_font_prefix}2.${Font_color_suffix} 删除 用户配置
${Green_font_prefix}3.${Font_color_suffix} 修改 用户配置
——————————
${Green_font_prefix}4.${Font_color_suffix} 修改 加密方式
${Green_font_prefix}5.${Font_color_suffix} 修改 协议插件
${Green_font_prefix}6.${Font_color_suffix} 修改 混淆插件
${Green_font_prefix}7.${Font_color_suffix} 修改 设备数限制
${Green_font_prefix}8.${Font_color_suffix} 修改 单线程限速
${Green_font_prefix}9.${Font_color_suffix} 修改 端口总限速
${Green_font_prefix}10.${Font_color_suffix} 修改 全部配置" && echo
read -e -p "(默认: 取消):" ssr_modify
[[ -z "${ssr_modify}" ]] && echo "已取消..." && exit 1
Get_User
if [[ ${ssr_modify} == "1" ]]; then
Add_multi_port_user
elif [[ ${ssr_modify} == "2" ]]; then
Del_multi_port_user
elif [[ ${ssr_modify} == "3" ]]; then
Modify_multi_port_user
elif [[ ${ssr_modify} == "4" ]]; then
Set_config_method
Modify_config_method
elif [[ ${ssr_modify} == "5" ]]; then
Set_config_protocol
Modify_config_protocol
elif [[ ${ssr_modify} == "6" ]]; then
Set_config_obfs
Modify_config_obfs
elif [[ ${ssr_modify} == "7" ]]; then
Set_config_protocol_param
Modify_config_protocol_param
elif [[ ${ssr_modify} == "8" ]]; then
Set_config_speed_limit_per_con
Modify_config_speed_limit_per_con
elif [[ ${ssr_modify} == "9" ]]; then
Set_config_speed_limit_per_user
Modify_config_speed_limit_per_user
elif [[ ${ssr_modify} == "10" ]]; then
Set_config_method
Set_config_protocol
Set_config_obfs
Set_config_protocol_param
Set_config_speed_limit_per_con
Set_config_speed_limit_per_user
Modify_config_method
Modify_config_protocol
Modify_config_obfs
Modify_config_protocol_param
Modify_config_speed_limit_per_con
Modify_config_speed_limit_per_user
else
echo -e "${Error} 请输入正确的数字(1-9)" && exit 1
fi
fi
Restart_SSR
}
# 显示 多端口用户配置
List_multi_port_user(){
user_total=`${jq_file} '.port_password' ${config_user_file} | sed '$d' | sed "1d" | wc -l`
[[ ${user_total} = "0" ]] && echo -e "${Error} 没有发现 多端口用户,请检查 !" && exit 1
user_list_all=""
for((integer = ${user_total}; integer >= 1; integer--))
do
user_port=`${jq_file} '.port_password' ${config_user_file} | sed '$d' | sed "1d" | awk -F ":" '{print $1}' | sed -n "${integer}p" | sed -r 's/.*\"(.+)\".*/\1/'`
user_password=`${jq_file} '.port_password' ${config_user_file} | sed '$d' | sed "1d" | awk -F ":" '{print $2}' | sed -n "${integer}p" | sed -r 's/.*\"(.+)\".*/\1/'`
user_list_all=${user_list_all}"端口: "${user_port}" 密码: "${user_password}"\n"
done
echo && echo -e "用户总数 ${Green_font_prefix}"${user_total}"${Font_color_suffix}"
echo -e ${user_list_all}
}
# 添加 多端口用户配置
Add_multi_port_user(){
Set_config_port
Set_config_password
sed -i "8 i \" \"${ssr_port}\":\"${ssr_password}\"," ${config_user_file}
sed -i "8s/^\"//" ${config_user_file}
Add_iptables
Save_iptables
echo -e "${Info} 多端口用户添加完成 ${Green_font_prefix}[端口: ${ssr_port} , 密码: ${ssr_password}]${Font_color_suffix} "
}
# 修改 多端口用户配置
Modify_multi_port_user(){
List_multi_port_user
echo && echo -e "请输入要修改的用户端口"
read -e -p "(默认: 取消):" modify_user_port
[[ -z "${modify_user_port}" ]] && echo -e "已取消..." && exit 1
del_user=`cat ${config_user_file}|grep '"'"${modify_user_port}"'"'`
if [[ ! -z "${del_user}" ]]; then
port="${modify_user_port}"
password=`echo -e ${del_user}|awk -F ":" '{print $NF}'|sed -r 's/.*\"(.+)\".*/\1/'`
Set_config_port
Set_config_password
sed -i 's/"'$(echo ${port})'":"'$(echo ${password})'"/"'$(echo ${ssr_port})'":"'$(echo ${ssr_password})'"/g' ${config_user_file}
Del_iptables
Add_iptables
Save_iptables
echo -e "${Inof} 多端口用户修改完成 ${Green_font_prefix}[旧: ${modify_user_port} ${password} , 新: ${ssr_port} ${ssr_password}]${Font_color_suffix} "
else
echo -e "${Error} 请输入正确的端口 !" && exit 1
fi
}
# 删除 多端口用户配置
Del_multi_port_user(){
List_multi_port_user
user_total=`${jq_file} '.port_password' ${config_user_file} | sed '$d' | sed "1d" | wc -l`
[[ "${user_total}" = "1" ]] && echo -e "${Error} 多端口用户仅剩 1个,不能删除 !" && exit 1
echo -e "请输入要删除的用户端口"
read -e -p "(默认: 取消):" del_user_port
[[ -z "${del_user_port}" ]] && echo -e "已取消..." && exit 1
del_user=`cat ${config_user_file}|grep '"'"${del_user_port}"'"'`
if [[ ! -z ${del_user} ]]; then
port=${del_user_port}
Del_iptables
Save_iptables
del_user_determine=`echo ${del_user:((${#del_user} - 1))}`
if [[ ${del_user_determine} != "," ]]; then
del_user_num=$(sed -n -e "/${port}/=" ${config_user_file})
echo $((${ssr_protocol_param}+0)) &>/dev/null
del_user_num=$(echo $((${del_user_num}-1)))
sed -i "${del_user_num}s/,//g" ${config_user_file}
fi
sed -i "/${port}/d" ${config_user_file}
echo -e "${Info} 多端口用户删除完成 ${Green_font_prefix} ${del_user_port} ${Font_color_suffix} "
else
echo "${Error} 请输入正确的端口 !" && exit 1
fi
}
# 手动修改 用户配置
Manually_Modify_Config(){
SSR_installation_status
port=`${jq_file} '.server_port' ${config_user_file}`
vi ${config_user_file}
if [[ -z "${now_mode}" ]]; then
ssr_port=`${jq_file} '.server_port' ${config_user_file}`
Del_iptables
Add_iptables
fi
Restart_SSR
}
# 切换端口模式
Port_mode_switching(){
SSR_installation_status
if [[ -z "${now_mode}" ]]; then
echo && echo -e " 当前模式: ${Green_font_prefix}单端口${Font_color_suffix}" && echo
echo -e "确定要切换为 多端口模式?[y/N]"
read -e -p "(默认: n):" mode_yn
[[ -z ${mode_yn} ]] && mode_yn="n"
if [[ ${mode_yn} == [Yy] ]]; then
port=`${jq_file} '.server_port' ${config_user_file}`
Set_config_all
Write_configuration_many
Del_iptables
Add_iptables
Save_iptables
Restart_SSR
else
echo && echo " 已取消..." && echo
fi
else
echo && echo -e " 当前模式: ${Green_font_prefix}多端口${Font_color_suffix}" && echo
echo -e "确定要切换为 单端口模式?[y/N]"
read -e -p "(默认: n):" mode_yn
[[ -z ${mode_yn} ]] && mode_yn="n"
if [[ ${mode_yn} == [Yy] ]]; then
user_total=`${jq_file} '.port_password' ${config_user_file} | sed '$d' | sed "1d" | wc -l`
for((integer = 1; integer <= ${user_total}; integer++))
do
port=`${jq_file} '.port_password' ${config_user_file} | sed '$d' | sed "1d" | awk -F ":" '{print $1}' | sed -n "${integer}p" | sed -r 's/.*\"(.+)\".*/\1/'`
Del_iptables
done
Set_config_all
Write_configuration
Add_iptables
Restart_SSR
else
echo && echo " 已取消..." && echo
fi
fi
}
Start_SSR(){
SSR_installation_status
check_pid
[[ ! -z ${PID} ]] && echo -e "${Error} ShadowsocksR 正在运行 !" && exit 1
/etc/init.d/ssr start
check_pid
[[ ! -z ${PID} ]] && View_User
}
Stop_SSR(){
SSR_installation_status
check_pid
[[ -z ${PID} ]] && echo -e "${Error} ShadowsocksR 未运行 !" && exit 1
/etc/init.d/ssr stop
}
Restart_SSR(){
SSR_installation_status
check_pid
[[ ! -z ${PID} ]] && /etc/init.d/ssr stop
/etc/init.d/ssr start
check_pid
[[ ! -z ${PID} ]] && View_User
}
View_Log(){
SSR_installation_status
[[ ! -e ${ssr_log_file} ]] && echo -e "${Error} ShadowsocksR日志文件不存在 !" && exit 1
echo && echo -e "${Tip}${Red_font_prefix}Ctrl+C${Font_color_suffix} 终止查看日志" && echo -e "如果需要查看完整日志内容,请用 ${Red_font_prefix}cat ${ssr_log_file}${Font_color_suffix} 命令。" && echo
tail -f ${ssr_log_file}
}
# 锐速
Configure_Server_Speeder(){
echo && echo -e "你要做什么?
${Green_font_prefix}1.${Font_color_suffix} 安装 锐速
${Green_font_prefix}2.${Font_color_suffix} 卸载 锐速
————————
${Green_font_prefix}3.${Font_color_suffix} 启动 锐速
${Green_font_prefix}4.${Font_color_suffix} 停止 锐速
${Green_font_prefix}5.${Font_color_suffix} 重启 锐速
${Green_font_prefix}6.${Font_color_suffix} 查看 锐速 状态

注意: 锐速和LotServer不能同时安装/启动!" && echo
read -e -p "(默认: 取消):" server_speeder_num
[[ -z "${server_speeder_num}" ]] && echo "已取消..." && exit 1
if [[ ${server_speeder_num} == "1" ]]; then
Install_ServerSpeeder
elif [[ ${server_speeder_num} == "2" ]]; then
Server_Speeder_installation_status
Uninstall_ServerSpeeder
elif [[ ${server_speeder_num} == "3" ]]; then
Server_Speeder_installation_status
${Server_Speeder_file} start
${Server_Speeder_file} status
elif [[ ${server_speeder_num} == "4" ]]; then
Server_Speeder_installation_status
${Server_Speeder_file} stop
elif [[ ${server_speeder_num} == "5" ]]; then
Server_Speeder_installation_status
${Server_Speeder_file} restart
${Server_Speeder_file} status
elif [[ ${server_speeder_num} == "6" ]]; then
Server_Speeder_installation_status
${Server_Speeder_file} status
else
echo -e "${Error} 请输入正确的数字(1-6)" && exit 1
fi
}
Install_ServerSpeeder(){
[[ -e ${Server_Speeder_file} ]] && echo -e "${Error} 锐速(Server Speeder) 已安装 !" && exit 1
cd /root
#借用91yun.rog的开心版锐速
wget -N --no-check-certificate https://raw.githubusercontent.com/91yun/serverspeeder/master/serverspeeder.sh
[[ ! -e "serverspeeder.sh" ]] && echo -e "${Error} 锐速安装脚本下载失败 !" && exit 1
bash serverspeeder.sh
sleep 2s
PID=`ps -ef |grep -v grep |grep "serverspeeder" |awk '{print $2}'`
if [[ ! -z ${PID} ]]; then
rm -rf /root/serverspeeder.sh
rm -rf /root/91yunserverspeeder
rm -rf /root/91yunserverspeeder.tar.gz
echo -e "${Info} 锐速(Server Speeder) 安装完成 !" && exit 1
else
echo -e "${Error} 锐速(Server Speeder) 安装失败 !" && exit 1
fi
}
Uninstall_ServerSpeeder(){
echo "确定要卸载 锐速(Server Speeder)?[y/N]" && echo
read -e -p "(默认: n):" unyn
[[ -z ${unyn} ]] && echo && echo "已取消..." && exit 1
if [[ ${unyn} == [Yy] ]]; then
chattr -i /serverspeeder/etc/apx*
/serverspeeder/bin/serverSpeeder.sh uninstall -f
echo && echo "锐速(Server Speeder) 卸载完成 !" && echo
fi
}
# LotServer
Configure_LotServer(){
echo && echo -e "你要做什么?
${Green_font_prefix}1.${Font_color_suffix} 安装 LotServer
${Green_font_prefix}2.${Font_color_suffix} 卸载 LotServer
————————
${Green_font_prefix}3.${Font_color_suffix} 启动 LotServer
${Green_font_prefix}4.${Font_color_suffix} 停止 LotServer
${Green_font_prefix}5.${Font_color_suffix} 重启 LotServer
${Green_font_prefix}6.${Font_color_suffix} 查看 LotServer 状态

注意: 锐速和LotServer不能同时安装/启动!" && echo
read -e -p "(默认: 取消):" lotserver_num
[[ -z "${lotserver_num}" ]] && echo "已取消..." && exit 1
if [[ ${lotserver_num} == "1" ]]; then
Install_LotServer
elif [[ ${lotserver_num} == "2" ]]; then
LotServer_installation_status
Uninstall_LotServer
elif [[ ${lotserver_num} == "3" ]]; then
LotServer_installation_status
${LotServer_file} start
${LotServer_file} status
elif [[ ${lotserver_num} == "4" ]]; then
LotServer_installation_status
${LotServer_file} stop
elif [[ ${lotserver_num} == "5" ]]; then
LotServer_installation_status
${LotServer_file} restart
${LotServer_file} status
elif [[ ${lotserver_num} == "6" ]]; then
LotServer_installation_status
${LotServer_file} status
else
echo -e "${Error} 请输入正确的数字(1-6)" && exit 1
fi
}
Install_LotServer(){
[[ -e ${LotServer_file} ]] && echo -e "${Error} LotServer 已安装 !" && exit 1
#Github: https://github.com/0oVicero0/serverSpeeder_Install
wget --no-check-certificate -qO /tmp/appex.sh "https://raw.githubusercontent.com/0oVicero0/serverSpeeder_Install/master/appex.sh"
[[ ! -e "/tmp/appex.sh" ]] && echo -e "${Error} LotServer 安装脚本下载失败 !" && exit 1
bash /tmp/appex.sh 'install'
sleep 2s
PID=`ps -ef |grep -v grep |grep "appex" |awk '{print $2}'`
if [[ ! -z ${PID} ]]; then
echo -e "${Info} LotServer 安装完成 !" && exit 1
else
echo -e "${Error} LotServer 安装失败 !" && exit 1
fi
}
Uninstall_LotServer(){
echo "确定要卸载 LotServer?[y/N]" && echo
read -e -p "(默认: n):" unyn
[[ -z ${unyn} ]] && echo && echo "已取消..." && exit 1
if [[ ${unyn} == [Yy] ]]; then
wget --no-check-certificate -qO /tmp/appex.sh "https://raw.githubusercontent.com/0oVicero0/serverSpeeder_Install/master/appex.sh" && bash /tmp/appex.sh 'uninstall'
echo && echo "LotServer 卸载完成 !" && echo
fi
}
# BBR
Configure_BBR(){
echo && echo -e " 你要做什么?

${Green_font_prefix}1.${Font_color_suffix} 安装 BBR
————————
${Green_font_prefix}2.${Font_color_suffix} 启动 BBR
${Green_font_prefix}3.${Font_color_suffix} 停止 BBR
${Green_font_prefix}4.${Font_color_suffix} 查看 BBR 状态" && echo
echo -e "${Green_font_prefix} [安装前 请注意] ${Font_color_suffix}
1. 安装开启BBR,需要更换内核,存在更换失败等风险(重启后无法开机)
2. 本脚本仅支持 Debian / Ubuntu 系统更换内核,OpenVZ和Docker 不支持更换内核
3. Debian 更换内核过程中会提示 [ 是否终止卸载内核 ] ,请选择 ${Green_font_prefix} NO ${Font_color_suffix}" && echo
read -e -p "(默认: 取消):" bbr_num
[[ -z "${bbr_num}" ]] && echo "已取消..." && exit 1
if [[ ${bbr_num} == "1" ]]; then
Install_BBR
elif [[ ${bbr_num} == "2" ]]; then
Start_BBR
elif [[ ${bbr_num} == "3" ]]; then
Stop_BBR
elif [[ ${bbr_num} == "4" ]]; then
Status_BBR
else
echo -e "${Error} 请输入正确的数字(1-4)" && exit 1
fi
}
Install_BBR(){
[[ ${release} = "centos" ]] && echo -e "${Error} 本脚本不支持 CentOS系统安装 BBR !" && exit 1
BBR_installation_status
bash "${BBR_file}"
}
Start_BBR(){
BBR_installation_status
bash "${BBR_file}" start
}
Stop_BBR(){
BBR_installation_status
bash "${BBR_file}" stop
}
Status_BBR(){
BBR_installation_status
bash "${BBR_file}" status
}
# 其他功能
Other_functions(){
echo && echo -e " 你要做什么?

${Green_font_prefix}1.${Font_color_suffix} 配置 BBR
${Green_font_prefix}2.${Font_color_suffix} 配置 锐速(ServerSpeeder)
${Green_font_prefix}3.${Font_color_suffix} 配置 LotServer(锐速母公司)
注意: 锐速/LotServer/BBR 不支持 OpenVZ!
注意: 锐速/LotServer/BBR 不能共存!
————————————
${Green_font_prefix}4.${Font_color_suffix} 一键封禁 BT/PT/SPAM (iptables)
${Green_font_prefix}5.${Font_color_suffix} 一键解封 BT/PT/SPAM (iptables)
${Green_font_prefix}6.${Font_color_suffix} 切换 ShadowsocksR日志输出模式
——说明:SSR默认只输出错误日志,此项可切换为输出详细的访问日志" && echo
read -e -p "(默认: 取消):" other_num
[[ -z "${other_num}" ]] && echo "已取消..." && exit 1
if [[ ${other_num} == "1" ]]; then
Configure_BBR
elif [[ ${other_num} == "2" ]]; then
Configure_Server_Speeder
elif [[ ${other_num} == "3" ]]; then
Configure_LotServer
elif [[ ${other_num} == "4" ]]; then
BanBTPTSPAM
elif [[ ${other_num} == "5" ]]; then
UnBanBTPTSPAM
elif [[ ${other_num} == "6" ]]; then
Set_config_connect_verbose_info
else
echo -e "${Error} 请输入正确的数字 [1-6]" && exit 1
fi
}
# 封禁 BT PT SPAM
BanBTPTSPAM(){
wget -N --no-check-certificate https://raw.githubusercontent.com/ToyoDAdoubi/doubi/master/ban_iptables.sh && chmod +x ban_iptables.sh && bash ban_iptables.sh banall
rm -rf ban_iptables.sh
}
# 解封 BT PT SPAM
UnBanBTPTSPAM(){
wget -N --no-check-certificate https://raw.githubusercontent.com/ToyoDAdoubi/doubi/master/ban_iptables.sh && chmod +x ban_iptables.sh && bash ban_iptables.sh unbanall
rm -rf ban_iptables.sh
}
Set_config_connect_verbose_info(){
SSR_installation_status
Get_User
if [[ ${connect_verbose_info} = "0" ]]; then
echo && echo -e "当前日志模式: ${Green_font_prefix}简单模式(只输出错误日志)${Font_color_suffix}" && echo
echo -e "确定要切换为 ${Green_font_prefix}详细模式(输出详细连接日志+错误日志)${Font_color_suffix}?[y/N]"
read -e -p "(默认: n):" connect_verbose_info_ny
[[ -z "${connect_verbose_info_ny}" ]] && connect_verbose_info_ny="n"
if [[ ${connect_verbose_info_ny} == [Yy] ]]; then
ssr_connect_verbose_info="1"
Modify_config_connect_verbose_info
Restart_SSR
else
echo && echo " 已取消..." && echo
fi
else
echo && echo -e "当前日志模式: ${Green_font_prefix}详细模式(输出详细连接日志+错误日志)${Font_color_suffix}" && echo
echo -e "确定要切换为 ${Green_font_prefix}简单模式(只输出错误日志)${Font_color_suffix}?[y/N]"
read -e -p "(默认: n):" connect_verbose_info_ny
[[ -z "${connect_verbose_info_ny}" ]] && connect_verbose_info_ny="n"
if [[ ${connect_verbose_info_ny} == [Yy] ]]; then
ssr_connect_verbose_info="0"
Modify_config_connect_verbose_info
Restart_SSR
else
echo && echo " 已取消..." && echo
fi
fi
}
Update_Shell(){
sh_new_ver=$(wget --no-check-certificate -qO- -t1 -T3 "https://raw.githubusercontent.com/ToyoDAdoubi/doubi/master/ssr.sh"|grep 'sh_ver="'|awk -F "=" '{print $NF}'|sed 's/\"//g'|head -1) && sh_new_type="github"
[[ -z ${sh_new_ver} ]] && echo -e "${Error} 无法链接到 Github !" && exit 0
if [[ -e "/etc/init.d/ssr" ]]; then
rm -rf /etc/init.d/ssr
Service_SSR
fi
wget -N --no-check-certificate "https://raw.githubusercontent.com/ToyoDAdoubi/doubi/master/ssr.sh" && chmod +x ssr.sh
echo -e "脚本已更新为最新版本[ ${sh_new_ver} ] !(注意:因为更新方式为直接覆盖当前运行的脚本,所以可能下面会提示一些报错,无视即可)" && exit 0
}
# 显示 菜单状态
menu_status(){
if [[ -e ${config_user_file} ]]; then
check_pid
if [[ ! -z "${PID}" ]]; then
echo -e " 当前状态: ${Green_font_prefix}已安装${Font_color_suffix}${Green_font_prefix}已启动${Font_color_suffix}"
else
echo -e " 当前状态: ${Green_font_prefix}已安装${Font_color_suffix}${Red_font_prefix}未启动${Font_color_suffix}"
fi
now_mode=$(cat "${config_user_file}"|grep '"port_password"')
if [[ -z "${now_mode}" ]]; then
echo -e " 当前模式: ${Green_font_prefix}单端口${Font_color_suffix}"
else
echo -e " 当前模式: ${Green_font_prefix}多端口${Font_color_suffix}"
fi
else
echo -e " 当前状态: ${Red_font_prefix}未安装${Font_color_suffix}"
fi
}
check_sys
[[ ${release} != "debian" ]] && [[ ${release} != "ubuntu" ]] && [[ ${release} != "centos" ]] && echo -e "${Error} 本脚本不支持当前系统 ${release} !" && exit 1
echo -e " ShadowsocksR 一键管理脚本 ${Red_font_prefix}[v${sh_ver}]${Font_color_suffix}
---- Toyo | doub.io/ss-jc42 ----

${Green_font_prefix}1.${Font_color_suffix} 安装 ShadowsocksR
${Green_font_prefix}2.${Font_color_suffix} 更新 ShadowsocksR
${Green_font_prefix}3.${Font_color_suffix} 卸载 ShadowsocksR
${Green_font_prefix}4.${Font_color_suffix} 安装 libsodium(chacha20)
————————————
${Green_font_prefix}5.${Font_color_suffix} 查看 账号信息
${Green_font_prefix}6.${Font_color_suffix} 显示 连接信息
${Green_font_prefix}7.${Font_color_suffix} 设置 用户配置
${Green_font_prefix}8.${Font_color_suffix} 手动 修改配置
${Green_font_prefix}9.${Font_color_suffix} 切换 端口模式
————————————
${Green_font_prefix}10.${Font_color_suffix} 启动 ShadowsocksR
${Green_font_prefix}11.${Font_color_suffix} 停止 ShadowsocksR
${Green_font_prefix}12.${Font_color_suffix} 重启 ShadowsocksR
${Green_font_prefix}13.${Font_color_suffix} 查看 ShadowsocksR 日志
————————————
${Green_font_prefix}14.${Font_color_suffix} 其他功能
${Green_font_prefix}15.${Font_color_suffix} 升级脚本
"
menu_status
echo && read -e -p "请输入数字 [1-15]:" num
case "$num" in
1)
Install_SSR
;;
2)
Update_SSR
;;
3)
Uninstall_SSR
;;
4)
Install_Libsodium
;;
5)
View_User
;;
6)
View_user_connection_info
;;
7)
Modify_Config
;;
8)
Manually_Modify_Config
;;
9)
Port_mode_switching
;;
10)
Start_SSR
;;
11)
Stop_SSR
;;
12)
Restart_SSR
;;
13)
View_Log
;;
14)
Other_functions
;;
15)
Update_Shell
;;
*)
echo -e "${Error} 请输入正确的数字 [1-15]"
;;
esac

注:在你安装完成后显示的信息中不要去查看二维码,因为 SS/SSR 链接在你访问 http://doub.pw 查看二维码的时候被服务器记录,以防万一还是不要去访问比较好。。。

安装 BBR

BBR 是一个单边加速工具,能够保持线路稳定。也安装一下,安装完成重启服务器就好。

1
2
3
4
yum -y install wget
wget --no-check-certificate https://github.com/teddysun/across/raw/master/bbr.sh
chmod +x bbr.sh
./bbr.sh

如果上面的链接失效,请将以下 bash 命令复制到 .sh 文件中执行

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
#!/usr/bin/env bash
#
# Auto install latest kernel for TCP BBR
#
# System Required: CentOS 6+, Debian7+, Ubuntu12+
#
# Copyright (C) 2016-2018 Teddysun <[email protected]>
#
# URL: https://teddysun.com/489.html
#

red='\033[0;31m'
green='\033[0;32m'
yellow='\033[0;33m'
plain='\033[0m'

cur_dir=$(pwd)

[[ $EUID -ne 0 ]] && echo -e "${red}Error:${plain} This script must be run as root!" && exit 1

[[ -d "/proc/vz" ]] && echo -e "${red}Error:${plain} Your VPS is based on OpenVZ, which is not supported." && exit 1

if [ -f /etc/redhat-release ]; then
release="centos"
elif cat /etc/issue | grep -Eqi "debian"; then
release="debian"
elif cat /etc/issue | grep -Eqi "ubuntu"; then
release="ubuntu"
elif cat /etc/issue | grep -Eqi "centos|red hat|redhat"; then
release="centos"
elif cat /proc/version | grep -Eqi "debian"; then
release="debian"
elif cat /proc/version | grep -Eqi "ubuntu"; then
release="ubuntu"
elif cat /proc/version | grep -Eqi "centos|red hat|redhat"; then
release="centos"
else
release=""
fi

is_digit(){
local input=${1}
if [[ "$input" =~ ^[0-9]+$ ]]; then
return 0
else
return 1
fi
}

get_valid_valname(){
local val=${1}
local new_val=$(eval echo $val | sed 's/[-.]/_/g')
echo ${new_val}
}

get_hint(){
local val=${1}
local new_val=$(get_valid_valname $val)
eval echo "\$hint_${new_val}"
}

#Display Memu
display_menu(){
local soft=${1}
local default=${2}
eval local arr=(\${${soft}_arr[@]})
local default_prompt
if [[ "$default" != "" ]]; then
if [[ "$default" == "last" ]]; then
default=${#arr[@]}
fi
default_prompt="(default ${arr[$default-1]})"
fi
local pick
local hint
local vname
local prompt="which ${soft} you'd select ${default_prompt}: "

while :
do
echo -e "\n------------ ${soft} setting ------------\n"
for ((i=1;i<=${#arr[@]};i++ )); do
vname="$(get_valid_valname ${arr[$i-1]})"
hint="$(get_hint $vname)"
[[ "$hint" == "" ]] && hint="${arr[$i-1]}"
echo -e "${green}${i}${plain}) $hint"
done
echo
read -p "${prompt}" pick
if [[ "$pick" == "" && "$default" != "" ]]; then
pick=${default}
break
fi

if ! is_digit "$pick"; then
prompt="Input error, please input a number"
continue
fi

if [[ "$pick" -lt 1 || "$pick" -gt ${#arr[@]} ]]; then
prompt="Input error, please input a number between 1 and ${#arr[@]}: "
continue
fi

break
done

eval ${soft}=${arr[$pick-1]}
vname="$(get_valid_valname ${arr[$pick-1]})"
hint="$(get_hint $vname)"
[[ "$hint" == "" ]] && hint="${arr[$pick-1]}"
echo -e "\nyour selection: $hint\n"
}

version_ge(){
test "$(echo "[email protected]" | tr " " "\n" | sort -rV | head -n 1)" == "$1"
}

get_latest_version() {
latest_version=($(wget -qO- http://kernel.ubuntu.com/~kernel-ppa/mainline/ | awk -F'\"v' '/v[4-9]./{print $2}' | cut -d/ -f1 | grep -v - | sort -V))

[ ${#latest_version[@]} -eq 0 ] && echo -e "${red}Error:${plain} Get latest kernel version failed." && exit 1

kernel_arr=()
for i in ${latest_version[@]}; do
if version_ge $i 4.14; then
kernel_arr+=($i);
fi
done

display_menu kernel last

if [[ `getconf WORD_BIT` == "32" && `getconf LONG_BIT` == "64" ]]; then
deb_name=$(wget -qO- http://kernel.ubuntu.com/~kernel-ppa/mainline/v${kernel}/ | grep "linux-image" | grep "generic" | awk -F'\">' '/amd64.deb/{print $2}' | cut -d'<' -f1 | head -1)
deb_kernel_url="http://kernel.ubuntu.com/~kernel-ppa/mainline/v${kernel}/${deb_name}"
deb_kernel_name="linux-image-${kernel}-amd64.deb"
modules_deb_name=$(wget -qO- http://kernel.ubuntu.com/~kernel-ppa/mainline/v${kernel}/ | grep "linux-modules" | grep "generic" | awk -F'\">' '/amd64.deb/{print $2}' | cut -d'<' -f1 | head -1)
deb_kernel_modules_url="http://kernel.ubuntu.com/~kernel-ppa/mainline/v${kernel}/${modules_deb_name}"
deb_kernel_modules_name="linux-modules-${kernel}-amd64.deb"
else
deb_name=$(wget -qO- http://kernel.ubuntu.com/~kernel-ppa/mainline/v${kernel}/ | grep "linux-image" | grep "generic" | awk -F'\">' '/i386.deb/{print $2}' | cut -d'<' -f1 | head -1)
deb_kernel_url="http://kernel.ubuntu.com/~kernel-ppa/mainline/v${kernel}/${deb_name}"
deb_kernel_name="linux-image-${kernel}-i386.deb"
modules_deb_name=$(wget -qO- http://kernel.ubuntu.com/~kernel-ppa/mainline/v${kernel}/ | grep "linux-modules" | grep "generic" | awk -F'\">' '/i386.deb/{print $2}' | cut -d'<' -f1 | head -1)
deb_kernel_modules_url="http://kernel.ubuntu.com/~kernel-ppa/mainline/v${kernel}/${modules_deb_name}"
deb_kernel_modules_name="linux-modules-${kernel}-i386.deb"
fi

[ -z ${deb_name} ] && echo -e "${red}Error:${plain} Getting Linux kernel binary package name failed, maybe kernel build failed. Please choose other one and try again." && exit 1
}

get_opsy() {
[ -f /etc/redhat-release ] && awk '{print ($1,$3~/^[0-9]/?$3:$4)}' /etc/redhat-release && return
[ -f /etc/os-release ] && awk -F'[= "]' '/PRETTY_NAME/{print $3,$4,$5}' /etc/os-release && return
[ -f /etc/lsb-release ] && awk -F'[="]+' '/DESCRIPTION/{print $2}' /etc/lsb-release && return
}

opsy=$( get_opsy )
arch=$( uname -m )
lbit=$( getconf LONG_BIT )
kern=$( uname -r )

get_char() {
SAVEDSTTY=`stty -g`
stty -echo
stty cbreak
dd if=/dev/tty bs=1 count=1 2> /dev/null
stty -raw
stty echo
stty $SAVEDSTTY
}

getversion() {
if [[ -s /etc/redhat-release ]]; then
grep -oE "[0-9.]+" /etc/redhat-release
else
grep -oE "[0-9.]+" /etc/issue
fi
}

centosversion() {
if [ x"${release}" == x"centos" ]; then
local code=$1
local version="$(getversion)"
local main_ver=${version%%.*}
if [ "$main_ver" == "$code" ]; then
return 0
else
return 1
fi
else
return 1
fi
}

check_bbr_status() {
local param=$(sysctl net.ipv4.tcp_congestion_control | awk '{print $3}')
if [[ x"${param}" == x"bbr" ]]; then
return 0
else
return 1
fi
}

check_kernel_version() {
local kernel_version=$(uname -r | cut -d- -f1)
if version_ge ${kernel_version} 4.9; then
return 0
else
return 1
fi
}

install_elrepo() {

if centosversion 5; then
echo -e "${red}Error:${plain} not supported CentOS 5."
exit 1
fi

rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org

if centosversion 6; then
rpm -Uvh http://www.elrepo.org/elrepo-release-6-8.el6.elrepo.noarch.rpm
elif centosversion 7; then
rpm -Uvh http://www.elrepo.org/elrepo-release-7.0-3.el7.elrepo.noarch.rpm
fi

if [ ! -f /etc/yum.repos.d/elrepo.repo ]; then
echo -e "${red}Error:${plain} Install elrepo failed, please check it."
exit 1
fi
}

sysctl_config() {
sed -i '/net.core.default_qdisc/d' /etc/sysctl.conf
sed -i '/net.ipv4.tcp_congestion_control/d' /etc/sysctl.conf
echo "net.core.default_qdisc = fq" >> /etc/sysctl.conf
echo "net.ipv4.tcp_congestion_control = bbr" >> /etc/sysctl.conf
sysctl -p >/dev/null 2>&1
}

install_config() {
if [[ x"${release}" == x"centos" ]]; then
if centosversion 6; then
if [ ! -f "/boot/grub/grub.conf" ]; then
echo -e "${red}Error:${plain} /boot/grub/grub.conf not found, please check it."
exit 1
fi
sed -i 's/^default=.*/default=0/g' /boot/grub/grub.conf
elif centosversion 7; then
if [ ! -f "/boot/grub2/grub.cfg" ]; then
echo -e "${red}Error:${plain} /boot/grub2/grub.cfg not found, please check it."
exit 1
fi
grub2-set-default 0
fi
elif [[ x"${release}" == x"debian" || x"${release}" == x"ubuntu" ]]; then
/usr/sbin/update-grub
fi
}

reboot_os() {
echo
echo -e "${green}Info:${plain} The system needs to reboot."
read -p "Do you want to restart system? [y/n]" is_reboot
if [[ ${is_reboot} == "y" || ${is_reboot} == "Y" ]]; then
reboot
else
echo -e "${green}Info:${plain} Reboot has been canceled..."
exit 0
fi
}

install_bbr() {
check_bbr_status
if [ $? -eq 0 ]; then
echo
echo -e "${green}Info:${plain} TCP BBR has already been installed. nothing to do..."
exit 0
fi
check_kernel_version
if [ $? -eq 0 ]; then
echo
echo -e "${green}Info:${plain} Your kernel version is greater than 4.9, directly setting TCP BBR..."
sysctl_config
echo -e "${green}Info:${plain} Setting TCP BBR completed..."
exit 0
fi

if [[ x"${release}" == x"centos" ]]; then
install_elrepo
[ ! "$(command -v yum-config-manager)" ] && yum install -y yum-utils > /dev/null 2>&1
[ x"$(yum-config-manager elrepo-kernel | grep -w enabled | awk '{print $3}')" != x"True" ] && yum-config-manager --enable elrepo-kernel > /dev/null 2>&1
yum -y install kernel-ml kernel-ml-devel
if [ $? -ne 0 ]; then
echo -e "${red}Error:${plain} Install latest kernel failed, please check it."
exit 1
fi
elif [[ x"${release}" == x"debian" || x"${release}" == x"ubuntu" ]]; then
[[ ! -e "/usr/bin/wget" ]] && apt-get -y update && apt-get -y install wget
echo -e "${green}Info:${plain} Getting latest kernel version..."
get_latest_version
if [ -n ${modules_deb_name} ]; then
wget -c -t3 -T60 -O ${deb_kernel_modules_name} ${deb_kernel_modules_url}
if [ $? -ne 0 ]; then
echo -e "${red}Error:${plain} Download ${deb_kernel_modules_name} failed, please check it."
exit 1
fi
fi
wget -c -t3 -T60 -O ${deb_kernel_name} ${deb_kernel_url}
if [ $? -ne 0 ]; then
echo -e "${red}Error:${plain} Download ${deb_kernel_name} failed, please check it."
exit 1
fi
[ -f ${deb_kernel_modules_name} ] && dpkg -i ${deb_kernel_modules_name}
dpkg -i ${deb_kernel_name}
rm -f ${deb_kernel_name} ${deb_kernel_modules_name}
else
echo -e "${red}Error:${plain} OS is not be supported, please change to CentOS/Debian/Ubuntu and try again."
exit 1
fi

install_config
sysctl_config
reboot_os
}


clear
echo "---------- System Information ----------"
echo " OS : $opsy"
echo " Arch : $arch ($lbit Bit)"
echo " Kernel : $kern"
echo "----------------------------------------"
echo " Auto install latest kernel for TCP BBR"
echo
echo " URL: https://teddysun.com/489.html"
echo "----------------------------------------"
echo
echo "Press any key to start...or Press Ctrl+C to cancel"
char=`get_char`

install_bbr 2>&1 | tee ${cur_dir}/install_bbr.log

安装 SSR 客户端

GitHub

访问上面的 SSR 的 GitHub 地址,在上面找到你所需要的客户端即可(基本上主流平台都有了)