feat(脚本): 兼容trojan前置的Hysteria配置、优化端口号展示、移除服务端hysteria上传下载配置
parent
b7086ad750
commit
c5050d8267
55
install.sh
55
install.sh
|
@ -248,7 +248,7 @@ readAcmeTLS() {
|
||||||
readCustomPort() {
|
readCustomPort() {
|
||||||
if [[ -n "${configPath}" ]]; then
|
if [[ -n "${configPath}" ]]; then
|
||||||
local port=
|
local port=
|
||||||
port=$(jq -r .inbounds[0].port "${configPath}02_VLESS_TCP_inbounds.json")
|
port=$(jq -r .inbounds[0].port "${configPath}${frontingType}.json")
|
||||||
if [[ "${port}" != "443" ]]; then
|
if [[ "${port}" != "443" ]]; then
|
||||||
customPort=${port}
|
customPort=${port}
|
||||||
fi
|
fi
|
||||||
|
@ -439,7 +439,7 @@ readConfigHostPathUUID() {
|
||||||
currentDefaultPort=
|
currentDefaultPort=
|
||||||
currentUUID=
|
currentUUID=
|
||||||
currentHost=
|
currentHost=
|
||||||
# currentPort=
|
currentPort=
|
||||||
currentAdd=
|
currentAdd=
|
||||||
# 读取path
|
# 读取path
|
||||||
if [[ -n "${configPath}" ]]; then
|
if [[ -n "${configPath}" ]]; then
|
||||||
|
@ -476,7 +476,7 @@ readConfigHostPathUUID() {
|
||||||
if [[ -n "${defaultPortFile}" ]]; then
|
if [[ -n "${defaultPortFile}" ]]; then
|
||||||
currentDefaultPort=$(echo "${defaultPortFile}" | awk -F [_] '{print $4}')
|
currentDefaultPort=$(echo "${defaultPortFile}" | awk -F [_] '{print $4}')
|
||||||
else
|
else
|
||||||
currentDefaultPort=$(jq -r .inbounds[0].port ${configPath}02_VLESS_TCP_inbounds.json)
|
currentDefaultPort=$(jq -r .inbounds[0].port ${configPath}${frontingType}.json)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
@ -487,7 +487,7 @@ readConfigHostPathUUID() {
|
||||||
if [[ "${currentAdd}" == "null" ]]; then
|
if [[ "${currentAdd}" == "null" ]]; then
|
||||||
currentAdd=${currentHost}
|
currentAdd=${currentHost}
|
||||||
fi
|
fi
|
||||||
# currentPort=$(jq .inbounds[0].port ${configPath}${frontingType}.json)
|
currentPort=$(jq .inbounds[0].port ${configPath}${frontingType}.json)
|
||||||
|
|
||||||
elif [[ "${coreInstallType}" == "2" || "${coreInstallType}" == "3" ]]; then
|
elif [[ "${coreInstallType}" == "2" || "${coreInstallType}" == "3" ]]; then
|
||||||
if [[ "${coreInstallType}" == "3" ]]; then
|
if [[ "${coreInstallType}" == "3" ]]; then
|
||||||
|
@ -502,7 +502,7 @@ readConfigHostPathUUID() {
|
||||||
currentAdd=${currentHost}
|
currentAdd=${currentHost}
|
||||||
fi
|
fi
|
||||||
currentUUID=$(jq -r .inbounds[0].settings.clients[0].id ${configPath}${frontingType}.json)
|
currentUUID=$(jq -r .inbounds[0].settings.clients[0].id ${configPath}${frontingType}.json)
|
||||||
# currentPort=$(jq .inbounds[0].port ${configPath}${frontingType}.json)
|
currentPort=$(jq .inbounds[0].port ${configPath}${frontingType}.json)
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -588,12 +588,11 @@ initVar "$1"
|
||||||
checkSystem
|
checkSystem
|
||||||
checkCPUVendor
|
checkCPUVendor
|
||||||
readInstallType
|
readInstallType
|
||||||
readCustomPort
|
|
||||||
readInstallProtocolType
|
readInstallProtocolType
|
||||||
readConfigHostPathUUID
|
readConfigHostPathUUID
|
||||||
readInstallAlpn
|
readInstallAlpn
|
||||||
|
readCustomPort
|
||||||
checkBTPanel
|
checkBTPanel
|
||||||
|
|
||||||
# -------------------------------------------------------------
|
# -------------------------------------------------------------
|
||||||
|
|
||||||
# 初始化安装目录
|
# 初始化安装目录
|
||||||
|
@ -1253,15 +1252,20 @@ acmeInstallSSL() {
|
||||||
# 自定义端口
|
# 自定义端口
|
||||||
customPortFunction() {
|
customPortFunction() {
|
||||||
local historyCustomPortStatus=
|
local historyCustomPortStatus=
|
||||||
if [[ -n "${customPort}" ]]; then
|
local showPort=
|
||||||
|
if [[ -n "${customPort}" || -n "${currentPort}" ]]; then
|
||||||
echo
|
echo
|
||||||
read -r -p "读取到上次安装时的端口,是否使用上次安装时的端口 ?[y/n]:" historyCustomPortStatus
|
read -r -p "读取到上次安装时的端口,是否使用上次安装时的端口 ?[y/n]:" historyCustomPortStatus
|
||||||
if [[ "${historyCustomPortStatus}" == "y" ]]; then
|
if [[ "${historyCustomPortStatus}" == "y" ]]; then
|
||||||
echoContent yellow "\n ---> 端口: ${customPort}"
|
showPort="${currentPort}"
|
||||||
|
if [[ -n "${customPort}" ]]; then
|
||||||
|
showPort="${customPort}"
|
||||||
|
fi
|
||||||
|
echoContent yellow "\n ---> 端口: ${showPort}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "${historyCustomPortStatus}" == "n" || -z "${customPort}" ]]; then
|
if [[ "${historyCustomPortStatus}" == "n" ]] && [[ -z "${customPort}" && -z "${currentPort}" ]]; then
|
||||||
echo
|
echo
|
||||||
echoContent yellow "请输入端口[默认: 443],如自定义端口,只允许使用DNS申请证书[回车使用默认]"
|
echoContent yellow "请输入端口[默认: 443],如自定义端口,只允许使用DNS申请证书[回车使用默认]"
|
||||||
read -r -p "端口:" customPort
|
read -r -p "端口:" customPort
|
||||||
|
@ -1276,8 +1280,6 @@ customPortFunction() {
|
||||||
else
|
else
|
||||||
echoContent yellow "\n ---> 端口: 443"
|
echoContent yellow "\n ---> 端口: 443"
|
||||||
fi
|
fi
|
||||||
else
|
|
||||||
echoContent yellow "\n ---> 端口: ${currentPort}"
|
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2154,6 +2156,11 @@ addClientsHysteria() {
|
||||||
if [[ ${addClientsStatus} == "true" && -n "${previousClients}" ]]; then
|
if [[ ${addClientsStatus} == "true" && -n "${previousClients}" ]]; then
|
||||||
local uuids=
|
local uuids=
|
||||||
uuids=$(echo "${previousClients}" | jq -r [.[].id])
|
uuids=$(echo "${previousClients}" | jq -r [.[].id])
|
||||||
|
|
||||||
|
|
||||||
|
if [[ "${frontingType}" == "02_trojan_TCP_inbounds" ]]; then
|
||||||
|
uuids=$(echo "${previousClients}" | jq -r [.[].password])
|
||||||
|
fi
|
||||||
config=$(jq -r ".auth.config = ${uuids}" "${path}")
|
config=$(jq -r ".auth.config = ${uuids}" "${path}")
|
||||||
echo "${config}" | jq . >"${path}"
|
echo "${config}" | jq . >"${path}"
|
||||||
fi
|
fi
|
||||||
|
@ -2252,7 +2259,7 @@ initHysteriaConfig() {
|
||||||
initHysteriaProtocol
|
initHysteriaProtocol
|
||||||
initHysteriaNetwork
|
initHysteriaNetwork
|
||||||
|
|
||||||
getClients "${configPath}/02_VLESS_TCP_inbounds.json" true
|
getClients "${configPath}${frontingType}.json" true
|
||||||
cat <<EOF >/etc/v2ray-agent/hysteria/conf/config.json
|
cat <<EOF >/etc/v2ray-agent/hysteria/conf/config.json
|
||||||
{
|
{
|
||||||
"listen": ":${hysteriaPort}",
|
"listen": ":${hysteriaPort}",
|
||||||
|
@ -2264,8 +2271,6 @@ initHysteriaConfig() {
|
||||||
"mode": "passwords",
|
"mode": "passwords",
|
||||||
"config": []
|
"config": []
|
||||||
},
|
},
|
||||||
"up_mbps":${hysteriaClientUploadSpeed},
|
|
||||||
"down_mbps":${hysteriaClientDownloadSpeed},
|
|
||||||
"alpn": "h3",
|
"alpn": "h3",
|
||||||
"recv_window_conn": 15728640,
|
"recv_window_conn": 15728640,
|
||||||
"recv_window_client": 67108864,
|
"recv_window_client": 67108864,
|
||||||
|
@ -3379,13 +3384,21 @@ showAccounts() {
|
||||||
if echo ${currentInstallProtocolType} | grep -q 6; then
|
if echo ${currentInstallProtocolType} | grep -q 6; then
|
||||||
echoContent skyBlue "\n================================ Hysteria TLS ================================\n"
|
echoContent skyBlue "\n================================ Hysteria TLS ================================\n"
|
||||||
echoContent red "\n --->Hysteria速度依赖与本地的网络环境,如果被QoS使用体验会非常差。IDC也有可能认为是攻击,请谨慎使用"
|
echoContent red "\n --->Hysteria速度依赖与本地的网络环境,如果被QoS使用体验会非常差。IDC也有可能认为是攻击,请谨慎使用"
|
||||||
jq .auth.config ${hysteriaConfigPath}config.json | jq -r '.[]' | while read -r user; do
|
|
||||||
local vlessUser=
|
|
||||||
vlessUser=$(jq '.inbounds[0].settings.clients[]|select(.id=="'"${user}"'")' ${configPath}02_VLESS_TCP_inbounds.json)
|
|
||||||
local email=
|
|
||||||
email=$(echo "${vlessUser}" | jq -r .email)
|
|
||||||
|
|
||||||
if [[ -n ${vlessUser} ]]; then
|
jq .auth.config ${hysteriaConfigPath}config.json | jq -r '.[]' | while read -r user; do
|
||||||
|
local defaultUser=
|
||||||
|
local uuidType=
|
||||||
|
uuidType=".id"
|
||||||
|
|
||||||
|
if [[ "${frontingType}" == "02_trojan_TCP_inbounds" ]]; then
|
||||||
|
uuidType=".password"
|
||||||
|
fi
|
||||||
|
|
||||||
|
defaultUser=$(jq '.inbounds[0].settings.clients[]|select('${uuidType}'=="'"${user}"'")' ${configPath}${frontingType}.json)
|
||||||
|
local email=
|
||||||
|
email=$(echo "${defaultUser}" | jq -r .email)
|
||||||
|
|
||||||
|
if [[ -n ${defaultUser} ]]; then
|
||||||
echoContent skyBlue "\n ---> 账号:${email}"
|
echoContent skyBlue "\n ---> 账号:${email}"
|
||||||
echo
|
echo
|
||||||
defaultBase64Code hysteria "${email}" "${user}"
|
defaultBase64Code hysteria "${email}" "${user}"
|
||||||
|
|
Loading…
Reference in New Issue