@@ -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 &
@@ -978,7 +985,7 @@ add() {
978
985
;;
979
986
kcp | quic)
980
987
kcp_seed=
981
- [[ $( grep tcp <<< $is_new_protocol ) ]] && header_type=
988
+ [[ $( grep -i tcp <<< $is_new_protocol ) ]] && header_type=
982
989
;;
983
990
h2 | ws | grpc)
984
991
old_host=$host
@@ -989,6 +996,7 @@ add() {
989
996
path=/$path
990
997
}
991
998
fi
999
+ [[ ! $( grep -i trojan <<< $is_new_protocol ) ]] && is_trojan=
992
1000
;;
993
1001
reality)
994
1002
[[ ! $( grep -i reality <<< $is_new_protocol ) ]] && is_reality=
@@ -1001,7 +1009,7 @@ add() {
1001
1009
is_dynamic_port=
1002
1010
}
1003
1011
1004
- [[ $is_trojan && ! $( is_test uuid $trojan_password ) ]] && uuid=
1012
+ [[ ! $( is_test uuid $uuid ) ]] && uuid=
1005
1013
fi
1006
1014
1007
1015
# no-auto-tls only use h2,ws,grpc
@@ -1079,9 +1087,15 @@ add() {
1079
1087
if [[ ! $is_no_auto_tls && ! $is_caddy && ! $is_gen ]]; then
1080
1088
# test auto tls
1081
1089
[[ $( is_test port_used 80) || $( is_test port_used 443) ]] && {
1082
- warn " 端口 (80 或 443) 已经被占用, 无法完成自动配置 TLS. 请考虑使用 no-auto-tls"
1083
- msg " \e[41m帮助(help)\e[0m: $( msg_ul https://233boy.com/$is_core /no-auto-tls/) \n"
1084
- exit 1
1090
+ get_port
1091
+ is_http_port=$tmp_port
1092
+ get_port
1093
+ is_https_port=$tmp_port
1094
+ warn " 端口 (80 或 443) 已经被占用, 你也可以考虑使用 no-auto-tls"
1095
+ msg " \e[41m no-auto-tls 帮助(help)\e[0m: $( msg_ul https://233boy.com/$is_core /no-auto-tls/) \n"
1096
+ msg " \n Caddy 将使用非标准端口实现自动配置 TLS, HTTP:$is_http_port HTTPS:$is_https_port \n"
1097
+ msg " 请确定是否继续???"
1098
+ pause
1085
1099
}
1086
1100
is_install_caddy=1
1087
1101
fi
@@ -1226,10 +1240,10 @@ get() {
1226
1240
[[ $? != 0 ]] && err " 无法读取动态端口文件: $is_dynamic_port "
1227
1241
fi
1228
1242
if [[ $is_caddy && $host && -f $is_caddy_conf /$host .conf ]]; then
1229
- tmp_tlsport =$( egrep -o " $host :[1-9][0-9]?+" $is_caddy_conf /$host .conf | sed s/.* ://)
1243
+ is_tmp_https_port =$( egrep -o " $host :[1-9][0-9]?+" $is_caddy_conf /$host .conf | sed s/.* ://)
1230
1244
fi
1231
- [[ $tmp_tlsport ]] && tlsport= $tmp_tlsport
1232
- [[ $is_client && $host ]] && port=$tlsport
1245
+ [[ $is_tmp_https_port ]] && is_https_port= $is_tmp_https_port
1246
+ [[ $is_client && $host ]] && port=$is_https_port
1233
1247
get protocol $is_protocol -$net
1234
1248
fi
1235
1249
;;
@@ -1501,19 +1515,18 @@ info() {
1501
1515
is_url_path=serviceName
1502
1516
}
1503
1517
[[ $is_protocol == ' vmess' ]] && {
1504
- 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\" ' }' <<< {} )
1518
+ 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\" ' }' <<< {} )
1505
1519
is_url=vmess://$( echo -n $is_vmess_url | base64 -w 0)
1506
1520
} || {
1507
1521
[[ $is_trojan ]] && {
1508
1522
uuid=$trojan_password
1509
- is_info_str=($is_protocol $is_addr $tlsport $trojan_password $net $host $path ' tls' )
1510
1523
is_can_change=(0 1 2 3 4)
1511
1524
is_info_show=(0 1 2 10 4 6 7 8)
1512
1525
}
1513
- 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 "
1526
+ 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 "
1514
1527
}
1515
1528
[[ $is_caddy ]] && is_can_change+=(13)
1516
- is_info_str=($is_protocol $is_addr $tlsport $uuid $net $host $path ' tls' )
1529
+ is_info_str=($is_protocol $is_addr $is_https_port $uuid $net $host $path ' tls' )
1517
1530
;;
1518
1531
reality)
1519
1532
is_color=41
@@ -1550,6 +1563,9 @@ info() {
1550
1563
fi
1551
1564
msg " $a $tt = \e[${is_color} m${is_info_str[$i]} \e[0m"
1552
1565
done
1566
+ if [[ $is_new_install ]]; then
1567
+ warn " 首次安装请查看脚本帮助文档: $( msg_ul https://233boy.com/$is_core /$is_core -script/) "
1568
+ fi
1553
1569
if [[ $is_url ]]; then
1554
1570
msg " ------------- ${info_list[12]} -------------"
1555
1571
msg " \e[4;${is_color} m${is_url} \e[0m"
@@ -1760,6 +1776,7 @@ main() {
1760
1776
change ${@: 2}
1761
1777
;;
1762
1778
client | genc)
1779
+ [[ $1 == ' client' ]] && is_full_client=1
1763
1780
create client $2
1764
1781
;;
1765
1782
d | del | rm)
@@ -1845,7 +1862,14 @@ main() {
1845
1862
is_update_name=sh
1846
1863
is_update_ver=
1847
1864
}
1848
- update $is_update_name $is_update_ver
1865
+ if [[ $2 == ' dat' ]]; then
1866
+ load download.sh
1867
+ download dat
1868
+ msg " $( _green 更新 geoip.dat geosite.dat 成功.) \n"
1869
+ manage restart &
1870
+ else
1871
+ update $is_update_name $is_update_ver
1872
+ fi
1849
1873
;;
1850
1874
ssss | ss2022)
1851
1875
get $@
0 commit comments