update
This commit is contained in:
parent
e9a5a5b184
commit
d7f681a379
26
bin/print_share_link.sh
Normal file
26
bin/print_share_link.sh
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# 检查 jq 命令是否可用
|
||||||
|
if ! command -v jq &> /dev/null
|
||||||
|
then
|
||||||
|
echo "jq 命令未安装,请先安装 jq。"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# 获取脚本所在目录的上级目录路径
|
||||||
|
script_dir=$(cd "$(dirname "$0")"; pwd)
|
||||||
|
parent_dir=$(dirname "$script_dir")
|
||||||
|
|
||||||
|
# 读取 config.json 文件
|
||||||
|
config=$(cat "$parent_dir/config.json")
|
||||||
|
|
||||||
|
# 提取所需信息
|
||||||
|
password=$(echo "$config" | jq -r '.auth.password')
|
||||||
|
hostname=$(echo "$config" | jq -r '.listen' | cut -d':' -f2)
|
||||||
|
sni=$(echo "$config" | jq -r '.masquerade.proxy.url' | awk -F'/' '{print $3}')
|
||||||
|
|
||||||
|
# 构建分享链接
|
||||||
|
share_link="hysteria2://${password}@${hostname}/?sni=${sni}&insecure=1#RN%E7%BE%8E%E5%9B%BD_hy2"
|
||||||
|
|
||||||
|
# 输出分享链接
|
||||||
|
echo "$share_link"
|
||||||
Loading…
Reference in New Issue
Block a user