mirror of https://github.com/mack-a/v2ray-agent
feat(脚本): 优化hysteria、修复协议无法修改的问题
parent
b715e86283
commit
59f1983ef6
47
install.sh
47
install.sh
|
@ -2142,8 +2142,21 @@ addClientsHysteria() {
|
||||||
|
|
||||||
# 初始化hysteria端口
|
# 初始化hysteria端口
|
||||||
initHysteriaPort() {
|
initHysteriaPort() {
|
||||||
echoContent yellow "请输入Hysteria端口[例: 10000],不可与其他服务重复"
|
readHysteriaConfig
|
||||||
read -r -p "端口:" hysteriaPort
|
if [[ -n "${hysteriaPort}" ]]; then
|
||||||
|
read -r -p "读取到上次安装时的端口,是否使用上次安装时的端口 ?[y/n]:" historyHysteriaPortStatus
|
||||||
|
if [[ "${historyHysteriaPortStatus}" == "y" ]]; then
|
||||||
|
echoContent yellow "\n ---> 端口: ${hysteriaPort}"
|
||||||
|
else
|
||||||
|
hysteriaPort=
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -z "${hysteriaPort}" ]]; then
|
||||||
|
echoContent yellow "请输入Hysteria端口[例: 10000],不可与其他服务重复"
|
||||||
|
read -r -p "端口:" hysteriaPort
|
||||||
|
fi
|
||||||
|
|
||||||
if [[ -z ${hysteriaPort} ]]; then
|
if [[ -z ${hysteriaPort} ]]; then
|
||||||
echoContent red "\n ---> 端口不可为空"
|
echoContent red "\n ---> 端口不可为空"
|
||||||
initHysteriaPort "$2"
|
initHysteriaPort "$2"
|
||||||
|
@ -2177,6 +2190,7 @@ initHysteriaProtocol() {
|
||||||
hysteriaProtocol="udp"
|
hysteriaProtocol="udp"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
echoContent yellow "\n ---> 协议: ${hysteriaProtocol}\n"
|
||||||
}
|
}
|
||||||
|
|
||||||
# 初始化hysteria网络信息
|
# 初始化hysteria网络信息
|
||||||
|
@ -2186,18 +2200,21 @@ initHysteriaNetwork() {
|
||||||
read -r -p "延迟:" hysteriaLag
|
read -r -p "延迟:" hysteriaLag
|
||||||
if [[ -z "${hysteriaLag}" ]]; then
|
if [[ -z "${hysteriaLag}" ]]; then
|
||||||
hysteriaLag=180
|
hysteriaLag=180
|
||||||
|
echoContent yellow "\n ---> 延迟: ${hysteriaLag}\n"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echoContent yellow "请输入本地带宽峰值的下行速度(默认:100,单位:Mbps)"
|
echoContent yellow "请输入本地带宽峰值的下行速度(默认:100,单位:Mbps)"
|
||||||
read -r -p "延迟:" hysteriaClientDownloadSpeed
|
read -r -p "下行速度:" hysteriaClientDownloadSpeed
|
||||||
if [[ -z "${hysteriaClientDownloadSpeed}" ]]; then
|
if [[ -z "${hysteriaClientDownloadSpeed}" ]]; then
|
||||||
hysteriaClientDownloadSpeed=100
|
hysteriaClientDownloadSpeed=100
|
||||||
|
echoContent yellow "\n ---> 下行速度: ${hysteriaClientDownloadSpeed}\n"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echoContent yellow "请输入本地带宽峰值的上行速度(默认:50,单位:Mbps)"
|
echoContent yellow "请输入本地带宽峰值的上行速度(默认:50,单位:Mbps)"
|
||||||
read -r -p "延迟:" hysteriaClientUploadSpeed
|
read -r -p "上行速度:" hysteriaClientUploadSpeed
|
||||||
if [[ -z "${hysteriaClientUploadSpeed}" ]]; then
|
if [[ -z "${hysteriaClientUploadSpeed}" ]]; then
|
||||||
hysteriaClientUploadSpeed=50
|
hysteriaClientUploadSpeed=50
|
||||||
|
echoContent yellow "\n ---> 上行速度: ${hysteriaClientUploadSpeed}\n"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cat <<EOF >/etc/v2ray-agent/hysteria/conf/client_network.json
|
cat <<EOF >/etc/v2ray-agent/hysteria/conf/client_network.json
|
||||||
|
@ -2221,7 +2238,7 @@ initHysteriaConfig() {
|
||||||
cat <<EOF >/etc/v2ray-agent/hysteria/conf/config.json
|
cat <<EOF >/etc/v2ray-agent/hysteria/conf/config.json
|
||||||
{
|
{
|
||||||
"listen": ":${hysteriaPort}",
|
"listen": ":${hysteriaPort}",
|
||||||
"protocol": "udp",
|
"protocol": "${hysteriaProtocol}",
|
||||||
"disable_udp": false,
|
"disable_udp": false,
|
||||||
"cert": "/etc/v2ray-agent/tls/${currentHost}.crt",
|
"cert": "/etc/v2ray-agent/tls/${currentHost}.crt",
|
||||||
"key": "/etc/v2ray-agent/tls/${currentHost}.key",
|
"key": "/etc/v2ray-agent/tls/${currentHost}.key",
|
||||||
|
@ -5352,18 +5369,26 @@ switchAlpn() {
|
||||||
|
|
||||||
# hysteria管理
|
# hysteria管理
|
||||||
manageHysteria() {
|
manageHysteria() {
|
||||||
|
|
||||||
echoContent skyBlue "\n进度 1/1 : Hysteria管理"
|
echoContent skyBlue "\n进度 1/1 : Hysteria管理"
|
||||||
echoContent red "\n=============================================================="
|
echoContent red "\n=============================================================="
|
||||||
echoContent yellow "1.安装"
|
local hysteriaStatus=
|
||||||
echoContent yellow "2.卸载"
|
if [[ -n "${hysteriaConfigPath}" ]]; then
|
||||||
echoContent yellow "3.更新core"
|
echoContent yellow "1.重新安装"
|
||||||
|
echoContent yellow "2.卸载"
|
||||||
|
echoContent yellow "3.更新core"
|
||||||
|
hysteriaStatus=true
|
||||||
|
else
|
||||||
|
echoContent yellow "1.安装"
|
||||||
|
fi
|
||||||
|
|
||||||
echoContent red "=============================================================="
|
echoContent red "=============================================================="
|
||||||
read -r -p "请选择:" installHysteriaStatus
|
read -r -p "请选择:" installHysteriaStatus
|
||||||
if [[ "${installHysteriaStatus}" == "1" ]]; then
|
if [[ "${installHysteriaStatus}" == "1" ]]; then
|
||||||
hysteriaCoreInstall
|
hysteriaCoreInstall
|
||||||
elif [[ "${installHysteriaStatus}" == "2" ]]; then
|
elif [[ "${installHysteriaStatus}" == "2" && "${hysteriaStatus}" == "true" ]]; then
|
||||||
unInstallHysteriaCore
|
unInstallHysteriaCore
|
||||||
elif [[ "${installHysteriaStatus}" == "3" ]]; then
|
elif [[ "${installHysteriaStatus}" == "3" && "${hysteriaStatus}" == "true" ]]; then
|
||||||
installHysteria 1
|
installHysteria 1
|
||||||
handleHysteria start
|
handleHysteria start
|
||||||
fi
|
fi
|
||||||
|
@ -5373,7 +5398,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.6.6"
|
echoContent green "当前版本:v2.6.7"
|
||||||
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