update
This commit is contained in:
parent
f4dd191f52
commit
ed3febb297
@ -5,7 +5,7 @@
|
||||
- curl
|
||||
- docker
|
||||
- docker-compose
|
||||
- jq - 用于查看json文件, 提取json文件信息
|
||||
- jq - 用于查看json文件, 提取json文件信息. 编辑json文件
|
||||
- qrencode - 用于生成二维码
|
||||
|
||||
## 启动和关闭
|
||||
|
||||
21
bin/gen_key_and_update_key.sh
Normal file
21
bin/gen_key_and_update_key.sh
Normal 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
bin/main.sh
Normal file
5
bin/main.sh
Normal file
@ -0,0 +1,5 @@
|
||||
#!/bin/bash
|
||||
|
||||
# 生成uui
|
||||
bash ./update_uuid.sh
|
||||
bash ./gen_key_and_update_key.sh
|
||||
8
get_share_link.sh → bin/print_share_link.sh
Normal file → Executable file
8
get_share_link.sh → bin/print_share_link.sh
Normal file → Executable file
@ -16,12 +16,12 @@ 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)
|
||||
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}')
|
||||
PUBLIC_KEY=$(cat ../conf/key.txt | grep "Public" | awk -F ': ' '{print $2}')
|
||||
|
||||
# config info with green color
|
||||
echo -e "\033[32m"
|
||||
15
bin/update_uuid.sh
Normal file
15
bin/update_uuid.sh
Normal 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"
|
||||
|
||||
|
||||
@ -45,7 +45,7 @@
|
||||
"settings": {
|
||||
"clients": [
|
||||
{
|
||||
"id": "d1872fe4-9a9e-442b-87c9-74c779c56476",
|
||||
"id": "c51f8991-42e5-4ff2-a028-5f10e02ec5b3",
|
||||
"flow": "xtls-rprx-vision"
|
||||
}
|
||||
],
|
||||
@ -63,7 +63,7 @@
|
||||
"serverNames": [
|
||||
"www.expedia.com"
|
||||
],
|
||||
"privateKey": "UArrjC-9qLXdvIHFz0SH1jSZ1CGctYxHYKrHZEH5E3A",
|
||||
"privateKey": "MC4CAQAwBQYDK2VuBCIEIOA1cfypxpHE7utwoQPgM2RhHG9+UpjYd3QplfYaeNtv",
|
||||
"shortIds": [
|
||||
""
|
||||
]
|
||||
|
||||
@ -1,2 +1,2 @@
|
||||
Private key: UArrjC-9qLXdvIHFz0SH1jSZ1CGctYxHYKrHZEH5E3A
|
||||
Public key: Z-HcL71ZNbPshcMUdNK4pC0XkbS6vjRB8fTQQUsIEV4
|
||||
Public_key: MCowBQYDK2VuAyEA9w1zvcbc9RA/kpWH8crN0up5Gj00DzfSJSb3otrXbBo=
|
||||
Private_key: MC4CAQAwBQYDK2VuBCIEIOA1cfypxpHE7utwoQPgM2RhHG9+UpjYd3QplfYaeNtv
|
||||
|
||||
Loading…
Reference in New Issue
Block a user