From 3f40cba268216cc62ea2a54b241ed6d7ab5152f6 Mon Sep 17 00:00:00 2001 From: mack-a <57424792+mack-a@users.noreply.github.com> Date: Fri, 10 Nov 2023 21:15:06 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E8=84=9A=E6=9C=AC):=20Hysteria2=E5=88=87?= =?UTF-8?q?=E6=8D=A2=E4=B8=BA=E8=87=AA=E6=9C=89=E7=AE=97=E6=B3=95=E3=80=81?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0Hysteria2=E9=99=90=E5=88=B6=E5=B8=A6=E5=AE=BD?= =?UTF-8?q?=E3=80=81=E5=A2=9E=E5=8A=A0Hysteria2=20Clash.Meta=E6=9C=AC?= =?UTF-8?q?=E5=9C=B0=E5=B8=A6=E5=AE=BD=E9=99=90=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- install.sh | 64 +++++++++++++++++++++++++----------------------------- 1 file changed, 29 insertions(+), 35 deletions(-) diff --git a/install.sh b/install.sh index be692f1..caf249c 100644 --- a/install.sh +++ b/install.sh @@ -264,13 +264,13 @@ initVar() { hysteriaProtocol= # hysteria延迟 - hysteriaLag= + # hysteriaLag= # hysteria下行速度 - hysteriaClientDownloadSpeed= + hysteria2ClientDownloadSpeed= # hysteria上行速度 - hysteriaClientUploadSpeed= + hysteria2ClientUploadSpeed= # Reality realityPrivateKey= @@ -551,8 +551,8 @@ checkFirewalldAllowPort() { readHysteriaConfig() { if [[ -n "${hysteriaConfigPath}" ]]; then # hysteriaLag=$(jq -r .hysteriaLag <"${hysteriaConfigPath}client_network.json") - # hysteriaClientDownloadSpeed=$(jq -r .hysteriaClientDownloadSpeed <"${hysteriaConfigPath}client_network.json") - # hysteriaClientUploadSpeed=$(jq -r .hysteriaClientUploadSpeed <"${hysteriaConfigPath}client_network.json") + # hysteria2ClientDownloadSpeed=$(jq -r .hysteria2ClientDownloadSpeed <"${hysteriaConfigPath}client_network.json") + # hysteria2ClientUploadSpeed=$(jq -r .hysteria2ClientUploadSpeed <"${hysteriaConfigPath}client_network.json") hysteriaPort=$(jq -r .listen <"${hysteriaConfigPath}config.json" | awk -F "[:]" '{print $2}') # hysteriaProtocol=$(jq -r .protocol <"${hysteriaConfigPath}config.json") fi @@ -567,6 +567,8 @@ readSingBoxConfig() { if grep -q 'hysteria2' 延迟: ${hysteriaLag}\n" - fi - - echoContent yellow "请输入本地带宽峰值的下行速度(默认:100,单位:Mbps)" - read -r -p "下行速度:" hysteriaClientDownloadSpeed - if [[ -z "${hysteriaClientDownloadSpeed}" ]]; then - hysteriaClientDownloadSpeed=100 - echoContent yellow "\n ---> 下行速度: ${hysteriaClientDownloadSpeed}\n" + echoContent yellow "请输入本地带宽峰值的下行速度(默认:50,单位:Mbps)" + read -r -p "下行速度:" hysteria2ClientDownloadSpeed + if [[ -z "${hysteria2ClientDownloadSpeed}" ]]; then + hysteria2ClientDownloadSpeed=50 + echoContent yellow "\n ---> 下行速度: ${hysteria2ClientDownloadSpeed}\n" fi echoContent yellow "请输入本地带宽峰值的上行速度(默认:50,单位:Mbps)" - read -r -p "上行速度:" hysteriaClientUploadSpeed - if [[ -z "${hysteriaClientUploadSpeed}" ]]; then - hysteriaClientUploadSpeed=50 - echoContent yellow "\n ---> 上行速度: ${hysteriaClientUploadSpeed}\n" + read -r -p "上行速度:" hysteria2ClientUploadSpeed + if [[ -z "${hysteria2ClientUploadSpeed}" ]]; then + hysteria2ClientUploadSpeed=50 + echoContent yellow "\n ---> 上行速度: ${hysteria2ClientUploadSpeed}\n" fi - - cat </etc/v2ray-agent/hysteria/conf/client_network.json -{ - "hysteriaLag":"${hysteriaLag}", - "hysteriaClientUploadSpeed":"${hysteriaClientUploadSpeed}", - "hysteriaClientDownloadSpeed":"${hysteriaClientDownloadSpeed}" -} -EOF - } # hy端口跳跃 @@ -3143,6 +3129,7 @@ initSingBoxTuicConfig() { "congestion_control": "${tuicAlgorithm}", "tls": { "enabled": true, + "server_name":"${currentHost}", "alpn": [ "h3" ], @@ -3373,7 +3360,8 @@ initSingBoxHysteria2Config() { echoContent skyBlue "\n进度 $1/${totalProgress} : 初始化Hysteria2配置" initHysteriaPort - # todo 123123 + initHysteria2Network + cat </etc/v2ray-agent/sing-box/conf/config/hysteria2.json { "inbounds": [ @@ -3382,8 +3370,11 @@ initSingBoxHysteria2Config() { "listen": "::", "listen_port": ${hysteriaPort}, "users": $(initXrayClients 6), + "up_mbps":${hysteria2ClientUploadSpeed}, + "down_mbps":${hysteria2ClientDownloadSpeed}, "tls": { "enabled": true, + "server_name":"${currentHost}", "alpn": [ "h3" ], @@ -3394,7 +3385,6 @@ initSingBoxHysteria2Config() { ] } EOF - # initSingBoxSocks5OutboundsConfig } # sing-box Tuic安装 @@ -4530,9 +4520,13 @@ EOF server: ${currentHost} port: ${hysteriaPort} password: ${id} + alpn: + - h3 sni: ${currentHost} + up: "${hysteria2ClientDownloadSpeed} Mbps" + down: "${hysteria2ClientUploadSpeed} Mbps" EOF - echoContent yellow " ---> 二维码 Hysteria(TLS)" + echoContent yellow " ---> 二维码 Hysteria2(TLS)" echoContent green " https://api.qrserver.com/v1/create-qr-code/?size=400x400&data=hysteria2%3A%2F%2F${id}%40${currentHost}%3A${hysteriaPort}%3Fpeer%3D${currentHost}%26insecure%3D0%26sni%3D${currentHost}%26alpn%3Dh3%23${email}\n" elif [[ "${type}" == "vlessReality" ]]; then @@ -8429,7 +8423,7 @@ menu() { cd "$HOME" || exit echoContent red "\n==============================================================" echoContent green "作者:mack-a" - echoContent green "当前版本:v2.11.10" + echoContent green "当前版本:v2.11.11" echoContent green "Github:https://github.com/mack-a/v2ray-agent" echoContent green "描述:八合一共存脚本\c" showInstallStatus