fix(脚本): 修改tuic读取password问题、修改sing-box全局分流后卸载无法正常启动问题

pull/852/head
mack-a 2023-11-18 21:01:39 +08:00
parent b15caa775f
commit 1303b7d6a2
1 changed files with 18 additions and 11 deletions

View File

@ -3225,8 +3225,10 @@ addSingBoxRouteRule() {
removeSingBoxRouteRule() { removeSingBoxRouteRule() {
local outboundTag=$1 local outboundTag=$1
local delRules local delRules
delRules=$(jq -r 'del(.route.rules[]|select(.outbound=="'"${outboundTag}"'"))' "${singBoxConfigPath}config/${outboundTag}_route.json") if [[ -f "${singBoxConfigPath}config/${outboundTag}_route.json" ]]; then
echo "${delRules}" >"${singBoxConfigPath}config/${outboundTag}_route.json" delRules=$(jq -r 'del(.route.rules[]|select(.outbound=="'"${outboundTag}"'"))' "${singBoxConfigPath}config/${outboundTag}_route.json")
echo "${delRules}" >"${singBoxConfigPath}config/${outboundTag}_route.json"
fi
} }
# 添加sing-box出站 # 添加sing-box出站
@ -4587,6 +4589,11 @@ EOF
echoContent yellow " ---> 二维码 VLESS(VLESS+reality+uTLS+gRPC)" echoContent yellow " ---> 二维码 VLESS(VLESS+reality+uTLS+gRPC)"
echoContent green " https://api.qrserver.com/v1/create-qr-code/?size=400x400&data=vless%3A%2F%2F${id}%40$(getPublicIP)%3A${currentRealityPort}%3Fencryption%3Dnone%26security%3Dreality%26type%3Dgrpc%26sni%3D${currentRealityServerNames}%26fp%3Dchrome%26pbk%3D${currentRealityPublicKey}%26pbk%3D6ba85179e30d4fc2%26path%3Dgrpc%26serviceName%3Dgrpc%23${email}\n" echoContent green " https://api.qrserver.com/v1/create-qr-code/?size=400x400&data=vless%3A%2F%2F${id}%40$(getPublicIP)%3A${currentRealityPort}%3Fencryption%3Dnone%26security%3Dreality%26type%3Dgrpc%26sni%3D${currentRealityServerNames}%26fp%3Dchrome%26pbk%3D${currentRealityPublicKey}%26pbk%3D6ba85179e30d4fc2%26path%3Dgrpc%26serviceName%3Dgrpc%23${email}\n"
elif [[ "${type}" == "tuic" ]]; then elif [[ "${type}" == "tuic" ]]; then
local tuicUUID=
tuicUUID=$(echo "${id}" | awk -F "[_]" '{print $1}')
local tuicPassword=
tuicPassword=$(echo "${id}" | awk -F "[_]" '{print $2}')
if [[ -z "${email}" ]]; then if [[ -z "${email}" ]]; then
echoContent red " ---> 读取配置失败,请重新安装" echoContent red " ---> 读取配置失败,请重新安装"
@ -4594,21 +4601,21 @@ EOF
fi fi
echoContent yellow " ---> 格式化明文(Tuic+TLS)" echoContent yellow " ---> 格式化明文(Tuic+TLS)"
echoContent green " 协议类型:Tuic地址:${currentHost},端口:${tuicPort}uuid${id}password${id}congestion-controller:${tuicAlgorithm}alpn: h3账户名:${email}\n" echoContent green " 协议类型:Tuic地址:${currentHost},端口:${tuicPort}uuid${tuicUUID}password${tuicPassword}congestion-controller:${tuicAlgorithm}alpn: h3账户名:${email}\n"
cat <<EOF >>"/etc/v2ray-agent/subscribe_local/default/${user}" cat <<EOF >>"/etc/v2ray-agent/subscribe_local/default/${user}"
tuic://${id}:${id}@${currentHost}:${tuicPort}?congestion_control=${tuicAlgorithm}&alpn=h3&sni=${currentHost}&udp_relay_mode=quic&allow_insecure=0#${email} tuic://${tuicUUID}:${tuicPassword}@${currentHost}:${tuicPort}?congestion_control=${tuicAlgorithm}&alpn=h3&sni=${currentHost}&udp_relay_mode=quic&allow_insecure=0#${email}
EOF EOF
echoContent yellow " ---> v2rayN(Tuic+TLS)" echoContent yellow " ---> v2rayN(Tuic+TLS)"
echo "{\"relay\": {\"server\": \"${currentHost}:${tuicPort}\",\"uuid\": \"${id}\",\"password\": \"${id}\",\"ip\": \"$(getPublicIP 4)\",\"congestion_control\": \"${tuicAlgorithm}\",\"alpn\": [\"h3\"]},\"local\": {\"server\": \"127.0.0.1:7798\"},\"log_level\": \"warn\"}" | jq echo "{\"relay\": {\"server\": \"${currentHost}:${tuicPort}\",\"uuid\": \"${tuicUUID}\",\"password\": \"${tuicPassword}\",\"ip\": \"$(getPublicIP 4)\",\"congestion_control\": \"${tuicAlgorithm}\",\"alpn\": [\"h3\"]},\"local\": {\"server\": \"127.0.0.1:7798\"},\"log_level\": \"warn\"}" | jq
cat <<EOF >>"/etc/v2ray-agent/subscribe_local/clashMeta/${user}" cat <<EOF >>"/etc/v2ray-agent/subscribe_local/clashMeta/${user}"
- name: "${email}" - name: "${email}"
server: ${currentHost} server: ${currentHost}
type: tuic type: tuic
port: ${tuicPort} port: ${tuicPort}
uuid: ${id} uuid: ${tuicUUID}
password: ${id} password: ${tuicPassword}
alpn: alpn:
- h3 - h3
congestion-controller: ${tuicAlgorithm} congestion-controller: ${tuicAlgorithm}
@ -4617,7 +4624,7 @@ EOF
sni: ${email} sni: ${email}
EOF EOF
echoContent yellow "\n ---> 二维码 Tuic" echoContent yellow "\n ---> 二维码 Tuic"
echoContent green " https://api.qrserver.com/v1/create-qr-code/?size=400x400&data=tuic%3A%2F%2F${id}%3A${id}%40${currentHost}%3A${tuicPort}%3Fcongestion_control%3D${tuicAlgorithm}%26alpn%3Dh3%26sni%3D${currentHost}%26udp_relay_mode%3Dquic%26allow_insecure%3D0%23${email}\n" echoContent green " https://api.qrserver.com/v1/create-qr-code/?size=400x400&data=tuic%3A%2F%2F${tuicUUID}%3A${tuicPassword}%40${currentHost}%3A${tuicPort}%3Fcongestion_control%3D${tuicAlgorithm}%26alpn%3Dh3%26sni%3D${currentHost}%26udp_relay_mode%3Dquic%26allow_insecure%3D0%23${email}\n"
fi fi
} }
@ -4797,7 +4804,7 @@ showAccounts() {
jq -r -c '.inbounds[]|select(.type=="tuic")|.users[]' "${singBoxConfigPath}config.json" | while read -r user; do jq -r -c '.inbounds[]|select(.type=="tuic")|.users[]' "${singBoxConfigPath}config.json" | while read -r user; do
echoContent skyBlue "\n ---> 账号:$(echo "${user}" | jq -r .name)" echoContent skyBlue "\n ---> 账号:$(echo "${user}" | jq -r .name)"
echo echo
defaultBase64Code tuic "$(echo "${user}" | jq -r .name)" "$(echo "${user}" | jq -r .uuid)" defaultBase64Code tuic "$(echo "${user}" | jq -r .name)" "$(echo "${user}" | jq -r .uuid)_$(echo "${user}" | jq -r .password)"
done done
fi fi
@ -6348,7 +6355,6 @@ EOF
echoContent green " ---> WARP分流卸载成功" echoContent green " ---> WARP分流卸载成功"
fi fi
# sing-box # sing-box
if [[ -n "${singBoxConfigPath}" ]]; then if [[ -n "${singBoxConfigPath}" ]]; then
removeSingBoxRouteRule "wireguard_out_${type}" removeSingBoxRouteRule "wireguard_out_${type}"
@ -6457,6 +6463,7 @@ EOF
elif [[ "${warpStatus}" == "4" ]]; then elif [[ "${warpStatus}" == "4" ]]; then
removeWireGuardRoute "${type}" removeWireGuardRoute "${type}"
removeSingBoxOutbound "wireguard_out_${type}"
else else
echoContent red " ---> 选择错误" echoContent red " ---> 选择错误"
exit 0 exit 0
@ -8477,7 +8484,7 @@ menu() {
cd "$HOME" || exit cd "$HOME" || exit
echoContent red "\n==============================================================" echoContent red "\n=============================================================="
echoContent green "作者mack-a" echoContent green "作者mack-a"
echoContent green "当前版本v2.11.15" echoContent green "当前版本v2.11.16"
echoContent green "Githubhttps://github.com/mack-a/v2ray-agent" echoContent green "Githubhttps://github.com/mack-a/v2ray-agent"
echoContent green "描述:八合一共存脚本\c" echoContent green "描述:八合一共存脚本\c"
showInstallStatus showInstallStatus