This commit is contained in:
root
2024-02-28 07:34:02 +00:00
parent f4dd191f52
commit ed3febb297
7 changed files with 50 additions and 9 deletions
+21
View File
@@ -0,0 +1,21 @@
#!/bin/bash
# Generate private key
private_key=$(openssl genpkey -algorithm X25519)
# Extract public key from private key
public_key=$(echo "$private_key" | openssl pkey -pubout)
public_key=$(echo "$public_key" | sed -n '2p' | tr -d '\n')
private_key=$(echo "$private_key" | sed -n '2p' | tr -d '\n')
# Save keys to key.txt
echo "Private_key: $private_key" > ../conf/key.txt
echo "Public_key: $public_key" >> ../conf/key.txt
echo "success save keys to key.txt"
# update 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
echo "success updated private key to config.json"
+5
View File
@@ -0,0 +1,5 @@
#!/bin/bash
# 生成uui
bash ./update_uuid.sh
bash ./gen_key_and_update_key.sh
+44
View File
@@ -0,0 +1,44 @@
#!/bin/sh
# 检查 jq 是否安装
if ! command -v jq &> /dev/null; then
echo "jq 未安装"
exit 1
fi
# 检查 qrencode 是否安装
if ! command -v qrencode &> /dev/null; then
echo "qrencode 未安装"
exit 1
fi
# 获取本机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)
SNI=$(echo $DEST | awk -F ':' '{print $1}')
NETWORK="tcp"
PUBLIC_KEY=$(cat ../conf/key.txt | grep "Public" | awk -F ': ' '{print $2}')
# config info with green color
echo -e "\033[32m"
echo "IPV4: $IPV4"
echo "PORT: $PORT"
echo "UUID: $UUID"
echo "DEST: $DEST"
echo "PUBLIC_KEY: $PUBLIC_KEY"
echo "NETWORK: $NETWORK"
if [ "$IPV4" != "null" ]; then
SUB_IPV4="vless://$UUID@$IPV4:$PORT?encryption=none&security=reality&type=$NETWORK&sni=$SNI&fp=chrome&pbk=$PUBLIC_KEY&flow=xtls-rprx-vision#my_docker_vless_reality_vision"
echo "IPV4 订阅连接: $SUB_IPV4"
echo -e "IPV4 订阅二维码:\n$(echo "$SUB_IPV4" | qrencode -o - -t UTF8)"
fi
echo -e "\033[0m"
+15
View File
@@ -0,0 +1,15 @@
#!/bin/bash
# 生成 UUID
uuid=$(uuidgen -r 4)
# 使用 jq 修改 JSON 文件
jq ".inbounds[0].settings.clients[0].id=\"$uuid\"" ../conf/config.json > ../conf/config.json_tmp
# 替换原始文件
mv ../conf/config.json_tmp ../conf/config.json
# 验证结果
echo "UUID 已更新为: $uuid"