xray_docker/bin/create_config.sh
2025-12-09 12:11:38 +08:00

67 lines
1.7 KiB
Bash

#!/bin/bash
create_reality_config(){
local script_dir=$(cd "$(dirname "$0")"; pwd) # 脚本文件绝对路径
local 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
# 设置端口
bash $script_dir/update_port.sh
# 设置realty_dest
bash $script_dir/update_reality_dest.sh www.pranichealingsrilanka.com
echo "初始化完成"
}
create_xhttp_reality_config(){
local script_dir=$(cd "$(dirname "$0")"; pwd) # 脚本文件绝对路径
local config_dir=$(readlink -f "$script_dir/../conf") # 配置文件绝对路径
cp "$config_dir/template/xhttp_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
# 设置realty_dest
bash $script_dir/update_reality_dest.sh www.pranichealingsrilanka.com
# 设置端口
bash $script_dir/update_port.sh
}
create_config(){
local script_dir=$(cd "$(dirname "$0")"; pwd) # 脚本文件绝对路径
source "$script_dir/utils/base.sh"
# 检查jq是否安装
check_jq
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