mirror of https://github.com/mack-a/v2ray-agent
feat(脚本): Hysteria2切换为自有算法、增加Hysteria2限制带宽、增加Hysteria2 Clash.Meta本地带宽限制
parent
b38261f8e4
commit
3f40cba268
64
install.sh
64
install.sh
|
@ -264,13 +264,13 @@ initVar() {
|
||||||
hysteriaProtocol=
|
hysteriaProtocol=
|
||||||
|
|
||||||
# hysteria延迟
|
# hysteria延迟
|
||||||
hysteriaLag=
|
# hysteriaLag=
|
||||||
|
|
||||||
# hysteria下行速度
|
# hysteria下行速度
|
||||||
hysteriaClientDownloadSpeed=
|
hysteria2ClientDownloadSpeed=
|
||||||
|
|
||||||
# hysteria上行速度
|
# hysteria上行速度
|
||||||
hysteriaClientUploadSpeed=
|
hysteria2ClientUploadSpeed=
|
||||||
|
|
||||||
# Reality
|
# Reality
|
||||||
realityPrivateKey=
|
realityPrivateKey=
|
||||||
|
@ -551,8 +551,8 @@ checkFirewalldAllowPort() {
|
||||||
readHysteriaConfig() {
|
readHysteriaConfig() {
|
||||||
if [[ -n "${hysteriaConfigPath}" ]]; then
|
if [[ -n "${hysteriaConfigPath}" ]]; then
|
||||||
# hysteriaLag=$(jq -r .hysteriaLag <"${hysteriaConfigPath}client_network.json")
|
# hysteriaLag=$(jq -r .hysteriaLag <"${hysteriaConfigPath}client_network.json")
|
||||||
# hysteriaClientDownloadSpeed=$(jq -r .hysteriaClientDownloadSpeed <"${hysteriaConfigPath}client_network.json")
|
# hysteria2ClientDownloadSpeed=$(jq -r .hysteria2ClientDownloadSpeed <"${hysteriaConfigPath}client_network.json")
|
||||||
# hysteriaClientUploadSpeed=$(jq -r .hysteriaClientUploadSpeed <"${hysteriaConfigPath}client_network.json")
|
# hysteria2ClientUploadSpeed=$(jq -r .hysteria2ClientUploadSpeed <"${hysteriaConfigPath}client_network.json")
|
||||||
hysteriaPort=$(jq -r .listen <"${hysteriaConfigPath}config.json" | awk -F "[:]" '{print $2}')
|
hysteriaPort=$(jq -r .listen <"${hysteriaConfigPath}config.json" | awk -F "[:]" '{print $2}')
|
||||||
# hysteriaProtocol=$(jq -r .protocol <"${hysteriaConfigPath}config.json")
|
# hysteriaProtocol=$(jq -r .protocol <"${hysteriaConfigPath}config.json")
|
||||||
fi
|
fi
|
||||||
|
@ -567,6 +567,8 @@ readSingBoxConfig() {
|
||||||
|
|
||||||
if grep -q 'hysteria2' </etc/v2ray-agent/sing-box/conf/config.json; then
|
if grep -q 'hysteria2' </etc/v2ray-agent/sing-box/conf/config.json; then
|
||||||
hysteriaPort=$(jq -r '.inbounds[]|select(.type=="hysteria2")|(.listen_port)' <"${singBoxConfigPath}config.json")
|
hysteriaPort=$(jq -r '.inbounds[]|select(.type=="hysteria2")|(.listen_port)' <"${singBoxConfigPath}config.json")
|
||||||
|
hysteria2ClientUploadSpeed=$(jq -r '.inbounds[]|select(.type=="hysteria2")|(.up_mbps)' <"${singBoxConfigPath}config.json")
|
||||||
|
hysteria2ClientDownloadSpeed=$(jq -r '.inbounds[]|select(.type=="hysteria2")|(.down_mbps)' <"${singBoxConfigPath}config.json")
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
@ -2843,37 +2845,21 @@ initHysteriaProtocol() {
|
||||||
}
|
}
|
||||||
|
|
||||||
# 初始化hysteria网络信息
|
# 初始化hysteria网络信息
|
||||||
initHysteriaNetwork() {
|
initHysteria2Network() {
|
||||||
|
|
||||||
echoContent yellow "请输入本地到服务器的平均延迟,请按照真实情况填写(默认:180,单位:ms)"
|
echoContent yellow "请输入本地带宽峰值的下行速度(默认:50,单位:Mbps)"
|
||||||
read -r -p "延迟:" hysteriaLag
|
read -r -p "下行速度:" hysteria2ClientDownloadSpeed
|
||||||
if [[ -z "${hysteriaLag}" ]]; then
|
if [[ -z "${hysteria2ClientDownloadSpeed}" ]]; then
|
||||||
hysteriaLag=180
|
hysteria2ClientDownloadSpeed=50
|
||||||
echoContent yellow "\n ---> 延迟: ${hysteriaLag}\n"
|
echoContent yellow "\n ---> 下行速度: ${hysteria2ClientDownloadSpeed}\n"
|
||||||
fi
|
|
||||||
|
|
||||||
echoContent yellow "请输入本地带宽峰值的下行速度(默认:100,单位:Mbps)"
|
|
||||||
read -r -p "下行速度:" hysteriaClientDownloadSpeed
|
|
||||||
if [[ -z "${hysteriaClientDownloadSpeed}" ]]; then
|
|
||||||
hysteriaClientDownloadSpeed=100
|
|
||||||
echoContent yellow "\n ---> 下行速度: ${hysteriaClientDownloadSpeed}\n"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echoContent yellow "请输入本地带宽峰值的上行速度(默认:50,单位:Mbps)"
|
echoContent yellow "请输入本地带宽峰值的上行速度(默认:50,单位:Mbps)"
|
||||||
read -r -p "上行速度:" hysteriaClientUploadSpeed
|
read -r -p "上行速度:" hysteria2ClientUploadSpeed
|
||||||
if [[ -z "${hysteriaClientUploadSpeed}" ]]; then
|
if [[ -z "${hysteria2ClientUploadSpeed}" ]]; then
|
||||||
hysteriaClientUploadSpeed=50
|
hysteria2ClientUploadSpeed=50
|
||||||
echoContent yellow "\n ---> 上行速度: ${hysteriaClientUploadSpeed}\n"
|
echoContent yellow "\n ---> 上行速度: ${hysteria2ClientUploadSpeed}\n"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cat <<EOF >/etc/v2ray-agent/hysteria/conf/client_network.json
|
|
||||||
{
|
|
||||||
"hysteriaLag":"${hysteriaLag}",
|
|
||||||
"hysteriaClientUploadSpeed":"${hysteriaClientUploadSpeed}",
|
|
||||||
"hysteriaClientDownloadSpeed":"${hysteriaClientDownloadSpeed}"
|
|
||||||
}
|
|
||||||
EOF
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# hy端口跳跃
|
# hy端口跳跃
|
||||||
|
@ -3143,6 +3129,7 @@ initSingBoxTuicConfig() {
|
||||||
"congestion_control": "${tuicAlgorithm}",
|
"congestion_control": "${tuicAlgorithm}",
|
||||||
"tls": {
|
"tls": {
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
|
"server_name":"${currentHost}",
|
||||||
"alpn": [
|
"alpn": [
|
||||||
"h3"
|
"h3"
|
||||||
],
|
],
|
||||||
|
@ -3373,7 +3360,8 @@ initSingBoxHysteria2Config() {
|
||||||
echoContent skyBlue "\n进度 $1/${totalProgress} : 初始化Hysteria2配置"
|
echoContent skyBlue "\n进度 $1/${totalProgress} : 初始化Hysteria2配置"
|
||||||
|
|
||||||
initHysteriaPort
|
initHysteriaPort
|
||||||
# todo 123123
|
initHysteria2Network
|
||||||
|
|
||||||
cat <<EOF >/etc/v2ray-agent/sing-box/conf/config/hysteria2.json
|
cat <<EOF >/etc/v2ray-agent/sing-box/conf/config/hysteria2.json
|
||||||
{
|
{
|
||||||
"inbounds": [
|
"inbounds": [
|
||||||
|
@ -3382,8 +3370,11 @@ initSingBoxHysteria2Config() {
|
||||||
"listen": "::",
|
"listen": "::",
|
||||||
"listen_port": ${hysteriaPort},
|
"listen_port": ${hysteriaPort},
|
||||||
"users": $(initXrayClients 6),
|
"users": $(initXrayClients 6),
|
||||||
|
"up_mbps":${hysteria2ClientUploadSpeed},
|
||||||
|
"down_mbps":${hysteria2ClientDownloadSpeed},
|
||||||
"tls": {
|
"tls": {
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
|
"server_name":"${currentHost}",
|
||||||
"alpn": [
|
"alpn": [
|
||||||
"h3"
|
"h3"
|
||||||
],
|
],
|
||||||
|
@ -3394,7 +3385,6 @@ initSingBoxHysteria2Config() {
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
# initSingBoxSocks5OutboundsConfig
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# sing-box Tuic安装
|
# sing-box Tuic安装
|
||||||
|
@ -4530,9 +4520,13 @@ EOF
|
||||||
server: ${currentHost}
|
server: ${currentHost}
|
||||||
port: ${hysteriaPort}
|
port: ${hysteriaPort}
|
||||||
password: ${id}
|
password: ${id}
|
||||||
|
alpn:
|
||||||
|
- h3
|
||||||
sni: ${currentHost}
|
sni: ${currentHost}
|
||||||
|
up: "${hysteria2ClientDownloadSpeed} Mbps"
|
||||||
|
down: "${hysteria2ClientUploadSpeed} Mbps"
|
||||||
EOF
|
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"
|
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
|
elif [[ "${type}" == "vlessReality" ]]; then
|
||||||
|
@ -8429,7 +8423,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.10"
|
echoContent green "当前版本:v2.11.11"
|
||||||
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