|
|
|
@@ -19,6 +19,7 @@ protocol_list=(
|
|
|
|
|
VMess-TCP-dynamic-port
|
|
|
|
|
VMess-mKCP-dynamic-port
|
|
|
|
|
VMess-QUIC-dynamic-port
|
|
|
|
|
Socks
|
|
|
|
|
)
|
|
|
|
|
ss_method_list=(
|
|
|
|
|
aes-128-gcm
|
|
|
|
@@ -69,6 +70,7 @@ info_list=(
|
|
|
|
|
"SNI (serverName)"
|
|
|
|
|
"指纹 (Fingerprint)"
|
|
|
|
|
"公钥 (Public key)"
|
|
|
|
|
"用户名 (Username)"
|
|
|
|
|
)
|
|
|
|
|
change_list=(
|
|
|
|
|
"更改协议"
|
|
|
|
@@ -86,6 +88,7 @@ change_list=(
|
|
|
|
|
"更改动态端口"
|
|
|
|
|
"更改伪装网站"
|
|
|
|
|
"更改 mKCP seed"
|
|
|
|
|
"更改用户名 (Username)"
|
|
|
|
|
)
|
|
|
|
|
servername_list=(
|
|
|
|
|
www.amazon.com
|
|
|
|
@@ -216,7 +219,7 @@ ask() {
|
|
|
|
|
set_header_type)
|
|
|
|
|
is_tmp_list=(${header_type_list[@]})
|
|
|
|
|
is_default_arg=$is_random_header_type
|
|
|
|
|
[[ $(grep tcp <<<"$is_new_protocol-$net") ]] && {
|
|
|
|
|
[[ $(grep -i tcp <<<"$is_new_protocol-$net") ]] && {
|
|
|
|
|
is_tmp_list=(none http)
|
|
|
|
|
is_default_arg=none
|
|
|
|
|
}
|
|
|
|
@@ -318,10 +321,8 @@ ask() {
|
|
|
|
|
create() {
|
|
|
|
|
case $1 in
|
|
|
|
|
server)
|
|
|
|
|
get new
|
|
|
|
|
is_sniffing='sniffing:{enabled:true,destOverride:["http","tls"]}'
|
|
|
|
|
is_listen_127='"listen": "127.0.0.1"'
|
|
|
|
|
is_tls=none
|
|
|
|
|
get new
|
|
|
|
|
|
|
|
|
|
# file name
|
|
|
|
|
if [[ $host ]]; then
|
|
|
|
@@ -332,10 +333,19 @@ create() {
|
|
|
|
|
is_json_file=$is_conf_dir/$is_config_name
|
|
|
|
|
# get json
|
|
|
|
|
[[ $is_change || ! $json_str ]] && get protocol $2
|
|
|
|
|
is_new_json=$(jq '{inbounds:[{tag:'\"$is_config_name\"',port:'"$port"',protocol:'\"$is_protocol\"','"$json_str"','"$is_sniffing"'}]}' <<<{})
|
|
|
|
|
case $net in
|
|
|
|
|
ws | h2 | grpc | http)
|
|
|
|
|
is_listen='"listen": "127.0.0.1"'
|
|
|
|
|
;;
|
|
|
|
|
*)
|
|
|
|
|
is_listen='"listen": "0.0.0.0"'
|
|
|
|
|
;;
|
|
|
|
|
esac
|
|
|
|
|
is_sniffing='sniffing:{enabled:true,destOverride:["http","tls"]}'
|
|
|
|
|
is_new_json=$(jq '{inbounds:[{tag:'\"$is_config_name\"',port:'"$port"','"$is_listen"',protocol:'\"$is_protocol\"','"$json_str"','"$is_sniffing"'}]}' <<<{})
|
|
|
|
|
if [[ $is_dynamic_port ]]; then
|
|
|
|
|
[[ ! $is_dynamic_port_range ]] && get dynamic-port
|
|
|
|
|
is_new_dynamic_port_json=$(jq '{inbounds:[{tag:'\"$is_config_name-link.json\"',port:'\"$is_dynamic_port_range\"',protocol:"vmess",'"$is_stream"','"$is_sniffing"',allocate:{strategy:"random"}}]}' <<<{})
|
|
|
|
|
is_new_dynamic_port_json=$(jq '{inbounds:[{tag:'\"$is_config_name-link.json\"',port:'\"$is_dynamic_port_range\"','"$is_listen"',protocol:"vmess",'"$is_stream"','"$is_sniffing"',allocate:{strategy:"random"}}]}' <<<{})
|
|
|
|
|
fi
|
|
|
|
|
[[ $is_test_json ]] && return # tmp test
|
|
|
|
|
# only show json, dont save to file.
|
|
|
|
@@ -362,7 +372,7 @@ create() {
|
|
|
|
|
api add $is_json_file $is_dynamic_port_link_file &>/dev/null
|
|
|
|
|
fi
|
|
|
|
|
# caddy auto tls
|
|
|
|
|
[[ $is_caddy && $host ]] && {
|
|
|
|
|
[[ $is_caddy && $host && ! $is_no_auto_tls ]] && {
|
|
|
|
|
create caddy $net
|
|
|
|
|
}
|
|
|
|
|
# restart core
|
|
|
|
@@ -507,10 +517,23 @@ change() {
|
|
|
|
|
1)
|
|
|
|
|
# new port
|
|
|
|
|
is_new_port=$3
|
|
|
|
|
[[ $host ]] && err "($is_config_file) 不支持更改端口, 因为没啥意义."
|
|
|
|
|
[[ $host && ! $is_caddy ]] && err "($is_config_file) 不支持更改端口, 因为没啥意义."
|
|
|
|
|
if [[ $is_new_port && ! $is_auto ]]; then
|
|
|
|
|
[[ ! $(is_test port $is_new_port) ]] && err "请输入正确的端口, 可选(1-65535)"
|
|
|
|
|
[[ $is_new_port != 443 && $(is_test port_used $is_new_port) ]] && err "无法使用 ($is_new_port) 端口"
|
|
|
|
|
fi
|
|
|
|
|
[[ $is_auto ]] && get_port && is_new_port=$tmp_port
|
|
|
|
|
[[ ! $is_new_port ]] && ask string is_new_port "请输入新端口:"
|
|
|
|
|
if [[ $is_caddy && $host ]]; then
|
|
|
|
|
net=$is_old_net
|
|
|
|
|
tlsport=$is_new_port
|
|
|
|
|
load caddy.sh
|
|
|
|
|
caddy_config $net
|
|
|
|
|
manage restart caddy &
|
|
|
|
|
info
|
|
|
|
|
else
|
|
|
|
|
add $net $is_new_port
|
|
|
|
|
fi
|
|
|
|
|
;;
|
|
|
|
|
2)
|
|
|
|
|
# new host
|
|
|
|
@@ -531,7 +554,7 @@ change() {
|
|
|
|
|
4)
|
|
|
|
|
# new password
|
|
|
|
|
is_new_pass=$3
|
|
|
|
|
if [[ $net == 'ss' || $is_trojan ]]; then
|
|
|
|
|
if [[ $net == 'ss' || $is_trojan || $is_socks_pass ]]; then
|
|
|
|
|
[[ $is_auto ]] && get_uuid && is_new_pass=$tmp_uuid
|
|
|
|
|
else
|
|
|
|
|
err "($is_config_file) 不支持更改密码."
|
|
|
|
@@ -539,6 +562,7 @@ change() {
|
|
|
|
|
[[ ! $is_new_pass ]] && ask string is_new_pass "请输入新密码:"
|
|
|
|
|
trojan_password=$is_new_pass
|
|
|
|
|
ss_password=$is_new_pass
|
|
|
|
|
is_socks_pass=$is_new_pass
|
|
|
|
|
add $net
|
|
|
|
|
;;
|
|
|
|
|
5)
|
|
|
|
@@ -689,6 +713,12 @@ change() {
|
|
|
|
|
kcp_seed=$is_new_kcp_seed
|
|
|
|
|
add $net
|
|
|
|
|
;;
|
|
|
|
|
15)
|
|
|
|
|
# new socks user
|
|
|
|
|
[[ ! $is_socks_user ]] && err "($is_config_file) 不支持更改用户名 (Username)."
|
|
|
|
|
ask string is_socks_user "请输入新用户名 (Username):"
|
|
|
|
|
add $net
|
|
|
|
|
;;
|
|
|
|
|
esac
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -789,6 +819,7 @@ manage() {
|
|
|
|
|
[[ $is_test_run && ! $is_new_install ]] && {
|
|
|
|
|
sleep 2
|
|
|
|
|
if [[ ! $(pgrep -f $is_run_bin) ]]; then
|
|
|
|
|
is_run_fail=${is_do_name_msg,,}
|
|
|
|
|
[[ ! $is_no_manage_msg ]] && {
|
|
|
|
|
msg
|
|
|
|
|
warn "($is_do_msg) $is_do_name_msg 失败"
|
|
|
|
@@ -796,7 +827,6 @@ manage() {
|
|
|
|
|
get test-run
|
|
|
|
|
_yellow "测试结束, 请按 Enter 退出."
|
|
|
|
|
}
|
|
|
|
|
is_run_fail=${is_do_name_msg,,}
|
|
|
|
|
fi
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@@ -811,6 +841,7 @@ api() {
|
|
|
|
|
[[ ! $1 ]] && err "无法识别 API 的参数."
|
|
|
|
|
[[ $is_core_stop ]] && {
|
|
|
|
|
warn "$is_core_name 当前处于停止状态."
|
|
|
|
|
is_api_fail=1
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
case $1 in
|
|
|
|
@@ -861,7 +892,10 @@ add() {
|
|
|
|
|
door)
|
|
|
|
|
is_new_protocol=Dokodemo-Door
|
|
|
|
|
;;
|
|
|
|
|
http | socks)
|
|
|
|
|
socks)
|
|
|
|
|
is_new_protocol=Socks
|
|
|
|
|
;;
|
|
|
|
|
http)
|
|
|
|
|
is_new_protocol=local-$is_lower
|
|
|
|
|
;;
|
|
|
|
|
*)
|
|
|
|
@@ -908,7 +942,13 @@ add() {
|
|
|
|
|
is_use_door_addr=$3
|
|
|
|
|
is_use_door_port=$4
|
|
|
|
|
;;
|
|
|
|
|
*http | *socks)
|
|
|
|
|
socks)
|
|
|
|
|
is_socks=1
|
|
|
|
|
is_use_port=$2
|
|
|
|
|
is_use_socks_user=$3
|
|
|
|
|
is_use_socks_pass=$4
|
|
|
|
|
;;
|
|
|
|
|
*http)
|
|
|
|
|
is_use_port=$2
|
|
|
|
|
;;
|
|
|
|
|
esac
|
|
|
|
@@ -1016,6 +1056,8 @@ add() {
|
|
|
|
|
[[ $is_use_host ]] && host=$is_use_host
|
|
|
|
|
[[ $is_use_door_addr ]] && door_addr=$is_use_door_addr
|
|
|
|
|
[[ $is_use_servername ]] && is_servername=$is_use_servername
|
|
|
|
|
[[ $is_use_socks_user ]] && is_socks_user=$is_use_socks_user
|
|
|
|
|
[[ $is_use_socks_pass ]] && is_socks_pass=$is_use_socks_pass
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
if [[ $is_use_tls ]]; then
|
|
|
|
@@ -1039,11 +1081,17 @@ add() {
|
|
|
|
|
# set port
|
|
|
|
|
[[ ! $port ]] && ask string port "请输入端口:"
|
|
|
|
|
|
|
|
|
|
case ${is_new_protocol} in
|
|
|
|
|
case ${is_new_protocol,,} in
|
|
|
|
|
*tcp* | *kcp* | *quic*)
|
|
|
|
|
[[ ! $header_type ]] && ask set_header_type
|
|
|
|
|
;;
|
|
|
|
|
Shadowsocks)
|
|
|
|
|
socks)
|
|
|
|
|
# set user
|
|
|
|
|
[[ ! $is_socks_user ]] && ask string is_socks_user "请设置用户名:"
|
|
|
|
|
# set password
|
|
|
|
|
[[ ! $is_socks_pass ]] && ask string is_socks_pass "请设置密码:"
|
|
|
|
|
;;
|
|
|
|
|
shadowsocks)
|
|
|
|
|
# set method
|
|
|
|
|
[[ ! $ss_method ]] && ask set_ss_method
|
|
|
|
|
# set password
|
|
|
|
@@ -1118,7 +1166,7 @@ get() {
|
|
|
|
|
is_file_str=$2
|
|
|
|
|
[[ ! $is_file_str ]] && is_file_str='.json$'
|
|
|
|
|
# is_all_json=("$(ls $is_conf_dir | egrep $is_file_str)")
|
|
|
|
|
readarray -t is_all_json <<<$(ls $is_conf_dir | egrep -i "$is_file_str" | sed '/dynamic-port-.*-link/d' | head -233) # limit max 233 lines for show.
|
|
|
|
|
readarray -t is_all_json <<<"$(ls $is_conf_dir | egrep -i "$is_file_str" | sed '/dynamic-port-.*-link/d' | head -233)" # limit max 233 lines for show.
|
|
|
|
|
[[ ! $is_all_json ]] && err "无法找到相关的配置文件: $2"
|
|
|
|
|
[[ ${#is_all_json[@]} -eq 1 ]] && is_config_file=$is_all_json && is_auto_get_config=1
|
|
|
|
|
[[ ! $is_config_file ]] && {
|
|
|
|
@@ -1130,12 +1178,12 @@ get() {
|
|
|
|
|
get file $2
|
|
|
|
|
if [[ $is_config_file ]]; then
|
|
|
|
|
is_json_str=$(cat $is_conf_dir/"$is_config_file")
|
|
|
|
|
is_json_data_base=$(jq '.inbounds[0]|.protocol,.port,.settings.clients[0].id,.settings.clients[0].password,.settings.method,.settings.password,.settings.address,.settings.port,.settings.detour.to' <<<$is_json_str)
|
|
|
|
|
is_json_data_base=$(jq '.inbounds[0]|.protocol,.port,.settings.clients[0].id,.settings.clients[0].password,.settings.method,.settings.password,.settings.address,.settings.port,.settings.detour.to,.settings.accounts[0].user,.settings.accounts[0].pass' <<<$is_json_str)
|
|
|
|
|
[[ $? != 0 ]] && err "无法读取此文件: $is_config_file"
|
|
|
|
|
is_json_data_more=$(jq '.inbounds[0]|.streamSettings|.network,.security,.tcpSettings.header.type,.kcpSettings.seed,.kcpSettings.header.type,.quicSettings.header.type,.wsSettings.path,.httpSettings.path,.grpcSettings.serviceName' <<<$is_json_str)
|
|
|
|
|
is_json_data_host=$(jq '.inbounds[0]|.streamSettings|.grpc_host,.wsSettings.headers.Host,.httpSettings.host[0]' <<<$is_json_str)
|
|
|
|
|
is_json_data_reality=$(jq '.inbounds[0]|.streamSettings|.realitySettings.serverNames[0],.realitySettings.publicKey,.realitySettings.privateKey' <<<$is_json_str)
|
|
|
|
|
is_up_var_set=(null is_protocol port uuid trojan_password ss_method ss_password door_addr door_port is_dynamic_port net is_reality tcp_type kcp_seed kcp_type quic_type ws_path h2_path grpc_path grpc_host ws_host h2_host is_servername is_public_key is_private_key)
|
|
|
|
|
is_up_var_set=(null is_protocol port uuid trojan_password ss_method ss_password door_addr door_port is_dynamic_port is_socks_user is_socks_pass net is_reality tcp_type kcp_seed kcp_type quic_type ws_path h2_path grpc_path grpc_host ws_host h2_host is_servername is_public_key is_private_key)
|
|
|
|
|
[[ $is_debug ]] && msg "\n------------- debug: $is_config_file -------------"
|
|
|
|
|
i=0
|
|
|
|
|
for v in $(sed 's/""/null/g;s/"//g' <<<"$is_json_data_base $is_json_data_more $is_json_data_host $is_json_data_reality"); do
|
|
|
|
@@ -1162,7 +1210,11 @@ get() {
|
|
|
|
|
is_dynamic_port_range=$(jq -r '.inbounds[0].port' $is_dynamic_port_file)
|
|
|
|
|
[[ $? != 0 ]] && err "无法读取动态端口文件: $is_dynamic_port"
|
|
|
|
|
fi
|
|
|
|
|
[[ $is_client && $host ]] && port=443
|
|
|
|
|
if [[ $is_caddy && $host && -f $is_caddy_conf/$host.conf ]]; then
|
|
|
|
|
tmp_tlsport=$(egrep -o "$host:[1-9][0-9]?+" $is_caddy_conf/$host.conf | sed s/.*://)
|
|
|
|
|
fi
|
|
|
|
|
[[ $tmp_tlsport ]] && tlsport=$tmp_tlsport
|
|
|
|
|
[[ $is_client && $host ]] && port=$tlsport
|
|
|
|
|
get protocol $is_protocol-$net
|
|
|
|
|
fi
|
|
|
|
|
;;
|
|
|
|
@@ -1210,17 +1262,19 @@ get() {
|
|
|
|
|
dokodemo-door*)
|
|
|
|
|
is_protocol=dokodemo-door
|
|
|
|
|
net=door
|
|
|
|
|
json_str='settings:{port:'\"$door_port\"',address:'\"$door_addr\"',network:"tcp,udp"}'
|
|
|
|
|
json_str='settings:{port:'"$door_port"',address:'\"$door_addr\"',network:"tcp,udp"}'
|
|
|
|
|
;;
|
|
|
|
|
*http*)
|
|
|
|
|
is_protocol=http
|
|
|
|
|
net=http
|
|
|
|
|
json_str=''"$is_listen_127"''
|
|
|
|
|
json_str='settings:{"timeout": 233}'
|
|
|
|
|
;;
|
|
|
|
|
*socks*)
|
|
|
|
|
is_protocol=socks
|
|
|
|
|
net=socks
|
|
|
|
|
json_str=''"$is_listen_127"',settings:{udp:true}'
|
|
|
|
|
[[ ! $is_socks_user ]] && is_socks_user=233boy
|
|
|
|
|
[[ ! $is_socks_pass ]] && is_socks_pass=$uuid
|
|
|
|
|
json_str='settings:{auth:"password",accounts:[{user:'\"$is_socks_user\"',pass:'\"$is_socks_pass\"'}],udp:true}'
|
|
|
|
|
;;
|
|
|
|
|
*)
|
|
|
|
|
err "无法识别协议: $is_config_file"
|
|
|
|
@@ -1251,20 +1305,20 @@ get() {
|
|
|
|
|
net=ws
|
|
|
|
|
[[ ! $path ]] && path="/$uuid"
|
|
|
|
|
is_stream='streamSettings:{network:"ws",security:'\"$is_tls\"',wsSettings:{path:'\"$path\"',headers:{Host:'\"$host\"'}}}'
|
|
|
|
|
json_str=''"$is_listen_127"','"$is_server_id_json"','"$is_stream"''
|
|
|
|
|
json_str=''"$is_server_id_json"','"$is_stream"''
|
|
|
|
|
;;
|
|
|
|
|
*grpc* | *gun)
|
|
|
|
|
net=grpc
|
|
|
|
|
[[ ! $path ]] && path="$uuid"
|
|
|
|
|
[[ $path ]] && path=$(sed 's#/##g' <<<$path)
|
|
|
|
|
is_stream='streamSettings:{network:"grpc",grpc_host:'\"$host\"',security:'\"$is_tls\"',grpcSettings:{serviceName:'\"$path\"'}}'
|
|
|
|
|
json_str=''"$is_listen_127"','"$is_server_id_json"','"$is_stream"''
|
|
|
|
|
json_str=''"$is_server_id_json"','"$is_stream"''
|
|
|
|
|
;;
|
|
|
|
|
*h2* | *http*)
|
|
|
|
|
net=h2
|
|
|
|
|
[[ ! $path ]] && path="/$uuid"
|
|
|
|
|
is_stream='streamSettings:{network:"h2",security:'\"$is_tls\"',httpSettings:{path:'\"$path\"',host:['\"$host\"']}}'
|
|
|
|
|
json_str=''"$is_listen_127"','"$is_server_id_json"','"$is_stream"''
|
|
|
|
|
json_str=''"$is_server_id_json"','"$is_stream"''
|
|
|
|
|
;;
|
|
|
|
|
*reality*)
|
|
|
|
|
net=reality
|
|
|
|
@@ -1329,7 +1383,9 @@ get() {
|
|
|
|
|
[[ $? != 0 ]] && err "无法生成 Shadowsocks 2022 密码, 请安装 openssl."
|
|
|
|
|
;;
|
|
|
|
|
ping)
|
|
|
|
|
is_host_dns=$(ping $host -c 1 -W 2 | head -1)
|
|
|
|
|
is_ip_type="-4"
|
|
|
|
|
[[ $(grep ":" <<<$ip) ]] && is_ip_type="-6"
|
|
|
|
|
is_host_dns=$(ping $host $is_ip_type -c 1 -W 2 | head -1)
|
|
|
|
|
;;
|
|
|
|
|
log | logerr)
|
|
|
|
|
msg "\n 提醒: 按 $(_green Ctrl + C) 退出\n"
|
|
|
|
@@ -1357,12 +1413,12 @@ get() {
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
is_no_manage_msg=1
|
|
|
|
|
if [[ $is_core_stop ]]; then
|
|
|
|
|
if [[ ! $(pgrep -f $is_core_bin) ]]; then
|
|
|
|
|
_yellow "\n测试运行 $is_core_name ..\n"
|
|
|
|
|
manage start &>/dev/null
|
|
|
|
|
if [[ $is_run_fail == $is_core ]]; then
|
|
|
|
|
_red "$is_core_name 运行失败信息:"
|
|
|
|
|
$is_core_bin run -c $is_config_json -confdir $is_conf_dir
|
|
|
|
|
$is_core_bin $is_with_run_arg -c $is_config_json -confdir $is_conf_dir
|
|
|
|
|
else
|
|
|
|
|
_green "\n测试通过, 已启动 $is_core_name ..\n"
|
|
|
|
|
fi
|
|
|
|
@@ -1370,7 +1426,7 @@ get() {
|
|
|
|
|
_green "\n$is_core_name 正在运行, 跳过测试\n"
|
|
|
|
|
fi
|
|
|
|
|
if [[ $is_caddy ]]; then
|
|
|
|
|
if [[ $is_caddy_stop ]]; then
|
|
|
|
|
if [[ ! $(pgrep -f $is_caddy_bin) ]]; then
|
|
|
|
|
_yellow "\n测试运行 Caddy ..\n"
|
|
|
|
|
manage start caddy &>/dev/null
|
|
|
|
|
if [[ $is_run_fail == 'caddy' ]]; then
|
|
|
|
@@ -1398,8 +1454,8 @@ info() {
|
|
|
|
|
tcp | kcp | quic)
|
|
|
|
|
is_can_change=(0 1 5 7)
|
|
|
|
|
is_info_show=(0 1 2 3 4 5)
|
|
|
|
|
is_vmess_url=$(jq -c '{v:2,ps:'\"233boy-${net}-$is_addr\"',add:'\"$is_addr\"',port:'\"$port\"',id:'\"$uuid\"',net:'\"$net\"',type:'\"$header_type\"',path:'\"$kcp_seed\"'}' <<<{})
|
|
|
|
|
is_url=vmess://$(base64 -w 0 <<<$is_vmess_url)
|
|
|
|
|
is_vmess_url=$(jq -c '{v:2,ps:'\"233boy-${net}-$is_addr\"',add:'\"$is_addr\"',port:'\"$port\"',id:'\"$uuid\"',aid:"0",net:'\"$net\"',type:'\"$header_type\"',path:'\"$kcp_seed\"'}' <<<{})
|
|
|
|
|
is_url=vmess://$(echo -n $is_vmess_url | base64 -w 0)
|
|
|
|
|
is_tmp_port=$port
|
|
|
|
|
[[ $is_dynamic_port ]] && {
|
|
|
|
|
is_can_change+=(12)
|
|
|
|
@@ -1414,12 +1470,12 @@ info() {
|
|
|
|
|
ss)
|
|
|
|
|
is_can_change=(0 1 4 6)
|
|
|
|
|
is_info_show=(0 1 2 10 11)
|
|
|
|
|
is_url="ss://$(base64 -w 0 <<<"${ss_method}:${ss_password}")@${ip}:${port}#233boy-ss-${ip}"
|
|
|
|
|
is_url="ss://$(echo -n ${ss_method}:${ss_password} | base64 -w 0)@${is_addr}:${port}#233boy-$net-${is_addr}"
|
|
|
|
|
is_info_str=($is_protocol $is_addr $port $ss_password $ss_method)
|
|
|
|
|
;;
|
|
|
|
|
ws | h2 | grpc)
|
|
|
|
|
is_color=45
|
|
|
|
|
is_can_change=(0 2 3 5)
|
|
|
|
|
is_can_change=(0 1 2 3 5)
|
|
|
|
|
is_info_show=(0 1 2 3 4 6 7 8)
|
|
|
|
|
is_url_path=path
|
|
|
|
|
[[ $net == 'grpc' ]] && {
|
|
|
|
@@ -1427,33 +1483,39 @@ info() {
|
|
|
|
|
is_url_path=serviceName
|
|
|
|
|
}
|
|
|
|
|
[[ $is_protocol == 'vmess' ]] && {
|
|
|
|
|
is_vmess_url=$(jq -c '{v:2,ps:'\"233boy-$host\"',add:'\"$is_addr\"',port:'\"443\"',id:'\"$uuid\"',net:'\"$net\"',host:'\"$host\"',path:'\"$path\"',tls:'\"tls\"'}' <<<{})
|
|
|
|
|
is_url=vmess://$(base64 -w 0 <<<$is_vmess_url)
|
|
|
|
|
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\"'}' <<<{})
|
|
|
|
|
is_url=vmess://$(echo -n $is_vmess_url | base64 -w 0)
|
|
|
|
|
} || {
|
|
|
|
|
[[ $is_trojan ]] && {
|
|
|
|
|
uuid=$trojan_password
|
|
|
|
|
is_info_str=($is_protocol $is_addr 443 $trojan_password $net $host $path 'tls')
|
|
|
|
|
is_can_change=(0 2 3 4)
|
|
|
|
|
is_info_str=($is_protocol $is_addr $tlsport $trojan_password $net $host $path 'tls')
|
|
|
|
|
is_can_change=(0 1 2 3 4)
|
|
|
|
|
is_info_show=(0 1 2 10 4 6 7 8)
|
|
|
|
|
}
|
|
|
|
|
is_url="$is_protocol://$uuid@$host:443?encryption=none&security=tls&type=$net&host=$host&${is_url_path}=$(sed 's#/#%2F#g' <<<$path)#233boy-$host"
|
|
|
|
|
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"
|
|
|
|
|
}
|
|
|
|
|
[[ $is_caddy ]] && is_can_change+=(13)
|
|
|
|
|
is_info_str=($is_protocol $is_addr 443 $uuid $net $host $path 'tls')
|
|
|
|
|
is_info_str=($is_protocol $is_addr $tlsport $uuid $net $host $path 'tls')
|
|
|
|
|
;;
|
|
|
|
|
reality)
|
|
|
|
|
is_color=41
|
|
|
|
|
is_can_change=(0 1 5 10 11)
|
|
|
|
|
is_info_show=(0 1 2 3 15 8 16 17 18)
|
|
|
|
|
is_info_str=($is_protocol $is_addr $port $uuid xtls-rprx-vision reality $is_servername "ios" $is_public_key)
|
|
|
|
|
is_url="$is_protocol://$uuid@$ip:$port?encryption=none&security=reality&flow=xtls-rprx-vision&type=tcp&sni=$is_servername&pbk=$is_public_key&fp=ios#233boy-$is_addr"
|
|
|
|
|
is_url="$is_protocol://$uuid@$ip:$port?encryption=none&security=reality&flow=xtls-rprx-vision&type=tcp&sni=$is_servername&pbk=$is_public_key&fp=ios#233boy-$net-$is_addr"
|
|
|
|
|
;;
|
|
|
|
|
door)
|
|
|
|
|
is_can_change=(0 1 8 9)
|
|
|
|
|
is_info_show=(0 1 2 13 14)
|
|
|
|
|
is_info_str=($is_protocol $is_addr $port $door_addr $door_port)
|
|
|
|
|
;;
|
|
|
|
|
socks | http)
|
|
|
|
|
socks)
|
|
|
|
|
is_can_change=(0 1 15 4)
|
|
|
|
|
is_info_show=(0 1 2 19 10)
|
|
|
|
|
is_info_str=($is_protocol $is_addr $port $is_socks_user $is_socks_pass)
|
|
|
|
|
is_url="socks://$(echo -n ${is_socks_user}:${is_socks_pass} | base64 -w 0)@${is_addr}:${port}#233boy-$net-${is_addr}"
|
|
|
|
|
;;
|
|
|
|
|
http)
|
|
|
|
|
is_can_change=(0 1)
|
|
|
|
|
is_info_show=(0 1 2)
|
|
|
|
|
is_info_str=($is_protocol 127.0.0.1 $port)
|
|
|
|
@@ -1511,7 +1573,11 @@ url_qr() {
|
|
|
|
|
link="https://233boy.github.io/tools/qr.html#${is_url}"
|
|
|
|
|
msg "\n------------- $is_config_name & QR code 二维码 -------------"
|
|
|
|
|
msg
|
|
|
|
|
if [[ $(type -P qrencode) ]]; then
|
|
|
|
|
qrencode -t ANSI "${is_url}"
|
|
|
|
|
else
|
|
|
|
|
msg "请安装 qrencode: $(_green "$cmd update -y; $cmd install qrencode -y")"
|
|
|
|
|
fi
|
|
|
|
|
msg
|
|
|
|
|
msg "如果无法正常显示或识别, 请使用下面的链接来生成二维码:"
|
|
|
|
|
msg "\n\e[4;${is_color}m${link}\e[0m\n"
|
|
|
|
@@ -1533,17 +1599,20 @@ update() {
|
|
|
|
|
is_update_name=core
|
|
|
|
|
is_show_name=$is_core_name
|
|
|
|
|
is_run_ver=v${is_core_ver##* }
|
|
|
|
|
is_update_repo=$is_core_repo
|
|
|
|
|
;;
|
|
|
|
|
2 | sh)
|
|
|
|
|
is_update_name=sh
|
|
|
|
|
is_show_name="$is_core_name 脚本"
|
|
|
|
|
is_run_ver=$is_sh_ver
|
|
|
|
|
is_update_repo=$is_sh_repo
|
|
|
|
|
;;
|
|
|
|
|
3 | caddy)
|
|
|
|
|
[[ ! $is_caddy ]] && err "不支持更新 Caddy."
|
|
|
|
|
is_update_name=caddy
|
|
|
|
|
is_show_name="Caddy"
|
|
|
|
|
is_run_ver=$is_caddy_ver
|
|
|
|
|
is_update_repo=$is_caddy_repo
|
|
|
|
|
;;
|
|
|
|
|
*)
|
|
|
|
|
err "无法识别 ($1), 请使用: $is_core update [core | sh | caddy] [ver]"
|
|
|
|
@@ -1568,7 +1637,9 @@ update() {
|
|
|
|
|
fi
|
|
|
|
|
download $is_update_name $is_new_ver
|
|
|
|
|
msg "更新成功, 当前 $is_show_name 版本: $(_green $is_new_ver)\n"
|
|
|
|
|
manage restart $is_update_name &
|
|
|
|
|
msg "$(_green 请查看更新说明: https://github.com/$is_update_repo/releases/tag/$is_new_ver)\n"
|
|
|
|
|
[[ $is_update_name == 'core' ]] && $is_core restart
|
|
|
|
|
[[ $is_update_name == 'caddy' ]] && manage restart $is_update_name &
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# main menu; if no prefer args.
|
|
|
|
|