feat(脚本): 添加SNI反向代理分流

master
mack-a 2023-05-31 16:28:21 +08:00
parent 5d5e1ab66c
commit 09a8d3235c
1 changed files with 86 additions and 2 deletions

View File

@ -5413,6 +5413,7 @@ routingToolsMenu() {
echoContent yellow "3.任意门分流" echoContent yellow "3.任意门分流"
echoContent yellow "4.DNS分流" echoContent yellow "4.DNS分流"
echoContent yellow "5.VMess+WS+TLS分流" echoContent yellow "5.VMess+WS+TLS分流"
echoContent yellow "6.SNI反向代理分流"
read -r -p "请选择:" selectType read -r -p "请选择:" selectType
case ${selectType} in case ${selectType} in
@ -5431,6 +5432,9 @@ routingToolsMenu() {
5) 5)
vmessWSRouting 1 vmessWSRouting 1
;; ;;
6)
sniRouting 1
;;
esac esac
} }
# 流媒体工具箱 # 流媒体工具箱
@ -5850,6 +5854,68 @@ dnsRouting() {
esac esac
} }
# SNI反向代理分流
sniRouting() {
if [[ -z "${configPath}" ]]; then
echoContent red " ---> 未安装,请使用脚本安装"
menu
exit 0
fi
echoContent skyBlue "\n功能 1/${totalProgress} : SNI反向代理分流"
echoContent red "\n=============================================================="
echoContent yellow "# 注意事项"
echoContent yellow "# 使用教程https://www.v2ray-agent.com/archives/ba-he-yi-jiao-ben-yu-ming-fen-liu-jiao-cheng \n"
echoContent yellow "1.添加"
echoContent yellow "2.卸载"
read -r -p "请选择:" selectType
case ${selectType} in
1)
setUnlockSNI
;;
2)
removeUnlockSNI
;;
esac
}
# 设置SNI分流
setUnlockSNI() {
read -r -p "请输入分流的SNI IP:" setSNIP
if [[ -n ${setSNIP} ]]; then
echoContent red "=============================================================="
echoContent yellow "录入示例:netflix,disney,hulu"
read -r -p "请按照上面示例录入域名:" domainList
if [[ -n "${domainList}" ]]; then
local hosts={}
while read -r domain; do
hosts=$(echo "${hosts}" | jq -r ".\"geosite:${domain}\"=\"${setSNIP}\"")
done < <(echo "${domainList}" | tr ',' '\n')
cat <<EOF >${configPath}11_dns.json
{
"dns": {
"hosts":${hosts},
"servers": [
"8.8.8.8",
"1.1.1.1"
]
}
}
EOF
echoContent red " ---> SNI反向代理分流成功"
reloadCore
else
echoContent red " ---> 域名不可为空"
fi
else
echoContent red " ---> SNI IP不可为空"
fi
exit 0
}
# 设置dns # 设置dns
setUnlockDNS() { setUnlockDNS() {
read -r -p "请输入分流的DNS:" setDNS read -r -p "请输入分流的DNS:" setDNS
@ -5919,7 +5985,7 @@ EOF
exit 0 exit 0
} }
# 移除Netflix解锁 # 移除 DNS分流
removeUnlockDNS() { removeUnlockDNS() {
cat <<EOF >${configPath}11_dns.json cat <<EOF >${configPath}11_dns.json
{ {
@ -5937,6 +6003,24 @@ EOF
exit 0 exit 0
} }
# 移除SNI分流
removeUnlockSNI() {
cat <<EOF >${configPath}11_dns.json
{
"dns": {
"servers": [
"localhost"
]
}
}
EOF
reloadCore
echoContent green " ---> 卸载成功"
exit 0
}
# v2ray-core个性化安装 # v2ray-core个性化安装
customV2RayInstall() { customV2RayInstall() {
echoContent skyBlue "\n========================个性化安装============================" echoContent skyBlue "\n========================个性化安装============================"
@ -7086,7 +7170,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.9.5" echoContent green "当前版本v2.9.6"
echoContent green "Githubhttps://github.com/mack-a/v2ray-agent" echoContent green "Githubhttps://github.com/mack-a/v2ray-agent"
echoContent green "描述:八合一共存脚本\c" echoContent green "描述:八合一共存脚本\c"
showInstallStatus showInstallStatus