fix bug
This commit is contained in:
parent
65a7f10cb1
commit
ca1bdbcd2a
@ -1,24 +1,38 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
update_reality_dest(){
|
update_reality_dest(){
|
||||||
local script_dir=$(cd "$(dirname "$0")"; pwd)
|
local script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
local config_dir="$script_dir/../conf"
|
local config_dir="$script_dir/../conf"
|
||||||
|
source $script_dir/utils/jq_util.sh
|
||||||
|
|
||||||
local domain=$1
|
# 获取当前dest值
|
||||||
local dest="$domain"
|
local old_dest=$(jq -r '.inbounds[0].streamSettings.realitySettings.dest' "$config_dir/config.json")
|
||||||
|
|
||||||
# 如果未指定端口号默认加上 :443
|
# 输入新的dest地址
|
||||||
if [[ "$domain" != *:* ]]; then
|
local dest
|
||||||
dest="${domain}:443"
|
read -p "请输入新的dest地址[当前地址: $old_dest]: " dest
|
||||||
|
|
||||||
|
# 如果输入为空,退出脚本
|
||||||
|
if [[ -z "$dest" ]]; then
|
||||||
|
echo "输入dest为空,退出脚本"
|
||||||
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# 修改配置文件的dest
|
# 如果未指定端口号,默认加上 :443
|
||||||
|
if [[ "$dest" != *:* ]]; then
|
||||||
|
dest="${dest}:443"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# 提取域名部分,去掉端口号
|
||||||
|
local domain=$(echo "$dest" | cut -d: -f1)
|
||||||
|
|
||||||
|
# 修改配置文件中的dest
|
||||||
modify_json_file "$config_dir/config.json" ".inbounds[0].streamSettings.realitySettings.dest" "$dest"
|
modify_json_file "$config_dir/config.json" ".inbounds[0].streamSettings.realitySettings.dest" "$dest"
|
||||||
|
|
||||||
# 修改配置文件的serverNames
|
# 修改配置文件中的serverNames,不带端口号
|
||||||
modify_json_file "$config_dir/config.json" ".inbounds[0].streamSettings.realitySettings.serverNames" "[\"$domain\"]"
|
modify_json_file "$config_dir/config.json" ".inbounds[0].streamSettings.realitySettings.serverNames" "[\"$domain\"]"
|
||||||
|
|
||||||
echo "修改realty_dest成功"
|
echo "修改realty_dest成功"
|
||||||
}
|
}
|
||||||
|
|
||||||
update_reality_dest $1
|
update_reality_dest
|
||||||
|
|||||||
@ -59,6 +59,8 @@ install_dependencies() {
|
|||||||
|
|
||||||
|
|
||||||
main(){
|
main(){
|
||||||
|
local script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/bin"
|
||||||
|
|
||||||
# 显示菜单
|
# 显示菜单
|
||||||
echo "请选择一个操作:"
|
echo "请选择一个操作:"
|
||||||
echo "0. 安装依赖"
|
echo "0. 安装依赖"
|
||||||
@ -118,7 +120,7 @@ main(){
|
|||||||
# 修改Reality目标域名
|
# 修改Reality目标域名
|
||||||
check_dependencies
|
check_dependencies
|
||||||
check_config
|
check_config
|
||||||
change_reality_dest
|
bash $script_dir/update_reality_dest.sh
|
||||||
restart_docker
|
restart_docker
|
||||||
;;
|
;;
|
||||||
8)
|
8)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user