mirror of https://github.com/mack-a/v2ray-agent
feat(脚本): hysteria2替换为singbox核心,增加tuic、hysteria2订阅
parent
d845585fa2
commit
d2096d0895
328
install.sh
328
install.sh
|
@ -349,12 +349,12 @@ readInstallType() {
|
||||||
hysteriaConfigPath=/etc/v2ray-agent/hysteria/conf/
|
hysteriaConfigPath=/etc/v2ray-agent/hysteria/conf/
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
#
|
|
||||||
# if [[ -d "/etc/v2ray-agent/tuic" && -f "/etc/v2ray-agent/tuic/tuic" ]]; then
|
if [[ -d "/etc/v2ray-agent/tuic" && -f "/etc/v2ray-agent/tuic/tuic" ]]; then
|
||||||
# if [[ -d "/etc/v2ray-agent/tuic/conf" ]] && [[ -f "/etc/v2ray-agent/tuic/conf/config.json" ]]; then
|
if [[ -d "/etc/v2ray-agent/tuic/conf" ]] && [[ -f "/etc/v2ray-agent/tuic/conf/config.json" ]]; then
|
||||||
# tuicConfigPath=/etc/v2ray-agent/tuic/conf/
|
tuicConfigPath=/etc/v2ray-agent/tuic/conf/
|
||||||
# fi
|
fi
|
||||||
# fi
|
fi
|
||||||
|
|
||||||
if [[ -d "/etc/v2ray-agent/sing-box" && -f "/etc/v2ray-agent/sing-box/sing-box" ]]; then
|
if [[ -d "/etc/v2ray-agent/sing-box" && -f "/etc/v2ray-agent/sing-box/sing-box" ]]; then
|
||||||
if [[ -d "/etc/v2ray-agent/sing-box/conf" ]] && [[ -f "/etc/v2ray-agent/sing-box/conf/config.json" ]]; then
|
if [[ -d "/etc/v2ray-agent/sing-box/conf" ]] && [[ -f "/etc/v2ray-agent/sing-box/conf/config.json" ]]; then
|
||||||
|
@ -402,8 +402,8 @@ readInstallProtocolType() {
|
||||||
|
|
||||||
done < <(find ${configPath} -name "*inbounds.json" | awk -F "[.]" '{print $1}')
|
done < <(find ${configPath} -name "*inbounds.json" | awk -F "[.]" '{print $1}')
|
||||||
|
|
||||||
if [[ -n "${hysteriaConfigPath}" ]]; then
|
# if [[ -n "${hysteriaConfigPath}" ]]; then
|
||||||
# if [[ -n "${singBoxConfigPath}" ]] && [[ -f "/etc/v2ray-agent/sing-box/conf/config.json" ]] && grep -q 'hysteria' </etc/v2ray-agent/sing-box/conf/config.json; then
|
if [[ -n "${singBoxConfigPath}" ]] && [[ -f "/etc/v2ray-agent/sing-box/conf/config.json" ]] && grep -q 'hysteria2' </etc/v2ray-agent/sing-box/conf/config.json; then
|
||||||
currentInstallProtocolType=${currentInstallProtocolType}'6'
|
currentInstallProtocolType=${currentInstallProtocolType}'6'
|
||||||
fi
|
fi
|
||||||
# if [[ -n "${tuicConfigPath}" ]]; then
|
# if [[ -n "${tuicConfigPath}" ]]; then
|
||||||
|
@ -558,13 +558,46 @@ readHysteriaConfig() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
# 读取Tuic配置
|
# 读取Tuic配置
|
||||||
readTuicConfig() {
|
readSingBoxConfig() {
|
||||||
# if [[ -n "${tuicConfigPath}" ]]; then
|
if [[ -n "${singBoxConfigPath}" ]] && [[ -f "/etc/v2ray-agent/sing-box/conf/config.json" ]]; then
|
||||||
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 grep -q 'tuic' </etc/v2ray-agent/sing-box/conf/config.json; then
|
||||||
singBoxConfigPath=/etc/v2ray-agent/sing-box/conf/
|
|
||||||
tuicPort=$(jq -r '.inbounds[]|select(.type=="tuic")|(.listen_port)' <"${singBoxConfigPath}config.json")
|
tuicPort=$(jq -r '.inbounds[]|select(.type=="tuic")|(.listen_port)' <"${singBoxConfigPath}config.json")
|
||||||
tuicAlgorithm=$(jq -r '.inbounds[]|select(.type=="tuic")|(.congestion_control)' <"${singBoxConfigPath}config.json")
|
tuicAlgorithm=$(jq -r '.inbounds[]|select(.type=="tuic")|(.congestion_control)' <"${singBoxConfigPath}config.json")
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
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")
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
# 卸载 sing-box
|
||||||
|
unInstallSingBox() {
|
||||||
|
local type=$1
|
||||||
|
if [[ -n "${singBoxConfigPath}" ]] && [[ -f "/etc/v2ray-agent/sing-box/conf/config.json" ]]; then
|
||||||
|
if grep -q 'tuic' </etc/v2ray-agent/sing-box/conf/config.json && [[ "${type}" == "tuic" ]]; then
|
||||||
|
rm "${singBoxConfigPath}config/tuic.json"
|
||||||
|
echoContent yellow " ---> 删除sing-box tuic配置成功"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if grep -q 'hysteria2' </etc/v2ray-agent/sing-box/conf/config.json && [[ "${type}" == "hysteria2" ]]; then
|
||||||
|
rm "${singBoxConfigPath}config/hysteria2.json"
|
||||||
|
echoContent yellow " ---> 删除sing-box hysteria2配置成功"
|
||||||
|
fi
|
||||||
|
singBoxMergeConfig
|
||||||
|
fi
|
||||||
|
|
||||||
|
readInstallType
|
||||||
|
|
||||||
|
if [[ -n "${singBoxConfigPath}" ]]; then
|
||||||
|
echoContent yellow " ---> 检测到有其他配置,保留sing-box核心"
|
||||||
|
handleSingBox stop
|
||||||
|
handleSingBox start
|
||||||
|
else
|
||||||
|
handleSingBox stop
|
||||||
|
rm /etc/systemd/system/sing-box.service
|
||||||
|
rm -rf /etc/v2ray-agent/sing-box/*
|
||||||
|
echoContent green " ---> sing-box 卸载完成"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
# 读取xray reality配置
|
# 读取xray reality配置
|
||||||
readXrayCoreRealityConfig() {
|
readXrayCoreRealityConfig() {
|
||||||
|
@ -2345,7 +2378,7 @@ checkGFWStatue() {
|
||||||
# fi
|
# fi
|
||||||
#}
|
#}
|
||||||
|
|
||||||
安装hysteria开机自启
|
# 安装hysteria开机自启
|
||||||
installHysteriaService() {
|
installHysteriaService() {
|
||||||
echoContent skyBlue "\n进度 $1/${totalProgress} : 配置Hysteria开机自启"
|
echoContent skyBlue "\n进度 $1/${totalProgress} : 配置Hysteria开机自启"
|
||||||
if [[ -n $(find /bin /usr/bin -name "systemctl") ]]; then
|
if [[ -n $(find /bin /usr/bin -name "systemctl") ]]; then
|
||||||
|
@ -2527,35 +2560,35 @@ handleHysteria() {
|
||||||
}
|
}
|
||||||
|
|
||||||
# 操作Tuic
|
# 操作Tuic
|
||||||
#handleTuic() {
|
handleTuic() {
|
||||||
# # shellcheck disable=SC2010
|
# shellcheck disable=SC2010
|
||||||
# if find /bin /usr/bin | grep -q systemctl && ls /etc/systemd/system/ | grep -q tuic.service; then
|
if find /bin /usr/bin | grep -q systemctl && ls /etc/systemd/system/ | grep -q tuic.service; then
|
||||||
# if [[ -z $(pgrep -f "tuic/tuic") ]] && [[ "$1" == "start" ]]; then
|
if [[ -z $(pgrep -f "tuic/tuic") ]] && [[ "$1" == "start" ]]; then
|
||||||
# systemctl start tuic.service
|
systemctl start tuic.service
|
||||||
# elif [[ -n $(pgrep -f "tuic/tuic") ]] && [[ "$1" == "stop" ]]; then
|
elif [[ -n $(pgrep -f "tuic/tuic") ]] && [[ "$1" == "stop" ]]; then
|
||||||
# systemctl stop tuic.service
|
systemctl stop tuic.service
|
||||||
# fi
|
fi
|
||||||
# fi
|
fi
|
||||||
# sleep 0.8
|
sleep 0.8
|
||||||
#
|
|
||||||
# if [[ "$1" == "start" ]]; then
|
if [[ "$1" == "start" ]]; then
|
||||||
# if [[ -n $(pgrep -f "tuic/tuic") ]]; then
|
if [[ -n $(pgrep -f "tuic/tuic") ]]; then
|
||||||
# echoContent green " ---> Tuic启动成功"
|
echoContent green " ---> Tuic启动成功"
|
||||||
# else
|
else
|
||||||
# echoContent red "Tuic启动失败"
|
echoContent red "Tuic启动失败"
|
||||||
# echoContent red "请手动执行【/etc/v2ray-agent/tuic/tuic -c /etc/v2ray-agent/tuic/conf/config.json】,查看错误日志"
|
echoContent red "请手动执行【/etc/v2ray-agent/tuic/tuic -c /etc/v2ray-agent/tuic/conf/config.json】,查看错误日志"
|
||||||
# exit 0
|
exit 0
|
||||||
# fi
|
fi
|
||||||
# elif [[ "$1" == "stop" ]]; then
|
elif [[ "$1" == "stop" ]]; then
|
||||||
# if [[ -z $(pgrep -f "tuic/tuic") ]]; then
|
if [[ -z $(pgrep -f "tuic/tuic") ]]; then
|
||||||
# echoContent green " ---> Tuic关闭成功"
|
echoContent green " ---> Tuic关闭成功"
|
||||||
# else
|
else
|
||||||
# echoContent red "Tuic关闭失败"
|
echoContent red "Tuic关闭失败"
|
||||||
# echoContent red "请手动执行【ps -ef|grep -v grep|grep tuic|awk '{print \$2}'|xargs kill -9】"
|
echoContent red "请手动执行【ps -ef|grep -v grep|grep tuic|awk '{print \$2}'|xargs kill -9】"
|
||||||
# exit 0
|
exit 0
|
||||||
# fi
|
fi
|
||||||
# fi
|
fi
|
||||||
#}
|
}
|
||||||
|
|
||||||
# 操作sing-box
|
# 操作sing-box
|
||||||
handleSingBox() {
|
handleSingBox() {
|
||||||
|
@ -2581,7 +2614,7 @@ handleSingBox() {
|
||||||
if [[ -z $(pgrep -f "sing-box") ]]; then
|
if [[ -z $(pgrep -f "sing-box") ]]; then
|
||||||
echoContent green " ---> sing-box关闭成功"
|
echoContent green " ---> sing-box关闭成功"
|
||||||
else
|
else
|
||||||
echoContent red "sing-box 关闭失败"
|
echoContent red " ---> sing-box关闭失败"
|
||||||
echoContent red "请手动执行【ps -ef|grep -v grep|grep sing-box|awk '{print \$2}'|xargs kill -9】"
|
echoContent red "请手动执行【ps -ef|grep -v grep|grep sing-box|awk '{print \$2}'|xargs kill -9】"
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
@ -2631,11 +2664,6 @@ initXrayClients() {
|
||||||
fi
|
fi
|
||||||
local users=
|
local users=
|
||||||
users=[]
|
users=[]
|
||||||
# if [[ "${type}" == "9" ]]; then
|
|
||||||
# users={}
|
|
||||||
# else
|
|
||||||
# users=[]
|
|
||||||
# fi
|
|
||||||
while read -r user; do
|
while read -r user; do
|
||||||
uuid=$(echo "${user}" | jq -r .id)
|
uuid=$(echo "${user}" | jq -r .id)
|
||||||
email=$(echo "${user}" | jq -r .email | awk -F "[-]" '{print $1}')
|
email=$(echo "${user}" | jq -r .email | awk -F "[-]" '{print $1}')
|
||||||
|
@ -2678,7 +2706,9 @@ initXrayClients() {
|
||||||
|
|
||||||
# hysteria
|
# hysteria
|
||||||
if echo "${type}" | grep -q "6"; then
|
if echo "${type}" | grep -q "6"; then
|
||||||
users=$(echo "${users}" | jq -r ". +=[\"${uuid}\"]")
|
currentUser="{\"password\":\"${uuid}\",\"name\":\"${email}-singbox_hysteria2\"}"
|
||||||
|
|
||||||
|
users=$(echo "${users}" | jq -r ". +=[${currentUser}]")
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# vless reality vision
|
# vless reality vision
|
||||||
|
@ -2752,7 +2782,7 @@ addClientsHysteria() {
|
||||||
|
|
||||||
# 初始化hysteria端口
|
# 初始化hysteria端口
|
||||||
initHysteriaPort() {
|
initHysteriaPort() {
|
||||||
readHysteriaConfig
|
readSingBoxConfig
|
||||||
if [[ -n "${hysteriaPort}" ]]; then
|
if [[ -n "${hysteriaPort}" ]]; then
|
||||||
read -r -p "读取到上次安装时的端口,是否使用上次安装时的端口?[y/n]:" historyHysteriaPortStatus
|
read -r -p "读取到上次安装时的端口,是否使用上次安装时的端口?[y/n]:" historyHysteriaPortStatus
|
||||||
if [[ "${historyHysteriaPortStatus}" == "y" ]]; then
|
if [[ "${historyHysteriaPortStatus}" == "y" ]]; then
|
||||||
|
@ -3015,7 +3045,7 @@ EOF
|
||||||
|
|
||||||
# 初始化tuic端口
|
# 初始化tuic端口
|
||||||
initTuicPort() {
|
initTuicPort() {
|
||||||
readTuicConfig
|
readSingBoxConfig
|
||||||
if [[ -n "${tuicPort}" ]]; then
|
if [[ -n "${tuicPort}" ]]; then
|
||||||
read -r -p "读取到上次安装时的端口,是否使用上次安装时的端口?[y/n]:" historyTuicPortStatus
|
read -r -p "读取到上次安装时的端口,是否使用上次安装时的端口?[y/n]:" historyTuicPortStatus
|
||||||
if [[ "${historyTuicPortStatus}" == "y" ]]; then
|
if [[ "${historyTuicPortStatus}" == "y" ]]; then
|
||||||
|
@ -3119,8 +3149,35 @@ initSingBoxTuicConfig() {
|
||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
# singBox Tuic安装
|
# 初始化 sing-box Hysteria2 配置
|
||||||
# todo 123
|
initSingBoxHysteria2Config() {
|
||||||
|
echoContent skyBlue "\n进度 $1/${totalProgress} : 初始化Hysteria2配置"
|
||||||
|
|
||||||
|
initHysteriaPort
|
||||||
|
# todo 123123
|
||||||
|
cat <<EOF >/etc/v2ray-agent/sing-box/conf/config/hysteria2.json
|
||||||
|
{
|
||||||
|
"inbounds": [
|
||||||
|
{
|
||||||
|
"type": "hysteria2",
|
||||||
|
"listen": "::",
|
||||||
|
"listen_port": ${hysteriaPort},
|
||||||
|
"users": $(initXrayClients 6),
|
||||||
|
"tls": {
|
||||||
|
"enabled": true,
|
||||||
|
"alpn": [
|
||||||
|
"h3"
|
||||||
|
],
|
||||||
|
"certificate_path": "/etc/v2ray-agent/tls/${currentHost}.crt",
|
||||||
|
"key_path": "/etc/v2ray-agent/tls/${currentHost}.key"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
EOF
|
||||||
|
}
|
||||||
|
|
||||||
|
# sing-box Tuic安装
|
||||||
singBoxTuicInstall() {
|
singBoxTuicInstall() {
|
||||||
if ! echo "${currentInstallProtocolType}" | grep -q "0" || [[ -z "${coreInstallType}" ]]; then
|
if ! echo "${currentInstallProtocolType}" | grep -q "0" || [[ -z "${coreInstallType}" ]]; then
|
||||||
echoContent red "\n ---> 由于证书环境依赖,如安装Tuic,请先安装Xray-core的VLESS_TCP_TLS_Vision"
|
echoContent red "\n ---> 由于证书环境依赖,如安装Tuic,请先安装Xray-core的VLESS_TCP_TLS_Vision"
|
||||||
|
@ -3136,6 +3193,21 @@ singBoxTuicInstall() {
|
||||||
showAccounts 4
|
showAccounts 4
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# sing-box hy2安装
|
||||||
|
singBoxHysteria2Install() {
|
||||||
|
if ! echo "${currentInstallProtocolType}" | grep -q "0" || [[ -z "${coreInstallType}" ]]; then
|
||||||
|
echoContent red "\n ---> 由于证书环境依赖,如安装Hysteria2,请先安装Xray-core的VLESS_TCP_TLS_Vision"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
totalProgress=5
|
||||||
|
installSingBox 1
|
||||||
|
initSingBoxHysteria2Config 2
|
||||||
|
singBoxMergeConfig
|
||||||
|
installSingBoxService 3
|
||||||
|
reloadCore
|
||||||
|
showAccounts 4
|
||||||
|
}
|
||||||
|
|
||||||
# 合并config
|
# 合并config
|
||||||
singBoxMergeConfig() {
|
singBoxMergeConfig() {
|
||||||
rm /etc/v2ray-agent/sing-box/conf/config.json >/dev/null 2>&1
|
rm /etc/v2ray-agent/sing-box/conf/config.json >/dev/null 2>&1
|
||||||
|
@ -4220,39 +4292,26 @@ EOF
|
||||||
echoContent green " https://api.qrserver.com/v1/create-qr-code/?size=400x400&data=trojan%3a%2f%2f${id}%40${add}%3a${currentDefaultPort}%3Fencryption%3Dnone%26fp%3Dchrome%26security%3Dtls%26peer%3d${currentHost}%26type%3Dgrpc%26sni%3d${currentHost}%26path%3D${currentPath}trojangrpc%26alpn%3Dh2%26serviceName%3D${currentPath}trojangrpc%23${email}\n"
|
echoContent green " https://api.qrserver.com/v1/create-qr-code/?size=400x400&data=trojan%3a%2f%2f${id}%40${add}%3a${currentDefaultPort}%3Fencryption%3Dnone%26fp%3Dchrome%26security%3Dtls%26peer%3d${currentHost}%26type%3Dgrpc%26sni%3d${currentHost}%26path%3D${currentPath}trojangrpc%26alpn%3Dh2%26serviceName%3D${currentPath}trojangrpc%23${email}\n"
|
||||||
|
|
||||||
elif [[ "${type}" == "hysteria" ]]; then
|
elif [[ "${type}" == "hysteria" ]]; then
|
||||||
# local hysteriaEmail=
|
|
||||||
# hysteriaEmail=$(echo "${email}" | awk -F "[-]" '{print $1}')_hysteria
|
|
||||||
echoContent yellow " ---> Hysteria(TLS)"
|
echoContent yellow " ---> Hysteria(TLS)"
|
||||||
|
|
||||||
echoContent green " hysteria2://${id}@${currentHost}:${hysteriaPort}?peer=${currentHost}&insecure=0&sni=${currentHost}&alpn=h3#hysteria2\n"
|
echoContent green " hysteria2://${id}@${currentHost}:${hysteriaPort}?peer=${currentHost}&insecure=0&sni=${currentHost}&alpn=h3#${email}\n"
|
||||||
# cat <<EOF >>"/etc/v2ray-agent/subscribe_local/default/${user}"
|
cat <<EOF >>"/etc/v2ray-agent/subscribe_local/default/${user}"
|
||||||
#hysteria2://${id}@${currentHost}:${hysteriaPort}?peer=${currentHost}&insecure=0&sni=${currentHost}&alpn=h3#hysteria2
|
hysteria2://${id}@${currentHost}:${hysteriaPort}?peer=${currentHost}&insecure=0&sni=${currentHost}&alpn=h3#${email}
|
||||||
#EOF
|
|
||||||
echoContent yellow " ---> v2rayN(hysteria+TLS)"
|
|
||||||
cat <<EOF >"/etc/v2ray-agent/hysteria/conf/client.json"
|
|
||||||
{
|
|
||||||
"server": "${currentHost}:${hysteriaPort}",
|
|
||||||
"socks5": { "listen": "127.0.0.1:10808", "timeout": 300},
|
|
||||||
"auth":"${id}",
|
|
||||||
"tls":{
|
|
||||||
"sni":"${currentHost}"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
EOF
|
EOF
|
||||||
local v2rayNConf=
|
echoContent yellow " ---> v2rayN(hysteria+TLS)"
|
||||||
v2rayNConf="$(cat /etc/v2ray-agent/hysteria/conf/client.json)"
|
echo "{\"server\": \"${currentHost}:${hysteriaPort}\",\"socks5\": { \"listen\": \"127.0.0.1:10808\", \"timeout\": 300},\"auth\":\"${id}\",\"tls\":{\"sni\":\"${currentHost}\"}}" | jq
|
||||||
echoContent green "${v2rayNConf}\n"
|
|
||||||
|
|
||||||
# cat <<EOF >>"/etc/v2ray-agent/subscribe_local/clashMeta/${user}"
|
cat <<EOF >>"/etc/v2ray-agent/subscribe_local/clashMeta/${user}"
|
||||||
# - name: hysteria2
|
- name: "${email}"
|
||||||
# type: hysteria2
|
type: hysteria2
|
||||||
# server: ${currentHost}
|
server: ${currentHost}
|
||||||
# port: ${hysteriaPort}
|
port: ${hysteriaPort}
|
||||||
# password: ${id}
|
password: ${id}
|
||||||
# sni: ${currentHost}
|
sni: ${currentHost}
|
||||||
#EOF
|
EOF
|
||||||
echoContent yellow " ---> 二维码 Hysteria(TLS)"
|
echoContent yellow " ---> 二维码 Hysteria(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%23hysteria2\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
|
||||||
echoContent yellow " ---> 通用格式(VLESS+reality+uTLS+Vision)"
|
echoContent yellow " ---> 通用格式(VLESS+reality+uTLS+Vision)"
|
||||||
echoContent green " vless://${id}@$(getPublicIP):${currentRealityPort}?encryption=none&security=reality&type=tcp&sni=${currentRealityServerNames}&fp=chrome&pbk=${currentRealityPublicKey}&sid=6ba85179e30d4fc2&flow=xtls-rprx-vision#${email}\n"
|
echoContent green " vless://${id}@$(getPublicIP):${currentRealityPort}?encryption=none&security=reality&type=tcp&sni=${currentRealityServerNames}&fp=chrome&pbk=${currentRealityPublicKey}&sid=6ba85179e30d4fc2&flow=xtls-rprx-vision#${email}\n"
|
||||||
|
@ -4319,6 +4378,9 @@ EOF
|
||||||
echoContent yellow " ---> 格式化明文(Tuic+TLS)"
|
echoContent yellow " ---> 格式化明文(Tuic+TLS)"
|
||||||
echoContent green " 协议类型:Tuic,地址:${currentHost},端口:${tuicPort},uuid:${id},password:${id},congestion-controller:${tuicAlgorithm},alpn: h3,账户名:${email}\n"
|
echoContent green " 协议类型:Tuic,地址:${currentHost},端口:${tuicPort},uuid:${id},password:${id},congestion-controller:${tuicAlgorithm},alpn: h3,账户名:${email}\n"
|
||||||
|
|
||||||
|
cat <<EOF >>"/etc/v2ray-agent/subscribe_local/default/${user}"
|
||||||
|
tuic://${id}@${currentHost}:${tuicPort}?peer=${currentHost}&congestion_control=${tuicAlgorithm}&password=${id}&insecure=0&sni=${currentHost}&alpn=h3#${email}
|
||||||
|
EOF
|
||||||
echoContent yellow " ---> v2rayN(Tuic+TLS)"
|
echoContent yellow " ---> v2rayN(Tuic+TLS)"
|
||||||
echo "{\"relay\": {\"server\": \"${currentHost}:${tuicPort}\",\"uuid\": \"${id}\",\"password\": \"${id}\",\"ip\": \"$(getPublicIP)\",\"congestion_control\": \"${tuicAlgorithm}\",\"alpn\": [\"h3\"]},\"local\": {\"server\": \"127.0.0.1:7798\"},\"log_level\": \"warn\"}" | jq
|
echo "{\"relay\": {\"server\": \"${currentHost}:${tuicPort}\",\"uuid\": \"${id}\",\"password\": \"${id}\",\"ip\": \"$(getPublicIP)\",\"congestion_control\": \"${tuicAlgorithm}\",\"alpn\": [\"h3\"]},\"local\": {\"server\": \"127.0.0.1:7798\"},\"log_level\": \"warn\"}" | jq
|
||||||
|
|
||||||
|
@ -4345,10 +4407,11 @@ showAccounts() {
|
||||||
readInstallType
|
readInstallType
|
||||||
readInstallProtocolType
|
readInstallProtocolType
|
||||||
readConfigHostPathUUID
|
readConfigHostPathUUID
|
||||||
readHysteriaConfig
|
# readHysteriaConfig
|
||||||
|
readSingBoxConfig
|
||||||
readXrayCoreRealityConfig
|
readXrayCoreRealityConfig
|
||||||
readHysteriaPortHopping
|
# readHysteriaPortHopping
|
||||||
readTuicConfig
|
|
||||||
echo
|
echo
|
||||||
echoContent skyBlue "\n进度 $1/${totalProgress} : 账号"
|
echoContent skyBlue "\n进度 $1/${totalProgress} : 账号"
|
||||||
local show
|
local show
|
||||||
|
@ -4473,14 +4536,10 @@ showAccounts() {
|
||||||
fi
|
fi
|
||||||
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"
|
||||||
jq -r .auth.password "${hysteriaConfigPath}config.json" | while read -r user; do
|
jq -r -c '.inbounds[]|select(.type=="hysteria2")|.users[]' "${singBoxConfigPath}config.json" | while read -r user; do
|
||||||
|
echoContent skyBlue "\n ---> 账号:$(echo "${user}" | jq -r .name)"
|
||||||
if [[ -n ${user} ]]; then
|
|
||||||
echoContent skyBlue "\n ---> 账号:hysteria2"
|
|
||||||
echo
|
echo
|
||||||
defaultBase64Code hysteria hysteria2 "${user}"
|
defaultBase64Code hysteria "$(echo "${user}" | jq -r .name)" "$(echo "${user}" | jq -r .password)"
|
||||||
fi
|
|
||||||
|
|
||||||
done
|
done
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
@ -4799,27 +4858,26 @@ unInstall() {
|
||||||
handleXray stop
|
handleXray stop
|
||||||
rm -rf /etc/systemd/system/xray.service
|
rm -rf /etc/systemd/system/xray.service
|
||||||
echoContent green " ---> 删除Xray开机自启完成"
|
echoContent green " ---> 删除Xray开机自启完成"
|
||||||
|
|
||||||
# elif [[ "${coreInstallType}" == "2" ]]; then
|
|
||||||
#
|
|
||||||
# handleV2Ray stop
|
|
||||||
# rm -rf /etc/systemd/system/v2ray.service
|
|
||||||
# echoContent green " ---> 删除V2Ray开机自启完成"
|
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -z "${hysteriaConfigPath}" ]]; then
|
if [[ -n "${hysteriaConfigPath}" ]]; then
|
||||||
handleHysteria stop
|
handleHysteria stop
|
||||||
rm -rf /etc/systemd/system/hysteria.service
|
rm -rf /etc/systemd/system/hysteria.service
|
||||||
echoContent green " ---> 删除Hysteria开机自启完成"
|
echoContent green " ---> 删除Hysteria开机自启完成"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -z "${tuicConfigPath}" ]]; then
|
if [[ -n "${tuicConfigPath}" ]]; then
|
||||||
handleTuic stop
|
handleTuic stop
|
||||||
rm -rf /etc/systemd/system/tuic.service
|
rm -rf /etc/systemd/system/tuic.service
|
||||||
echoContent green " ---> 删除Tuic开机自启完成"
|
echoContent green " ---> 删除Tuic开机自启完成"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [[ -n "${singBoxConfigPath}" ]]; then
|
||||||
|
handleSingBox stop
|
||||||
|
rm -rf /etc/systemd/system/sing-box.service
|
||||||
|
echoContent green " ---> 删除sing-box开机自启完成"
|
||||||
|
fi
|
||||||
|
|
||||||
# if [[ -f "/root/.acme.sh/acme.sh.env" ]] && grep -q 'acme.sh.env' </root/.bashrc; then
|
# if [[ -f "/root/.acme.sh/acme.sh.env" ]] && grep -q 'acme.sh.env' </root/.bashrc; then
|
||||||
# sed -i 's/. "\/root\/.acme.sh\/acme.sh.env"//g' "$(grep '. "/root/.acme.sh/acme.sh.env"' -rl /root/.bashrc)"
|
# sed -i 's/. "\/root\/.acme.sh\/acme.sh.env"//g' "$(grep '. "/root/.acme.sh/acme.sh.env"' -rl /root/.bashrc)"
|
||||||
# fi
|
# fi
|
||||||
|
@ -6435,10 +6493,10 @@ reloadCore() {
|
||||||
# handleV2Ray start
|
# handleV2Ray start
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -n "${hysteriaConfigPath}" ]]; then
|
# if [[ -n "${hysteriaConfigPath}" ]]; then
|
||||||
handleHysteria stop
|
# handleHysteria stop
|
||||||
handleHysteria start
|
# handleHysteria start
|
||||||
fi
|
# fi
|
||||||
|
|
||||||
# if [[ -n "${tuicConfigPath}" ]]; then
|
# if [[ -n "${tuicConfigPath}" ]]; then
|
||||||
# handleTuic stop
|
# handleTuic stop
|
||||||
|
@ -6448,13 +6506,10 @@ reloadCore() {
|
||||||
if [[ -n "${singBoxConfigPath}" ]] && [[ -f "/etc/v2ray-agent/sing-box/conf/config.json" ]] && grep -q 'hysteria' </etc/v2ray-agent/sing-box/conf/config.json; then
|
if [[ -n "${singBoxConfigPath}" ]] && [[ -f "/etc/v2ray-agent/sing-box/conf/config.json" ]] && grep -q 'hysteria' </etc/v2ray-agent/sing-box/conf/config.json; then
|
||||||
handleSingBox stop
|
handleSingBox stop
|
||||||
handleSingBox start
|
handleSingBox start
|
||||||
fi
|
elif [[ -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.json" ]] && grep -q 'tuic' </etc/v2ray-agent/sing-box/conf/config.json; then
|
|
||||||
handleSingBox stop
|
handleSingBox stop
|
||||||
handleSingBox start
|
handleSingBox start
|
||||||
fi
|
fi
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# dns分流
|
# dns分流
|
||||||
|
@ -6783,7 +6838,7 @@ selectCoreInstall() {
|
||||||
echoContent skyBlue "\n功能 1/${totalProgress} : 选择核心安装"
|
echoContent skyBlue "\n功能 1/${totalProgress} : 选择核心安装"
|
||||||
echoContent red "\n=============================================================="
|
echoContent red "\n=============================================================="
|
||||||
echoContent yellow "1.Xray-core"
|
echoContent yellow "1.Xray-core"
|
||||||
echoContent yellow "2.v2ray-core"
|
# echoContent yellow "2.sing-box"
|
||||||
echoContent red "=============================================================="
|
echoContent red "=============================================================="
|
||||||
read -r -p "请选择:" selectCoreType
|
read -r -p "请选择:" selectCoreType
|
||||||
case ${selectCoreType} in
|
case ${selectCoreType} in
|
||||||
|
@ -6920,29 +6975,30 @@ hysteriaCoreInstall() {
|
||||||
}
|
}
|
||||||
# 卸载 hysteria
|
# 卸载 hysteria
|
||||||
unInstallHysteriaCore() {
|
unInstallHysteriaCore() {
|
||||||
|
if [[ -n "${hysteriaConfigPath}" ]]; then
|
||||||
|
echoContent yellow " ---> 新版本依赖sing-box,检测到旧版本hysteria,执行卸载操作"
|
||||||
|
|
||||||
if [[ -z "${hysteriaConfigPath}" ]]; then
|
|
||||||
echoContent red "\n ---> 未安装"
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
deleteHysteriaPortHoppingRules
|
deleteHysteriaPortHoppingRules
|
||||||
handleHysteria stop
|
handleHysteria stop
|
||||||
rm -rf /etc/v2ray-agent/hysteria/*
|
rm -rf /etc/v2ray-agent/hysteria/*
|
||||||
rm ${configPath}02_socks_inbounds_hysteria.json
|
rm ${configPath}02_socks_inbounds_hysteria.json
|
||||||
rm -rf /etc/systemd/system/hysteria.service
|
rm -rf /etc/systemd/system/hysteria.service
|
||||||
echoContent green " ---> 卸载完成"
|
echoContent green " ---> 卸载完成"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# 卸载Tuic
|
# 卸载Tuic
|
||||||
unInstallTuicCore() {
|
unInstallTuicCore() {
|
||||||
|
|
||||||
if [[ -z "${tuicConfigPath}" ]]; then
|
if [[ -n "${tuicConfigPath}" ]]; then
|
||||||
echoContent red "\n ---> 未安装"
|
echoContent yellow " ---> 新版本依赖sing-box,检测到旧版本Tuic,执行卸载操作"
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
handleTuic stop
|
handleTuic stop
|
||||||
rm -rf /etc/v2ray-agent/tuic/*
|
rm -rf /etc/v2ray-agent/tuic/*
|
||||||
rm -rf /etc/systemd/system/tuic.service
|
rm -rf /etc/systemd/system/tuic.service
|
||||||
echoContent green " ---> 卸载完成"
|
echoContent green " ---> 卸载完成"
|
||||||
|
fi
|
||||||
|
|
||||||
}
|
}
|
||||||
unInstallXrayCoreReality() {
|
unInstallXrayCoreReality() {
|
||||||
|
|
||||||
|
@ -7871,32 +7927,28 @@ manageReality() {
|
||||||
|
|
||||||
# hysteria管理
|
# hysteria管理
|
||||||
manageHysteria() {
|
manageHysteria() {
|
||||||
echoContent skyBlue "\n进度 1/1 : Hysteria管理"
|
echoContent skyBlue "\n进度 1/1 : Hysteria2 管理"
|
||||||
echoContent red "\n=============================================================="
|
echoContent red "\n=============================================================="
|
||||||
local hysteriaStatus=
|
local hysteria2Status=
|
||||||
if [[ -n "${hysteriaConfigPath}" ]]; then
|
if [[ -n "${singBoxConfigPath}" ]] && [[ -f "/etc/v2ray-agent/sing-box/conf/config.json" ]] && grep -q 'hysteria2' </etc/v2ray-agent/sing-box/conf/config.json; then
|
||||||
|
echoContent yellow " 依赖第三方sing-box\n"
|
||||||
echoContent yellow "1.重新安装"
|
echoContent yellow "1.重新安装"
|
||||||
echoContent yellow "2.卸载"
|
echoContent yellow "2.卸载"
|
||||||
# echoContent yellow "3.端口跳跃管理"
|
echoContent yellow "3.sing-box core管理"
|
||||||
echoContent yellow "3.core管理"
|
hysteria2Status=true
|
||||||
echoContent yellow "4.查看日志"
|
|
||||||
hysteriaStatus=true
|
|
||||||
else
|
else
|
||||||
echoContent yellow "1.安装"
|
echoContent yellow "1.安装"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echoContent red "=============================================================="
|
echoContent red "=============================================================="
|
||||||
read -r -p "请选择:" installHysteriaStatus
|
read -r -p "请选择:" installHysteria2Status
|
||||||
if [[ "${installHysteriaStatus}" == "1" ]]; then
|
if [[ "${installHysteria2Status}" == "1" ]]; then
|
||||||
hysteriaCoreInstall
|
|
||||||
elif [[ "${installHysteriaStatus}" == "2" && "${hysteriaStatus}" == "true" ]]; then
|
|
||||||
unInstallHysteriaCore
|
unInstallHysteriaCore
|
||||||
# elif [[ "${installHysteriaStatus}" == "3" && "${hysteriaStatus}" == "true" ]]; then
|
singBoxHysteria2Install
|
||||||
# hysteriaPortHoppingMenu
|
elif [[ "${installHysteria2Status}" == "2" && "${hysteria2Status}" == "true" ]]; then
|
||||||
elif [[ "${installHysteriaStatus}" == "3" && "${hysteriaStatus}" == "true" ]]; then
|
unInstallSingBox hysteria2
|
||||||
hysteriaVersionManageMenu 1
|
elif [[ "${installHysteria2Status}" == "3" && "${hysteria2Status}" == "true" ]]; then
|
||||||
elif [[ "${installHysteriaStatus}" == "4" && "${hysteriaStatus}" == "true" ]]; then
|
singBoxVersionManageMenu 1
|
||||||
journalctl -fu hysteria
|
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7905,7 +7957,6 @@ 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 "${tuicConfigPath}" ]]; then
|
|
||||||
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.json" ]] && grep -q 'tuic' </etc/v2ray-agent/sing-box/conf/config.json; then
|
||||||
echoContent yellow " 依赖第三方sing-box\n"
|
echoContent yellow " 依赖第三方sing-box\n"
|
||||||
echoContent yellow "1.重新安装"
|
echoContent yellow "1.重新安装"
|
||||||
|
@ -7919,9 +7970,10 @@ manageTuic() {
|
||||||
echoContent red "=============================================================="
|
echoContent red "=============================================================="
|
||||||
read -r -p "请选择:" installTuicStatus
|
read -r -p "请选择:" installTuicStatus
|
||||||
if [[ "${installTuicStatus}" == "1" ]]; then
|
if [[ "${installTuicStatus}" == "1" ]]; then
|
||||||
|
unInstallTuicCore
|
||||||
singBoxTuicInstall
|
singBoxTuicInstall
|
||||||
elif [[ "${installTuicStatus}" == "2" && "${tuicStatus}" == "true" ]]; then
|
elif [[ "${installTuicStatus}" == "2" && "${tuicStatus}" == "true" ]]; then
|
||||||
unInstallTuicCore
|
unInstallSingBox tuic
|
||||||
elif [[ "${installTuicStatus}" == "3" && "${tuicStatus}" == "true" ]]; then
|
elif [[ "${installTuicStatus}" == "3" && "${tuicStatus}" == "true" ]]; then
|
||||||
singBoxVersionManageMenu 1
|
singBoxVersionManageMenu 1
|
||||||
fi
|
fi
|
||||||
|
@ -8050,7 +8102,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.10.23"
|
echoContent green "当前版本:v2.11.1"
|
||||||
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
|
||||||
|
@ -8074,7 +8126,7 @@ menu() {
|
||||||
echoContent yellow "3.切换Trojan[XTLS]"
|
echoContent yellow "3.切换Trojan[XTLS]"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echoContent yellow "4.Hysteria管理"
|
echoContent yellow "4.Hysteria2管理"
|
||||||
echoContent yellow "5.REALITY管理"
|
echoContent yellow "5.REALITY管理"
|
||||||
echoContent yellow "6.Tuic管理"
|
echoContent yellow "6.Tuic管理"
|
||||||
echoContent skyBlue "-------------------------工具管理-----------------------------"
|
echoContent skyBlue "-------------------------工具管理-----------------------------"
|
||||||
|
|
Loading…
Reference in New Issue