@@ -384,6 +384,13 @@ create() {
384
384
get info $2
385
385
[[ ! $is_client_id_json ]] && err " ($is_config_name ) 不支持生成客户端配置."
386
386
is_new_json=$( jq ' {outbounds:[{tag:' \" $is_config_name \" ' ,protocol:' \" $is_protocol \" ' ,' " $is_client_id_json " ' ,' " $is_stream " ' }]}' <<< {} )
387
+ if [[ $is_full_client ]]; then
388
+ is_dns=' dns:{servers:[{address:"223.5.5.5",domain:["geosite:cn","geosite:geolocation-cn"],expectIPs:["geoip:cn"]},"1.1.1.1","8.8.8.8"]}'
389
+ is_route=' routing:{rules:[{type:"field",outboundTag:"direct",ip:["geoip:cn","geoip:private"]},{type:"field",outboundTag:"direct",domain:["geosite:cn","geosite:geolocation-cn"]}]}'
390
+ is_inbounds=' inbounds:[{port:2333,listen:"127.0.0.1",protocol:"socks",settings:{udp:true},sniffing:{enabled:true,destOverride:["http","tls"]}}]'
391
+ is_outbounds=' outbounds:[{tag:' \" $is_config_name \" ' ,protocol:' \" $is_protocol \" ' ,' " $is_client_id_json " ' ,' " $is_stream " ' },{tag:"direct",protocol:"freedom"}]'
392
+ is_new_json=$( jq ' {' $is_dns ,$is_route ,$is_inbounds ,$is_outbounds ' }' <<< {} )
393
+ fi
387
394
msg
388
395
jq <<< $is_new_json
389
396
msg
@@ -527,7 +534,7 @@ change() {
527
534
[[ ! $is_new_port ]] && ask string is_new_port " 请输入新端口:"
528
535
if [[ $is_caddy && $host ]]; then
529
536
net=$is_old_net
530
- tlsport =$is_new_port
537
+ is_https_port =$is_new_port
531
538
load caddy.sh
532
539
caddy_config $net
533
540
manage restart caddy &
@@ -974,7 +981,7 @@ add() {
974
981
;;
975
982
kcp | quic)
976
983
kcp_seed=
977
- [[ $( grep tcp <<< $is_new_protocol ) ]] && header_type=
984
+ [[ $( grep -i tcp <<< $is_new_protocol ) ]] && header_type=
978
985
;;
979
986
h2 | ws | grpc)
980
987
old_host=$host
@@ -985,6 +992,7 @@ add() {
985
992
path=/$path
986
993
}
987
994
fi
995
+ [[ ! $( grep -i trojan <<< $is_new_protocol ) ]] && is_trojan=
988
996
;;
989
997
reality)
990
998
[[ ! $( grep -i reality <<< $is_new_protocol ) ]] && is_reality=
@@ -997,7 +1005,7 @@ add() {
997
1005
is_dynamic_port=
998
1006
}
999
1007
1000
- [[ $is_trojan && ! $( is_test uuid $trojan_password ) ]] && uuid=
1008
+ [[ ! $( is_test uuid $uuid ) ]] && uuid=
1001
1009
fi
1002
1010
1003
1011
# no-auto-tls only use h2,ws,grpc
@@ -1075,9 +1083,15 @@ add() {
1075
1083
if [[ ! $is_no_auto_tls && ! $is_caddy && ! $is_gen ]]; then
1076
1084
# test auto tls
1077
1085
[[ $( is_test port_used 80) || $( is_test port_used 443) ]] && {
1078
- warn " 端口 (80 或 443) 已经被占用, 无法完成自动配置 TLS. 请考虑使用 no-auto-tls"
1079
- msg " \e[41m帮助(help)\e[0m: $( msg_ul https://233boy.com/$is_core /no-auto-tls/) \n"
1080
- exit 1
1086
+ get_port
1087
+ is_http_port=$tmp_port
1088
+ get_port
1089
+ is_https_port=$tmp_port
1090
+ warn " 端口 (80 或 443) 已经被占用, 你也可以考虑使用 no-auto-tls"
1091
+ msg " \e[41m no-auto-tls 帮助(help)\e[0m: $( msg_ul https://233boy.com/$is_core /no-auto-tls/) \n"
1092
+ msg " \n Caddy 将使用非标准端口实现自动配置 TLS, HTTP:$is_http_port HTTPS:$is_https_port \n"
1093
+ msg " 请确定是否继续???"
1094
+ pause
1081
1095
}
1082
1096
is_install_caddy=1
1083
1097
fi
@@ -1222,10 +1236,10 @@ get() {
1222
1236
[[ $? != 0 ]] && err " 无法读取动态端口文件: $is_dynamic_port "
1223
1237
fi
1224
1238
if [[ $is_caddy && $host && -f $is_caddy_conf /$host .conf ]]; then
1225
- tmp_tlsport =$( egrep -o " $host :[1-9][0-9]?+" $is_caddy_conf /$host .conf | sed s/.* ://)
1239
+ is_tmp_https_port =$( egrep -o " $host :[1-9][0-9]?+" $is_caddy_conf /$host .conf | sed s/.* ://)
1226
1240
fi
1227
- [[ $tmp_tlsport ]] && tlsport= $tmp_tlsport
1228
- [[ $is_client && $host ]] && port=$tlsport
1241
+ [[ $is_tmp_https_port ]] && is_https_port= $is_tmp_https_port
1242
+ [[ $is_client && $host ]] && port=$is_https_port
1229
1243
get protocol $is_protocol -$net
1230
1244
fi
1231
1245
;;
@@ -1497,19 +1511,18 @@ info() {
1497
1511
is_url_path=serviceName
1498
1512
}
1499
1513
[[ $is_protocol == ' vmess' ]] && {
1500
- is_vmess_url=$( jq -c ' {v:2,ps:' \" 233boy-$net -$host \" ' ,add:' \" $is_addr \" ' ,port:' \" $tlsport \" ' ,id:' \" $uuid \" ' ,aid:"0",net:' \" $net \" ' ,host:' \" $host \" ' ,path:' \" $path \" ' ,tls:' \" tls\" ' }' <<< {} )
1514
+ is_vmess_url=$( jq -c ' {v:2,ps:' \" 233boy-$net -$host \" ' ,add:' \" $is_addr \" ' ,port:' \" $is_https_port \" ' ,id:' \" $uuid \" ' ,aid:"0",net:' \" $net \" ' ,host:' \" $host \" ' ,path:' \" $path \" ' ,tls:' \" tls\" ' }' <<< {} )
1501
1515
is_url=vmess://$( echo -n $is_vmess_url | base64 -w 0)
1502
1516
} || {
1503
1517
[[ $is_trojan ]] && {
1504
1518
uuid=$trojan_password
1505
- is_info_str=($is_protocol $is_addr $tlsport $trojan_password $net $host $path ' tls' )
1506
1519
is_can_change=(0 1 2 3 4)
1507
1520
is_info_show=(0 1 2 10 4 6 7 8)
1508
1521
}
1509
- is_url=" $is_protocol ://$uuid @$host :$tlsport ?encryption=none&security=tls&type=$net &host=$host &${is_url_path} =$( sed ' s#/#%2F#g' <<< $path ) #233boy-$net -$host "
1522
+ is_url=" $is_protocol ://$uuid @$host :$is_https_port ?encryption=none&security=tls&type=$net &host=$host &${is_url_path} =$( sed ' s#/#%2F#g' <<< $path ) #233boy-$net -$host "
1510
1523
}
1511
1524
[[ $is_caddy ]] && is_can_change+=(13)
1512
- is_info_str=($is_protocol $is_addr $tlsport $uuid $net $host $path ' tls' )
1525
+ is_info_str=($is_protocol $is_addr $is_https_port $uuid $net $host $path ' tls' )
1513
1526
;;
1514
1527
reality)
1515
1528
is_color=41
@@ -1546,6 +1559,9 @@ info() {
1546
1559
fi
1547
1560
msg " $a $tt = \e[${is_color} m${is_info_str[$i]} \e[0m"
1548
1561
done
1562
+ if [[ $is_new_install ]]; then
1563
+ warn " 首次安装请查看脚本帮助文档: $( msg_ul https://233boy.com/$is_core /$is_core -script/) "
1564
+ fi
1549
1565
if [[ $is_url ]]; then
1550
1566
msg " ------------- ${info_list[12]} -------------"
1551
1567
msg " \e[4;${is_color} m${is_url} \e[0m"
@@ -1751,6 +1767,7 @@ main() {
1751
1767
change ${@: 2}
1752
1768
;;
1753
1769
client | genc)
1770
+ [[ $1 == ' client' ]] && is_full_client=1
1754
1771
create client $2
1755
1772
;;
1756
1773
d | del | rm)
@@ -1836,7 +1853,14 @@ main() {
1836
1853
is_update_name=sh
1837
1854
is_update_ver=
1838
1855
}
1839
- update $is_update_name $is_update_ver
1856
+ if [[ $2 == ' dat' ]]; then
1857
+ load download.sh
1858
+ download dat
1859
+ msg " $( _green 更新 geoip.dat geosite.dat 成功.) \n"
1860
+ manage restart &
1861
+ else
1862
+ update $is_update_name $is_update_ver
1863
+ fi
1840
1864
;;
1841
1865
ssss | ss2022)
1842
1866
get $@
0 commit comments