mirror of https://github.com/mack-a/v2ray-agent
feat(脚本): 完善不同核心之间的订阅问题、修改xray-core下hy2和tuic安装异常问题以及订阅显示问题
parent
5215cbf8b9
commit
20f5ed6d34
91
install.sh
91
install.sh
|
@ -366,10 +366,12 @@ readInstallType() {
|
||||||
if [[ -f "${configPath}07_VLESS_vision_reality_inbounds.json" ]]; then
|
if [[ -f "${configPath}07_VLESS_vision_reality_inbounds.json" ]]; then
|
||||||
realityStatus=1
|
realityStatus=1
|
||||||
fi
|
fi
|
||||||
|
if [[ -f "/etc/v2ray-agent/sing-box/conf/config/06_hysteria2_inbounds.json" || -f "/etc/v2ray-agent/sing-box/conf/config/09_tuic_inbounds.json" ]]; then
|
||||||
|
singBoxConfigPath=/etc/v2ray-agent/sing-box/conf/config/
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
elif [[ -d "/etc/v2ray-agent/sing-box" && -f "/etc/v2ray-agent/sing-box/sing-box" && -f "/etc/v2ray-agent/sing-box/conf/config.json" ]]; then
|
||||||
# 检测sing-box
|
# 检测sing-box
|
||||||
if [[ -d "/etc/v2ray-agent/sing-box" && -f "/etc/v2ray-agent/sing-box/sing-box" && -f "/etc/v2ray-agent/sing-box/conf/config.json" ]]; then
|
|
||||||
coreInstallType=2
|
coreInstallType=2
|
||||||
configPath=/etc/v2ray-agent/sing-box/conf/config/
|
configPath=/etc/v2ray-agent/sing-box/conf/config/
|
||||||
singBoxConfigPath=/etc/v2ray-agent/sing-box/conf/config/
|
singBoxConfigPath=/etc/v2ray-agent/sing-box/conf/config/
|
||||||
|
@ -408,7 +410,7 @@ readInstallProtocolType() {
|
||||||
if echo "${row}" | grep -q hysteria2_inbounds; then
|
if echo "${row}" | grep -q hysteria2_inbounds; then
|
||||||
currentInstallProtocolType=${currentInstallProtocolType}'6'
|
currentInstallProtocolType=${currentInstallProtocolType}'6'
|
||||||
if [[ "${coreInstallType}" == "2" ]]; then
|
if [[ "${coreInstallType}" == "2" ]]; then
|
||||||
frontingType=hysteria2_inbounds
|
frontingType=06_hysteria2_inbounds
|
||||||
singBoxHysteria2Port=$(jq .inbounds[0].listen_port "${row}.json")
|
singBoxHysteria2Port=$(jq .inbounds[0].listen_port "${row}.json")
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
@ -443,11 +445,15 @@ readInstallProtocolType() {
|
||||||
|
|
||||||
done < <(find ${configPath} -name "*inbounds.json" | awk -F "[.]" '{print $1}')
|
done < <(find ${configPath} -name "*inbounds.json" | awk -F "[.]" '{print $1}')
|
||||||
|
|
||||||
if [[ "${coreInstallType}" == "1" && -n "${singBoxConfigPath}" && -f "/etc/v2ray-agent/sing-box/conf/06_hysteria2_inbounds.json" ]]; then
|
if [[ "${coreInstallType}" == "1" && -n "${singBoxConfigPath}" ]]; then
|
||||||
currentInstallProtocolType=${currentInstallProtocolType}'6'
|
if [[ -f "${singBoxConfigPath}06_hysteria2_inbounds.json" ]]; then
|
||||||
fi
|
currentInstallProtocolType=${currentInstallProtocolType}'6'
|
||||||
if [[ "${coreInstallType}" == "1" && -n "${singBoxConfigPath}" && -f "/etc/v2ray-agent/sing-box/conf/09_tuic_inbounds.json" ]]; then
|
singBoxHysteria2Port=$(jq .inbounds[0].listen_port "${singBoxConfigPath}06_hysteria2_inbounds.json")
|
||||||
currentInstallProtocolType=${currentInstallProtocolType}'9'
|
fi
|
||||||
|
if [[ -f "${singBoxConfigPath}09_tuic_inbounds.json" ]]; then
|
||||||
|
currentInstallProtocolType=${currentInstallProtocolType}'9'
|
||||||
|
singBoxTuicPort=$(jq .inbounds[0].listen_port "${singBoxConfigPath}09_tuic_inbounds.json")
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3278,7 +3284,9 @@ singBoxTuicInstall() {
|
||||||
|
|
||||||
totalProgress=5
|
totalProgress=5
|
||||||
installSingBox 1
|
installSingBox 1
|
||||||
initSingBoxTuicConfig 2
|
selectCustomInstallType=9
|
||||||
|
# initSingBoxTuicConfig 2
|
||||||
|
initSingBoxConfig custom 2
|
||||||
installSingBoxService 3
|
installSingBoxService 3
|
||||||
reloadCore
|
reloadCore
|
||||||
showAccounts 4
|
showAccounts 4
|
||||||
|
@ -3297,7 +3305,8 @@ singBoxHysteria2Install() {
|
||||||
|
|
||||||
totalProgress=5
|
totalProgress=5
|
||||||
installSingBox 1
|
installSingBox 1
|
||||||
initSingBoxHysteria2Config 2
|
selectCustomInstallType=6
|
||||||
|
initSingBoxConfig custom 2
|
||||||
installSingBoxService 3
|
installSingBoxService 3
|
||||||
reloadCore
|
reloadCore
|
||||||
showAccounts 4
|
showAccounts 4
|
||||||
|
@ -3850,9 +3859,16 @@ initTCPBrutal() {
|
||||||
# 初始化sing-box配置文件
|
# 初始化sing-box配置文件
|
||||||
initSingBoxConfig() {
|
initSingBoxConfig() {
|
||||||
echoContent skyBlue "\n进度 $2/${totalProgress} : 初始化sing-box配置"
|
echoContent skyBlue "\n进度 $2/${totalProgress} : 初始化sing-box配置"
|
||||||
|
|
||||||
echo
|
echo
|
||||||
local uuid=
|
local uuid=
|
||||||
local addClientsStatus=
|
local addClientsStatus=
|
||||||
|
local sslDomain=
|
||||||
|
if [[ -n "${domain}" ]]; then
|
||||||
|
sslDomain="${domain}"
|
||||||
|
elif [[ -n "${currentHost}" ]]; then
|
||||||
|
sslDomain="${currentHost}"
|
||||||
|
fi
|
||||||
if [[ -n "${currentUUID}" ]]; then
|
if [[ -n "${currentUUID}" ]]; then
|
||||||
read -r -p "读取到上次用户配置,是否使用上次安装的配置 ?[y/n]:" historyUUIDStatus
|
read -r -p "读取到上次用户配置,是否使用上次安装的配置 ?[y/n]:" historyUUIDStatus
|
||||||
if [[ "${historyUUIDStatus}" == "y" ]]; then
|
if [[ "${historyUUIDStatus}" == "y" ]]; then
|
||||||
|
@ -3911,10 +3927,10 @@ initSingBoxConfig() {
|
||||||
"tag":"VLESSTCP",
|
"tag":"VLESSTCP",
|
||||||
"users":$(initSingBoxClients 0),
|
"users":$(initSingBoxClients 0),
|
||||||
"tls":{
|
"tls":{
|
||||||
"server_name": "${domain}",
|
"server_name": "${sslDomain}",
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
"certificate_path": "/etc/v2ray-agent/tls/${domain}.crt",
|
"certificate_path": "/etc/v2ray-agent/tls/${sslDomain}.crt",
|
||||||
"key_path": "/etc/v2ray-agent/tls/${domain}.key"
|
"key_path": "/etc/v2ray-agent/tls/${sslDomain}.key"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
@ -4015,7 +4031,6 @@ EOF
|
||||||
mapfile -t result < <(initSingBoxPort "${singBoxHysteria2Port}")
|
mapfile -t result < <(initSingBoxPort "${singBoxHysteria2Port}")
|
||||||
echoContent green "\n ---> Hysteria2端口:${result[-1]}"
|
echoContent green "\n ---> Hysteria2端口:${result[-1]}"
|
||||||
initHysteria2Network
|
initHysteria2Network
|
||||||
|
|
||||||
cat <<EOF >/etc/v2ray-agent/sing-box/conf/config/06_hysteria2_inbounds.json
|
cat <<EOF >/etc/v2ray-agent/sing-box/conf/config/06_hysteria2_inbounds.json
|
||||||
{
|
{
|
||||||
"inbounds": [
|
"inbounds": [
|
||||||
|
@ -4028,12 +4043,12 @@ EOF
|
||||||
"down_mbps":${hysteria2ClientUploadSpeed},
|
"down_mbps":${hysteria2ClientUploadSpeed},
|
||||||
"tls": {
|
"tls": {
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
"server_name":"${domain}",
|
"server_name":"${sslDomain}",
|
||||||
"alpn": [
|
"alpn": [
|
||||||
"h3"
|
"h3"
|
||||||
],
|
],
|
||||||
"certificate_path": "/etc/v2ray-agent/tls/${domain}.crt",
|
"certificate_path": "/etc/v2ray-agent/tls/${sslDomain}.crt",
|
||||||
"key_path": "/etc/v2ray-agent/tls/${domain}.key"
|
"key_path": "/etc/v2ray-agent/tls/${sslDomain}.key"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
@ -4044,7 +4059,7 @@ EOF
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if echo "${selectCustomInstallType}" | grep -q 9 || [[ "$1" == "all" ]]; then
|
if echo "${selectCustomInstallType}" | grep -q 9 || [[ "$1" == "all" ]]; then
|
||||||
echoContent red "\n================== 配置 Tuic ==================\n"
|
echoContent red "\n==================== 配置 Tuic =====================\n"
|
||||||
echo
|
echo
|
||||||
mapfile -t result < <(initSingBoxPort "${singBoxTuicPort}")
|
mapfile -t result < <(initSingBoxPort "${singBoxTuicPort}")
|
||||||
echoContent green "\n ---> Tuic端口:${result[-1]}"
|
echoContent green "\n ---> Tuic端口:${result[-1]}"
|
||||||
|
@ -4061,12 +4076,12 @@ EOF
|
||||||
"congestion_control": "${tuicAlgorithm}",
|
"congestion_control": "${tuicAlgorithm}",
|
||||||
"tls": {
|
"tls": {
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
"server_name":"${domain}",
|
"server_name":"${sslDomain}",
|
||||||
"alpn": [
|
"alpn": [
|
||||||
"h3"
|
"h3"
|
||||||
],
|
],
|
||||||
"certificate_path": "/etc/v2ray-agent/tls/${domain}.crt",
|
"certificate_path": "/etc/v2ray-agent/tls/${sslDomain}.crt",
|
||||||
"key_path": "/etc/v2ray-agent/tls/${domain}.key"
|
"key_path": "/etc/v2ray-agent/tls/${sslDomain}.key"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
@ -4539,12 +4554,16 @@ showAccounts() {
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
# hysteria2
|
# hysteria2
|
||||||
if echo ${currentInstallProtocolType} | grep -q 6; then
|
if echo ${currentInstallProtocolType} | grep -q 6 || [[ -n "${hysteriaPort}" ]]; then
|
||||||
echoContent skyBlue "\n================================ Hysteria2 TLS [推荐] ================================\n"
|
echoContent skyBlue "\n================================ Hysteria2 TLS [推荐] ================================\n"
|
||||||
jq -r -c '.inbounds[]|.users[]' "${configPath}06_hysteria2_inbounds.json" | while read -r user; do
|
local path="${configPath}"
|
||||||
|
if [[ "${coreInstallType}" == "1" ]]; then
|
||||||
|
path="${singBoxConfigPath}"
|
||||||
|
fi
|
||||||
|
jq -r -c '.inbounds[]|.users[]' "${path}06_hysteria2_inbounds.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 hysteria "${currentDefaultPort}${singBoxHysteria2Port}" "$(echo "${user}" | jq -r .name)" "$(echo "${user}" | jq -r .password)"
|
defaultBase64Code hysteria "${singBoxHysteria2Port}" "$(echo "${user}" | jq -r .name)" "$(echo "${user}" | jq -r .password)"
|
||||||
done
|
done
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
@ -4576,12 +4595,16 @@ showAccounts() {
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
# tuic
|
# tuic
|
||||||
if echo ${currentInstallProtocolType} | grep -q 9; then
|
if echo ${currentInstallProtocolType} | grep -q 9 || [[ -n "${tuicPort}" ]]; then
|
||||||
echoContent skyBlue "\n================================ Tuic TLS [推荐] ================================\n"
|
echoContent skyBlue "\n================================ Tuic TLS [推荐] ================================\n"
|
||||||
jq -r -c '.inbounds[].users[]' "${configPath}09_tuic_inbounds.json" | while read -r user; do
|
local path="${configPath}"
|
||||||
|
if [[ "${coreInstallType}" == "1" ]]; then
|
||||||
|
path="${singBoxConfigPath}"
|
||||||
|
fi
|
||||||
|
jq -r -c '.inbounds[].users[]' "${path}09_tuic_inbounds.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 "${currentDefaultPort}${singBoxTuicPort}" "$(echo "${user}" | jq -r .name)" "$(echo "${user}" | jq -r .uuid)_$(echo "${user}" | jq -r .password)"
|
defaultBase64Code tuic "${singBoxTuicPort}" "$(echo "${user}" | jq -r .name)" "$(echo "${user}" | jq -r .uuid)_$(echo "${user}" | jq -r .password)"
|
||||||
done
|
done
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
@ -6532,7 +6555,8 @@ reloadCore() {
|
||||||
if [[ "${coreInstallType}" == "1" ]]; then
|
if [[ "${coreInstallType}" == "1" ]]; then
|
||||||
handleXray stop
|
handleXray stop
|
||||||
handleXray start
|
handleXray start
|
||||||
elif [[ "${coreInstallType}" == "2" ]]; then
|
fi
|
||||||
|
if [[ "${coreInstallType}" == "2" || -n "${singBoxConfigPath}" ]]; then
|
||||||
handleSingBox stop
|
handleSingBox stop
|
||||||
handleSingBox start
|
handleSingBox start
|
||||||
fi
|
fi
|
||||||
|
@ -7056,7 +7080,7 @@ coreVersionManageMenu() {
|
||||||
|
|
||||||
if [[ "${selectCore}" == "1" ]]; then
|
if [[ "${selectCore}" == "1" ]]; then
|
||||||
xrayVersionManageMenu 1
|
xrayVersionManageMenu 1
|
||||||
elif [[ "${coreInstallType}" == "2" ]]; then
|
elif [[ "${selectCore}" == "2" ]]; then
|
||||||
singBoxVersionManageMenu 1
|
singBoxVersionManageMenu 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
@ -8080,11 +8104,10 @@ manageHysteria() {
|
||||||
echoContent skyBlue "\n进度 1/1 : Hysteria2 管理"
|
echoContent skyBlue "\n进度 1/1 : Hysteria2 管理"
|
||||||
echoContent red "\n=============================================================="
|
echoContent red "\n=============================================================="
|
||||||
local hysteria2Status=
|
local hysteria2Status=
|
||||||
if [[ -n "${singBoxConfigPath}" ]] && [[ -f "/etc/v2ray-agent/sing-box/conf/config.json" ]] && grep -q 'hysteria2' </etc/v2ray-agent/sing-box/conf/config.json; then
|
if [[ -n "${singBoxConfigPath}" ]] && [[ -f "/etc/v2ray-agent/sing-box/conf/config/06_hysteria2_inbounds.json" ]]; then
|
||||||
echoContent yellow " 依赖第三方sing-box\n"
|
echoContent yellow " 依赖第三方sing-box\n"
|
||||||
echoContent yellow "1.重新安装"
|
echoContent yellow "1.重新安装"
|
||||||
echoContent yellow "2.卸载"
|
echoContent yellow "2.卸载"
|
||||||
# echoContent yellow "3.sing-box core管理"
|
|
||||||
hysteria2Status=true
|
hysteria2Status=true
|
||||||
else
|
else
|
||||||
echoContent yellow "1.安装"
|
echoContent yellow "1.安装"
|
||||||
|
@ -8105,7 +8128,7 @@ manageTuic() {
|
||||||
echoContent skyBlue "\n进度 1/1 : Tuic管理"
|
echoContent skyBlue "\n进度 1/1 : Tuic管理"
|
||||||
echoContent red "\n=============================================================="
|
echoContent red "\n=============================================================="
|
||||||
local tuicStatus=
|
local tuicStatus=
|
||||||
if [[ -n "${singBoxConfigPath}" ]] && [[ -f "/etc/v2ray-agent/sing-box/conf/config.json" ]] && grep -q 'tuic' </etc/v2ray-agent/sing-box/conf/config.json; then
|
if [[ -n "${singBoxConfigPath}" ]] && [[ -f "/etc/v2ray-agent/sing-box/conf/config/09_tuic_inbounds.json" ]]; then
|
||||||
echoContent yellow " 依赖第三方sing-box\n"
|
echoContent yellow " 依赖第三方sing-box\n"
|
||||||
echoContent yellow "1.重新安装"
|
echoContent yellow "1.重新安装"
|
||||||
echoContent yellow "2.卸载"
|
echoContent yellow "2.卸载"
|
||||||
|
@ -8220,7 +8243,7 @@ menu() {
|
||||||
cd "$HOME" || exit
|
cd "$HOME" || exit
|
||||||
echoContent red "\n=============================================================="
|
echoContent red "\n=============================================================="
|
||||||
echoContent green "作者:mack-a"
|
echoContent green "作者:mack-a"
|
||||||
echoContent green "当前版本:v3.1.6-beta"
|
echoContent green "当前版本:v3.1.7-beta"
|
||||||
echoContent green "Github:https://github.com/mack-a/v2ray-agent"
|
echoContent green "Github:https://github.com/mack-a/v2ray-agent"
|
||||||
echoContent green "描述:八合一共存脚本\c"
|
echoContent green "描述:八合一共存脚本\c"
|
||||||
showInstallStatus
|
showInstallStatus
|
||||||
|
|
Loading…
Reference in New Issue