17 lines
551 B
Bash
17 lines
551 B
Bash
#!/bin/bash
|
|
|
|
update_xhttp_path(){
|
|
|
|
local script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" # 脚本文件绝对路径
|
|
local config_dir="$script_dir/../conf"
|
|
|
|
local path_length="$(( RANDOM % 4 + 8 ))"
|
|
local uuid=$(cat /proc/sys/kernel/random/uuid)
|
|
local xhttp_path="/"$(docker run --rm teddysun/xray:latest xray uuid | tr -d '-' | cut -c 1-$path_length)
|
|
|
|
# 修改config.json的xhttp_path
|
|
modify_json_file "$config_dir/config.json" ".inbounds[0].streamSettings.xhttpSettings.path" "$xhttp_path"
|
|
|
|
echo "设置xhttp_path成功"
|
|
}
|