update
This commit is contained in:
parent
aba157d578
commit
8da4cdbbee
@ -12,16 +12,18 @@ if ! command -v qrencode &> /dev/null; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
script_dir=$(cd "$(dirname "$0")"; pwd) # 脚本文件绝对路径
|
||||
config_dir="$script_dir/../config" # 配置文件绝对路径
|
||||
|
||||
# 获取本机IP
|
||||
IPV4=$(curl -4 -sSL --connect-timeout 3 --retry 2 ip.sb || echo "null")
|
||||
|
||||
UUID=$(jq -r '.inbounds[0].settings.clients[0].id' ../conf/config.json)
|
||||
PORT=$(jq -r '.inbounds[0].port' ../conf/config.json)
|
||||
DEST=$(jq -r '.inbounds[0].streamSettings.realitySettings.dest' ../conf/config.json)
|
||||
UUID=$(jq -r '.inbounds[0].settings.clients[0].id' $config_dir/config.json)
|
||||
PORT=$(jq -r '.inbounds[0].port' $config_dir/config.json)
|
||||
DEST=$(jq -r '.inbounds[0].streamSettings.realitySettings.dest' $config_dir/config.json)
|
||||
SNI=$(echo $DEST | awk -F ':' '{print $1}')
|
||||
NETWORK="tcp"
|
||||
PUBLIC_KEY=$(cat ../conf/key.txt | grep "Public" | awk -F ': ' '{print $2}')
|
||||
PUBLIC_KEY=$(cat $config_dir/key.txt | grep "Public" | awk -F ': ' '{print $2}')
|
||||
|
||||
# 打印配置信息
|
||||
echo -e "\033[32m" # config info with green color
|
||||
|
||||
@ -1,13 +1,16 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Save keys to key.txt
|
||||
xray x25519 > ../conf/key.txt
|
||||
script_dir=$(cd "$(dirname "$0")"; pwd) # 脚本文件绝对路径
|
||||
config_dir=$script_dir/../conf
|
||||
|
||||
private_key=$(grep "Private key" ../conf/key.txt | awk -F ': ' '{print $2}')
|
||||
# Save keys to key.txt
|
||||
xray x25519 > $config_dir/key.txt
|
||||
|
||||
private_key=$(grep "Private key" $config_dir/key.txt | awk -F ': ' '{print $2}')
|
||||
|
||||
# 修改config.json密钥属性
|
||||
jq ".inbounds[0].streamSettings.realitySettings.privateKey=\"$private_key\"" ../conf/config.json > ../conf/config_temp.json
|
||||
mv ../conf/config_temp.json ../conf/config.json
|
||||
jq ".inbounds[0].streamSettings.realitySettings.privateKey=\"$private_key\"" $config_dir/config.json > $config_dir/config_temp.json
|
||||
mv $config_dir/config_temp.json $config_dir/config.json
|
||||
|
||||
echo "生成和设置密钥成功."
|
||||
|
||||
|
||||
@ -1,13 +1,17 @@
|
||||
#!/bin/bash
|
||||
|
||||
|
||||
script_dir=$(cd "$(dirname "$0")"; pwd) # 脚本文件绝对路径
|
||||
config_dir="$script_dir/../config"
|
||||
|
||||
# 生成 UUID
|
||||
uuid=$(xray uuid)
|
||||
|
||||
# 使用 jq 修改 JSON 文件
|
||||
jq ".inbounds[0].settings.clients[0].id=\"$uuid\"" ../conf/config.json > ../conf/config.json_tmp
|
||||
jq ".inbounds[0].settings.clients[0].id=\"$uuid\"" $config_dir/config.json > $config_dir/config.json_tmp
|
||||
|
||||
# 替换原始文件
|
||||
mv ../conf/config.json_tmp ../conf/config.json
|
||||
mv $config_dir/config.json_tmp $config_dir/config.json
|
||||
|
||||
# 验证结果
|
||||
echo "设置UUID成功."
|
||||
|
||||
Loading…
Reference in New Issue
Block a user