This commit is contained in:
Olia Lisa 2025-11-22 17:08:41 +08:00
parent 774b5955ad
commit 0e9714c3f0
5 changed files with 48 additions and 8 deletions

View File

@ -7,6 +7,9 @@ create_reality_config(){
# 检查jq是否安装
check_jq
config_dir=$(readlink -f "$script_dir/../conf") # 配置文件绝对路径
cp "$config_dir/template/reality_config.json" "$config_dir/config.json"
# 生成uui, 写入到config.json文件
bash $script_dir/update_uuid.sh
@ -19,4 +22,42 @@ create_reality_config(){
echo "初始化完成"
}
create_reality_config
create_xhttp_reality_config(){
script_dir=$(cd "$(dirname "$0")"; pwd) # 脚本文件绝对路径
source "$script_dir/utils/base.sh"
# 检查jq是否安装
check_jq
config_dir=$(readlink -f "$script_dir/../conf") # 配置文件绝对路径
cp "$config_dir/template/reality_config.json" "$config_dir/config.json"
# 生成uui, 写入到config.json文件
bash $script_dir/update_uuid.sh
# 生成密钥对, 修改config.json中的密钥属性
bash $script_dir/update_key.sh
# 生成xhttp_path, 写入到config.json文件
bash $script_dir/update_xhttp_path.sh
# 设置端口
bash $script_dir/update_port.sh
}
create_config(){
echo "请选择配置文件类型:"
echo "1. 创建reality配置"
echo "2. 创建xhttp_reality配置"
read -p "请输入选择 (1 或 2): " choice
case $choice in
1) create_reality_config ;;
2) create_xhttp_reality_config ;;
*) echo "无效选择,退出" ;;
esac
}
create_config

View File

@ -5,13 +5,12 @@ config_dir=$(readlink -f "$script_dir/../conf") # 配置文件绝对路径
# 如果配置文件不存在或者空白
if [ ! -e "$config_dir/config.json" ] || [ ! -s "$config_dir/config.json" ] ; then
cp "$config_dir/template/reality_config.json" "$config_dir/config.json"
bash "$script_dir/create_config.sh"
fi
# 如果配置未初始化
uuid=$(jq -r '.inbounds[0].settings.clients[0].id' "$config_dir/config.json")
if [ "$uuid" = "你的UUID" ] || [ -z "$uuid" ]; then
# 执行初始化脚本
echo "正在执行初始化脚本..."
bash "$script_dir/create_config.sh"
fi

View File

@ -44,7 +44,7 @@ find_free_port() {
return 1
}
change_port(){
update_port(){
local script_dir=$(cd "$(dirname "$0")"; pwd)
local config_dir="$script_dir/../conf"
source "$script_dir/utils/jq_util.sh"
@ -54,4 +54,4 @@ change_port(){
echo "设置端口成功"
}
change_port
update_port

View File

@ -11,7 +11,7 @@ update_xhttp_path(){
echo "设置xhttp_path成功"
## 修改config.json的xhttp_path
# 修改config.json的xhttp_path
modify_json_file "$config_dir/config.json" ".inbounds[0].streamSettings.xhttpSettings.path" "$xhttp_path"
}

View File

@ -56,12 +56,12 @@
"security": "reality",
"realitySettings": {
"show": true,
"dest": "gitea.9001001.xyz:443",
"dest": "你的reality_dest:443",
"xver": 0,
"maxTimeDiff": 0,
"minClientVer": "",
"serverNames": [
"gitea.9001001.xyz"
"你的reality_dest"
],
"privateKey": "你的密钥",
"shortIds": [