diff --git a/bin/update_port.sh b/bin/port.sh similarity index 100% rename from bin/update_port.sh rename to bin/port.sh diff --git a/bin/update_reality_dest.sh b/bin/reality.sh similarity index 53% rename from bin/update_reality_dest.sh rename to bin/reality.sh index 1a8d278..4ab7569 100644 --- a/bin/update_reality_dest.sh +++ b/bin/reality.sh @@ -1,5 +1,23 @@ #!/bin/bash +update_key(){ + local script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" # 脚本文件绝对路径 + local config_dir="$script_dir/../conf" + + # 使用docker运行xray镜像生成密钥文件 + docker run --rm teddysun/xray:latest /usr/bin/xray x25519 > $config_dir/key.txt + + # 获取私钥 + local private_key=$(grep "Private" $config_dir/key.txt | awk -F ': ' '{print $2}') + + # 修改config.json密钥属性 + modify_json_file "$config_dir/config.json" ".inbounds[0].streamSettings.realitySettings.privateKey" "$private_key" + + echo "生成和设置密钥成功." + +} + + update_reality_dest(){ local script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" local config_dir="$script_dir/../conf" @@ -32,3 +50,17 @@ update_reality_dest(){ echo "修改reality_dest成功" } + +update_short_id(){ + + local script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" # 脚本文件绝对路径 + local config_dir="$script_dir/../conf" + + # 生成 shortId + local short_id=$(openssl rand -hex 8) + + #修改 shortId + modify_json_file "$config_dir/config.json" ".inbounds[0].streamSettings.realitySettings.shortIds[0]" "$short_id" + + echo "设置shortId成功." +} diff --git a/bin/update_key.sh b/bin/update_key.sh deleted file mode 100644 index 0ea3630..0000000 --- a/bin/update_key.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash - -update_key(){ - local script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" # 脚本文件绝对路径 - local config_dir="$script_dir/../conf" - - # 使用docker运行xray镜像生成密钥文件 - docker run --rm teddysun/xray:latest /usr/bin/xray x25519 > $config_dir/key.txt - - # 获取私钥 - local private_key=$(grep "Private" $config_dir/key.txt | awk -F ': ' '{print $2}') - - # 修改config.json密钥属性 - modify_json_file "$config_dir/config.json" ".inbounds[0].streamSettings.realitySettings.privateKey" "$private_key" - - echo "生成和设置密钥成功." - -} diff --git a/bin/update_short_id.sh b/bin/update_short_id.sh deleted file mode 100644 index b99d595..0000000 --- a/bin/update_short_id.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/bash - -update_short_id(){ - - local script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" # 脚本文件绝对路径 - local config_dir="$script_dir/../conf" - - # 生成 shortId - local short_id=$(openssl rand -hex 8) - - #修改 shortId - modify_json_file "$config_dir/config.json" ".inbounds[0].streamSettings.realitySettings.shortIds[0]" "$short_id" - - echo "设置shortId成功." -}