mirror of https://github.com/mack-a/v2ray-agent
feat(脚本): 添加伪装站点重定向[5->10]、添加端口时可选择默认端口不再是只有443端口,节点也会是默认端口[11->1]
parent
19985869ac
commit
5e7a44efa2
104
install.sh
104
install.sh
|
@ -357,6 +357,7 @@ checkFirewalldAllowPort() {
|
||||||
# 检查文件目录以及path路径
|
# 检查文件目录以及path路径
|
||||||
readConfigHostPathUUID() {
|
readConfigHostPathUUID() {
|
||||||
currentPath=
|
currentPath=
|
||||||
|
currentDefaultPort=
|
||||||
currentUUID=
|
currentUUID=
|
||||||
currentHost=
|
currentHost=
|
||||||
currentPort=
|
currentPort=
|
||||||
|
@ -376,6 +377,16 @@ readConfigHostPathUUID() {
|
||||||
elif [[ $(echo "${fallback}" | jq -r .dest) == 31299 ]]; then
|
elif [[ $(echo "${fallback}" | jq -r .dest) == 31299 ]]; then
|
||||||
currentPath=$(echo "${path}" | awk -F "[v][w][s]" '{print $1}')
|
currentPath=$(echo "${path}" | awk -F "[v][w][s]" '{print $1}')
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
local defaultPortFile=
|
||||||
|
defaultPortFile=$(find ${configPath}* | grep "default")
|
||||||
|
|
||||||
|
if [[ -n "${defaultPortFile}" ]]; then
|
||||||
|
currentDefaultPort=$(echo "${defaultPortFile}" | awk -F [_] '{print $4}')
|
||||||
|
else
|
||||||
|
currentDefaultPort=443
|
||||||
|
fi
|
||||||
|
|
||||||
fi
|
fi
|
||||||
if [[ "${coreInstallType}" == "1" ]]; then
|
if [[ "${coreInstallType}" == "1" ]]; then
|
||||||
currentHost=$(jq -r .inbounds[0].streamSettings.xtlsSettings.certificates[0].certificateFile ${configPath}${frontingType}.json | awk -F '[t][l][s][/]' '{print $2}' | awk -F '[.][c][r][t]' '{print $1}')
|
currentHost=$(jq -r .inbounds[0].streamSettings.xtlsSettings.certificates[0].certificateFile ${configPath}${frontingType}.json | awk -F '[t][l][s][/]' '{print $2}' | awk -F '[.][c][r][t]' '{print $1}')
|
||||||
|
@ -2485,12 +2496,14 @@ defaultBase64Code() {
|
||||||
local port=
|
local port=
|
||||||
if echo "${hostPort}" | grep -q ":"; then
|
if echo "${hostPort}" | grep -q ":"; then
|
||||||
host=$(echo "${hostPort}" | awk -F "[:]" '{print $1}')
|
host=$(echo "${hostPort}" | awk -F "[:]" '{print $1}')
|
||||||
port=$(echo "${hostPort}" | awk -F "[:]" '{print $2}')
|
# port=$(echo "${hostPort}" | awk -F "[:]" '{print $2}')
|
||||||
else
|
else
|
||||||
host=${hostPort}
|
host=${hostPort}
|
||||||
port=443
|
# port=443
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
port=${currentDefaultPort}
|
||||||
|
|
||||||
local path=$5
|
local path=$5
|
||||||
local add=$6
|
local add=$6
|
||||||
|
|
||||||
|
@ -2747,7 +2760,12 @@ showAccounts() {
|
||||||
echoContent red " ---> 未安装"
|
echoContent red " ---> 未安装"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
# 移除nginx302配置
|
||||||
|
removeNginx302() {
|
||||||
|
if grep -q "return 302 http:" </etc/nginx/conf.d/alone.conf && [[ -f "/etc/nginx/conf.d/alone.conf" ]]; then
|
||||||
|
sed '/return 302 http:/d' /etc/nginx/conf.d/alone.conf >/etc/nginx/conf.d/tmpfile && mv /etc/nginx/conf.d/tmpfile /etc/nginx/conf.d/alone.conf
|
||||||
|
fi
|
||||||
|
}
|
||||||
# 更新伪装站
|
# 更新伪装站
|
||||||
updateNginxBlog() {
|
updateNginxBlog() {
|
||||||
echoContent skyBlue "\n进度 $1/${totalProgress} : 更换伪装站点"
|
echoContent skyBlue "\n进度 $1/${totalProgress} : 更换伪装站点"
|
||||||
|
@ -2762,11 +2780,34 @@ updateNginxBlog() {
|
||||||
echoContent yellow "7.企业站02"
|
echoContent yellow "7.企业站02"
|
||||||
echoContent yellow "8.个人博客02"
|
echoContent yellow "8.个人博客02"
|
||||||
echoContent yellow "9.404自动跳转baidu"
|
echoContent yellow "9.404自动跳转baidu"
|
||||||
|
echoContent yellow "10.302重定向网站"
|
||||||
echoContent red "=============================================================="
|
echoContent red "=============================================================="
|
||||||
read -r -p "请选择:" selectInstallNginxBlogType
|
read -r -p "请选择:" selectInstallNginxBlogType
|
||||||
|
|
||||||
|
if [[ "${selectInstallNginxBlogType}" == "10" ]]; then
|
||||||
|
echoContent red "\n=============================================================="
|
||||||
|
echoContent yellow "重定向的优先级更高,配置302之后如果更改伪装站点,根路由下伪装站点将不起作用"
|
||||||
|
echoContent yellow "如想要伪装站点实现作用需删除302重定向配置\n"
|
||||||
|
echoContent yellow "1.添加"
|
||||||
|
echoContent yellow "2.删除"
|
||||||
|
echoContent red "=============================================================="
|
||||||
|
read -r -p "请选择:" redirectStatus
|
||||||
|
|
||||||
|
if [[ "${redirectStatus}" == "1" ]]; then
|
||||||
|
read -r -p "请输入要重定向的域名,例如 www.baidu.com:" redirectDomain
|
||||||
|
removeNginx302
|
||||||
|
sed -i 's/add_header Strict-Transport-Security "max-age=15552000; preload" always;/add_header Strict-Transport-Security "max-age=15552000; preload" always;\nreturn 302 http:\/\/'"${redirectDomain}"';/g' "$(grep 'add_header Strict-Transport-Security "max-age=15552000; preload" always;' -rl /etc/nginx/conf.d/alone.conf)"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ "${redirectStatus}" == "2" ]]; then
|
||||||
|
removeNginx302
|
||||||
|
fi
|
||||||
|
|
||||||
|
handleNginx stop
|
||||||
|
handleNginx start
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
if [[ "${selectInstallNginxBlogType}" =~ ^[1-9]$ ]]; then
|
if [[ "${selectInstallNginxBlogType}" =~ ^[1-9]$ ]]; then
|
||||||
# rm -rf /usr/share/nginx/html
|
|
||||||
rm -rf /usr/share/nginx/*
|
rm -rf /usr/share/nginx/*
|
||||||
if wget --help | grep -q show-progress; then
|
if wget --help | grep -q show-progress; then
|
||||||
wget -c -q --show-progress -P /usr/share/nginx "https://raw.githubusercontent.com/mack-a/v2ray-agent/master/fodder/blog/unable/html${selectInstallNginxBlogType}.zip" >/dev/null
|
wget -c -q --show-progress -P /usr/share/nginx "https://raw.githubusercontent.com/mack-a/v2ray-agent/master/fodder/blog/unable/html${selectInstallNginxBlogType}.zip" >/dev/null
|
||||||
|
@ -2800,24 +2841,39 @@ addCorePort() {
|
||||||
read -r -p "请选择:" selectNewPortType
|
read -r -p "请选择:" selectNewPortType
|
||||||
if [[ "${selectNewPortType}" == "1" ]]; then
|
if [[ "${selectNewPortType}" == "1" ]]; then
|
||||||
read -r -p "请输入端口号:" newPort
|
read -r -p "请输入端口号:" newPort
|
||||||
|
read -r -p "请输入默认的端口号,同时会更改订阅端口以及节点端口,[回车]默认443:" defaultPort
|
||||||
|
|
||||||
|
if [[ -n "${defaultPort}" ]]; then
|
||||||
|
rm -rf "$(find ${configPath}* | grep "default")"
|
||||||
|
fi
|
||||||
|
|
||||||
if [[ -n "${newPort}" ]]; then
|
if [[ -n "${newPort}" ]]; then
|
||||||
|
|
||||||
while read -r port; do
|
while read -r port; do
|
||||||
cat <<EOF >"${configPath}02_dokodemodoor_inbounds_${port}.json"
|
rm -rf "$(find ${configPath}* | grep "${port}")"
|
||||||
|
|
||||||
|
local fileName=
|
||||||
|
if [[ -n "${defaultPort}" && "${port}" == "${defaultPort}" ]]; then
|
||||||
|
fileName="${configPath}02_dokodemodoor_inbounds_${port}_default.json"
|
||||||
|
else
|
||||||
|
fileName="${configPath}02_dokodemodoor_inbounds_${port}.json"
|
||||||
|
fi
|
||||||
|
|
||||||
|
cat <<EOF >"${fileName}"
|
||||||
{
|
{
|
||||||
"inbounds": [
|
"inbounds": [
|
||||||
{
|
{
|
||||||
"listen": "0.0.0.0",
|
"listen": "0.0.0.0",
|
||||||
"port": ${port},
|
"port": ${port},
|
||||||
"protocol": "dokodemo-door",
|
"protocol": "dokodemo-door",
|
||||||
"settings": {
|
"settings": {
|
||||||
"address": "127.0.0.1",
|
"address": "127.0.0.1",
|
||||||
"port": 443,
|
"port": 443,
|
||||||
"network": "tcp",
|
"network": "tcp",
|
||||||
"followRedirect": false
|
"followRedirect": false
|
||||||
},
|
},
|
||||||
"tag": "dokodemo-door-newPort-${port}"
|
"tag": "dokodemo-door-newPort-${port}"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
|
@ -4371,9 +4427,15 @@ subscribe() {
|
||||||
echo "${base64Result}" >"/etc/v2ray-agent/subscribe/${email}"
|
echo "${base64Result}" >"/etc/v2ray-agent/subscribe/${email}"
|
||||||
echoContent skyBlue "--------------------------------------------------------------"
|
echoContent skyBlue "--------------------------------------------------------------"
|
||||||
echoContent yellow "email:$(echo "${email}" | awk -F "[_]" '{print $1}')\n"
|
echoContent yellow "email:$(echo "${email}" | awk -F "[_]" '{print $1}')\n"
|
||||||
echoContent yellow "url:https://${currentHost}/s/${email}\n"
|
local currentDomain=${currentHost}
|
||||||
echoContent yellow "在线二维码:https://api.qrserver.com/v1/create-qr-code/?size=400x400&data=https://${currentHost}/s/${email}\n"
|
|
||||||
echo "https://${currentHost}/s/${email}" | qrencode -s 10 -m 1 -t UTF8
|
if [[ -n "${currentDefaultPort}" && "${currentDefaultPort}" != "443" ]]; then
|
||||||
|
currentDomain="${currentHost}:${currentDefaultPort}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echoContent yellow "url:https://${currentDomain}/s/${email}\n"
|
||||||
|
echoContent yellow "在线二维码:https://api.qrserver.com/v1/create-qr-code/?size=400x400&data=https://${currentDomain}/s/${email}\n"
|
||||||
|
echo "https://${currentDomain}/s/${email}" | qrencode -s 10 -m 1 -t UTF8
|
||||||
echoContent skyBlue "--------------------------------------------------------------"
|
echoContent skyBlue "--------------------------------------------------------------"
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
@ -4429,7 +4491,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.5.57"
|
echoContent green "当前版本:v2.5.58"
|
||||||
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