mirror of https://github.com/mack-a/v2ray-agent
parent
659882b964
commit
a323ded532
206
install.sh
206
install.sh
|
@ -793,9 +793,9 @@ EOF
|
|||
# 修改nginx重定向配置
|
||||
updateRedirectNginxConf() {
|
||||
|
||||
if [[ ${BTPanelStatus} = "true" ]];then
|
||||
if [[ ${BTPanelStatus} = "true" ]]; then
|
||||
|
||||
cat <<EOF >${nginxConfigPath}alone.conf
|
||||
cat <<EOF >${nginxConfigPath}alone.conf
|
||||
server {
|
||||
listen 127.0.0.1:31300;
|
||||
server_name _;
|
||||
|
@ -804,7 +804,7 @@ cat <<EOF >${nginxConfigPath}alone.conf
|
|||
EOF
|
||||
|
||||
else
|
||||
cat <<EOF >${nginxConfigPath}alone.conf
|
||||
cat <<EOF >${nginxConfigPath}alone.conf
|
||||
server {
|
||||
listen 80;
|
||||
listen [::]:80;
|
||||
|
@ -1096,7 +1096,7 @@ nginxBlog() {
|
|||
handleNginx() {
|
||||
|
||||
if [[ -z $(pgrep -f "nginx") ]] && [[ "$1" == "start" ]]; then
|
||||
nginx
|
||||
systemctl start nginx
|
||||
sleep 0.5
|
||||
|
||||
if [[ -z $(pgrep -f nginx) ]]; then
|
||||
|
@ -1105,7 +1105,7 @@ handleNginx() {
|
|||
exit 0
|
||||
fi
|
||||
elif [[ -n $(pgrep -f "nginx") ]] && [[ "$1" == "stop" ]]; then
|
||||
nginx -s stop >/dev/null 2>&1
|
||||
systemctl stop nginx
|
||||
sleep 0.5
|
||||
if [[ -n $(pgrep -f "nginx") ]]; then
|
||||
pgrep -f "nginx" | xargs kill -9
|
||||
|
@ -1131,7 +1131,7 @@ renewalTLS() {
|
|||
echoContent skyBlue "\n进度 $1/1 : 更新证书"
|
||||
fi
|
||||
local domain=${currentHost}
|
||||
if [[ -z "${currentHost}" && -n "${tlsDomain}" ]];then
|
||||
if [[ -z "${currentHost}" && -n "${tlsDomain}" ]]; then
|
||||
domain=${tlsDomain}
|
||||
fi
|
||||
|
||||
|
@ -3458,7 +3458,7 @@ EOF
|
|||
|
||||
unInstallSniffing
|
||||
|
||||
unInstallRouting blackhole-out
|
||||
unInstallRouting blackhole-out outboundTag
|
||||
|
||||
unInstallOutbounds blackhole-out
|
||||
|
||||
|
@ -3474,16 +3474,26 @@ EOF
|
|||
# 根据tag卸载Routing
|
||||
unInstallRouting() {
|
||||
local tag=$1
|
||||
local type=$2
|
||||
|
||||
if [[ -f "${configPath}09_routing.json" ]]; then
|
||||
local routing
|
||||
if grep -q "${tag}" ${configPath}09_routing.json; then
|
||||
local index
|
||||
index=$(jq .routing.rules[].outboundTag ${configPath}09_routing.json | awk '{print ""NR""":"$0}' | grep "${tag}" | awk -F "[:]" '{print $1}' | head -1)
|
||||
if [[ ${index} -gt 0 ]]; then
|
||||
if grep -q "${tag}" ${configPath}09_routing.json && grep -q "${type}" ${configPath}09_routing.json; then
|
||||
|
||||
jq -c .routing.rules[] ${configPath}09_routing.json | while read -r line; do
|
||||
local index=$((index + 1))
|
||||
local delStatus=0
|
||||
if [[ "${type}" == "outboundTag" ]] && echo "${line}" | jq .outboundTag | grep -q "${tag}"; then
|
||||
delStatus=1
|
||||
elif [[ "${type}" == "inboundTag" ]] && echo "${line}" | jq .inboundTag | grep -q "${tag}"; then
|
||||
delStatus=1
|
||||
fi
|
||||
|
||||
if [[ ${delStatus} == 1 ]]; then
|
||||
routing=$(jq -r 'del(.routing.rules['"$(("${index}" - 1))"'])' ${configPath}09_routing.json)
|
||||
echo "${routing}" | jq . >${configPath}09_routing.json
|
||||
fi
|
||||
done
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
@ -3560,7 +3570,7 @@ warpRouting() {
|
|||
read -r -p "请按照上面示例录入域名:" domainList
|
||||
|
||||
if [[ -f "${configPath}09_routing.json" ]]; then
|
||||
unInstallRouting warp-socks-out
|
||||
unInstallRouting warp-socks-out outboundTag
|
||||
|
||||
routing=$(jq -r ".routing.rules += [{\"type\":\"field\",\"domain\":[\"geosite:${domainList//,/\",\"geosite:}\"],\"outboundTag\":\"warp-socks-out\"}]" ${configPath}09_routing.json)
|
||||
|
||||
|
@ -3597,7 +3607,7 @@ EOF
|
|||
|
||||
${removeType} cloudflare-warp >/dev/null 2>&1
|
||||
|
||||
unInstallRouting warp-socks-out
|
||||
unInstallRouting warp-socks-out outboundTag
|
||||
|
||||
unInstallOutbounds warp-socks-out
|
||||
|
||||
|
@ -3613,16 +3623,13 @@ streamingToolbox() {
|
|||
echoContent skyBlue "\n功能 1/${totalProgress} : 流媒体工具箱"
|
||||
echoContent red "\n=============================================================="
|
||||
# echoContent yellow "1.Netflix检测"
|
||||
echoContent yellow "1.任意门落地机解锁Netflix"
|
||||
echoContent yellow "1.任意门落地机解锁流媒体"
|
||||
echoContent yellow "2.DNS解锁流媒体"
|
||||
read -r -p "请选择:" selectType
|
||||
|
||||
case ${selectType} in
|
||||
# 1)
|
||||
# checkNetflix
|
||||
# ;;
|
||||
1)
|
||||
dokodemoDoorUnblockNetflix
|
||||
dokodemoDoorUnblockStreamingMedia
|
||||
;;
|
||||
2)
|
||||
dnsUnlockNetflix
|
||||
|
@ -3631,9 +3638,9 @@ streamingToolbox() {
|
|||
|
||||
}
|
||||
|
||||
# 任意门解锁netflix
|
||||
dokodemoDoorUnblockNetflix() {
|
||||
echoContent skyBlue "\n功能 1/${totalProgress} : 任意门落地机解锁Netflix"
|
||||
# 任意门解锁流媒体
|
||||
dokodemoDoorUnblockStreamingMedia() {
|
||||
echoContent skyBlue "\n功能 1/${totalProgress} : 任意门落地机解锁流媒体"
|
||||
echoContent red "\n=============================================================="
|
||||
echoContent yellow "# 注意事项"
|
||||
echoContent yellow "任意门解锁详解,请查看此文章[https://github.com/mack-a/v2ray-agent/blob/master/documents/netflix/dokodemo-unblock_netflix.md]\n"
|
||||
|
@ -3645,35 +3652,47 @@ dokodemoDoorUnblockNetflix() {
|
|||
|
||||
case ${selectType} in
|
||||
1)
|
||||
setDokodemoDoorUnblockNetflixOutbounds
|
||||
setDokodemoDoorUnblockStreamingMediaOutbounds
|
||||
;;
|
||||
2)
|
||||
setDokodemoDoorUnblockNetflixInbounds
|
||||
setDokodemoDoorUnblockStreamingMediaInbounds
|
||||
;;
|
||||
3)
|
||||
removeDokodemoDoorUnblockNetflix
|
||||
removeDokodemoDoorUnblockStreamingMedia
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
# 设置任意门解锁Netflix【出站】
|
||||
setDokodemoDoorUnblockNetflixOutbounds() {
|
||||
read -r -p "请输入解锁Netflix vps的IP:" setIP
|
||||
setDokodemoDoorUnblockStreamingMediaOutbounds() {
|
||||
read -r -p "请输入解锁流媒体 vps的IP:" setIP
|
||||
echoContent red "=============================================================="
|
||||
echoContent yellow "# 注意事项\n"
|
||||
echoContent yellow "1.规则仅支持预定义域名列表[https://github.com/v2fly/domain-list-community]"
|
||||
echoContent yellow "2.详细文档[https://www.v2fly.org/config/routing.html]"
|
||||
echoContent yellow "3.如内核启动失败请检查域名后重新添加域名"
|
||||
echoContent yellow "4.不允许有特殊字符,注意逗号的格式"
|
||||
echoContent yellow "5.每次添加都是重新添加,不会保留上次域名"
|
||||
echoContent yellow "6.录入示例:netflix,disney,hulu\n"
|
||||
read -r -p "请按照上面示例录入域名:" domainList
|
||||
|
||||
if [[ -n "${setIP}" ]]; then
|
||||
|
||||
unInstallOutbounds netflix-80
|
||||
unInstallOutbounds netflix-443
|
||||
unInstallOutbounds streamingMedia-80
|
||||
unInstallOutbounds streamingMedia-443
|
||||
|
||||
outbounds=$(jq -r ".outbounds += [{\"tag\":\"netflix-80\",\"protocol\":\"freedom\",\"settings\":{\"domainStrategy\":\"AsIs\",\"redirect\":\"${setIP}:22387\"}},{\"tag\":\"netflix-443\",\"protocol\":\"freedom\",\"settings\":{\"domainStrategy\":\"AsIs\",\"redirect\":\"${setIP}:22388\"}}]" ${configPath}10_ipv4_outbounds.json)
|
||||
outbounds=$(jq -r ".outbounds += [{\"tag\":\"streamingMedia-80\",\"protocol\":\"freedom\",\"settings\":{\"domainStrategy\":\"AsIs\",\"redirect\":\"${setIP}:22387\"}},{\"tag\":\"streamingMedia-443\",\"protocol\":\"freedom\",\"settings\":{\"domainStrategy\":\"AsIs\",\"redirect\":\"${setIP}:22388\"}}]" ${configPath}10_ipv4_outbounds.json)
|
||||
|
||||
echo "${outbounds}" | jq . >${configPath}10_ipv4_outbounds.json
|
||||
|
||||
if [[ -f "${configPath}09_routing.json" ]]; then
|
||||
unInstallRouting netflix-80
|
||||
unInstallRouting netflix-443
|
||||
unInstallRouting streamingMedia-80 outboundTag
|
||||
unInstallRouting streamingMedia-443 outboundTag
|
||||
|
||||
local routing
|
||||
routing=$(jq -r '.routing.rules += [{"type":"field","port":80,"domain":["ip.sb","geosite:netflix"],"outboundTag":"netflix-80"},{"type":"field","port":443,"domain":["ip.sb","geosite:netflix"],"outboundTag":"netflix-443"}]' ${configPath}09_routing.json)
|
||||
|
||||
routing=$(jq -r ".routing.rules += [{\"type\":\"field\",\"port\":80,\"domain\":[\"ip.sb\",\"geosite:${domainList//,/\",\"geosite:}\"],\"outboundTag\":\"streamingMedia-80\"},{\"type\":\"field\",\"port\":443,\"domain\":[\"ip.sb\",\"geosite:${domainList//,/\",\"geosite:}\"],\"outboundTag\":\"streamingMedia-443\"}]" ${configPath}09_routing.json)
|
||||
|
||||
echo "${routing}" | jq . >${configPath}09_routing.json
|
||||
else
|
||||
cat <<EOF >${configPath}09_routing.json
|
||||
|
@ -3686,18 +3705,18 @@ setDokodemoDoorUnblockNetflixOutbounds() {
|
|||
"port": 80,
|
||||
"domain": [
|
||||
"ip.sb",
|
||||
"geosite:netflix"
|
||||
"geosite:${domainList//,/\",\"geosite:}"
|
||||
],
|
||||
"outboundTag": "netflix-80"
|
||||
"outboundTag": "streamingMedia-80"
|
||||
},
|
||||
{
|
||||
"type": "field",
|
||||
"port": 443,
|
||||
"domain": [
|
||||
"ip.sb",
|
||||
"geosite:netflix"
|
||||
"geosite:${domainList//,/\",\"geosite:}"
|
||||
],
|
||||
"outboundTag": "netflix-443"
|
||||
"outboundTag": "streamingMedia-443"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -3705,24 +3724,30 @@ setDokodemoDoorUnblockNetflixOutbounds() {
|
|||
EOF
|
||||
fi
|
||||
reloadCore
|
||||
echoContent green " ---> 添加Netflix出站解锁成功"
|
||||
# echoContent yellow " ---> 不支持trojan的相关节点"
|
||||
echoContent green " ---> 添加出站解锁成功"
|
||||
exit 0
|
||||
fi
|
||||
echoContent red " ---> ip不可为空"
|
||||
}
|
||||
|
||||
# 设置任意门解锁Netflix【入站】
|
||||
setDokodemoDoorUnblockNetflixInbounds() {
|
||||
setDokodemoDoorUnblockStreamingMediaInbounds() {
|
||||
|
||||
echoContent skyBlue "\n功能 1/${totalProgress} : 任意门添加入站"
|
||||
echoContent red "\n=============================================================="
|
||||
echoContent yellow "# 注意事项\n"
|
||||
echoContent yellow "支持批量添加"
|
||||
echoContent yellow "不允许有特殊字符,注意逗号的格式"
|
||||
echoContent yellow "录入示例:1.1.1.1,1.1.1.2\n"
|
||||
read -r -p "请输入允许访问该解锁Netflix vps的IP:" setIPs
|
||||
echoContent yellow "1.规则仅支持预定义域名列表[https://github.com/v2fly/domain-list-community]"
|
||||
echoContent yellow "2.详细文档[https://www.v2fly.org/config/routing.html]"
|
||||
echoContent yellow "3.如内核启动失败请检查域名后重新添加域名"
|
||||
echoContent yellow "4.不允许有特殊字符,注意逗号的格式"
|
||||
echoContent yellow "5.每次添加都是重新添加,不会保留上次域名"
|
||||
echoContent yellow "6.ip录入示例:1.1.1.1,1.1.1.2"
|
||||
echoContent yellow "7.下面的域名一定要和出站的vps一致"
|
||||
echoContent yellow "8.域名录入示例:netflix,disney,hulu\n"
|
||||
read -r -p "请输入允许访问该解锁 vps的IP:" setIPs
|
||||
if [[ -n "${setIPs}" ]]; then
|
||||
read -r -p "请按照上面示例录入域名:" domainList
|
||||
|
||||
cat <<EOF >${configPath}01_netflix_inbounds.json
|
||||
{
|
||||
"inbounds": [
|
||||
|
@ -3742,7 +3767,7 @@ setDokodemoDoorUnblockNetflixInbounds() {
|
|||
"http"
|
||||
]
|
||||
},
|
||||
"tag": "unblock-80"
|
||||
"tag": "streamingMedia-80"
|
||||
},
|
||||
{
|
||||
"listen": "0.0.0.0",
|
||||
|
@ -3760,7 +3785,7 @@ setDokodemoDoorUnblockNetflixInbounds() {
|
|||
"tls"
|
||||
]
|
||||
},
|
||||
"tag": "unblock-443"
|
||||
"tag": "streamingMedia-443"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -3791,62 +3816,66 @@ EOF
|
|||
}
|
||||
EOF
|
||||
|
||||
if [[ -f "${configPath}09_routing.json" ]]; then
|
||||
unInstallRouting streamingMedia-80 inboundTag
|
||||
unInstallRouting streamingMedia-443 inboundTag
|
||||
|
||||
local routing
|
||||
routing=$(jq -r ".routing.rules += [{\"source\":[\"${setIPs//,/\",\"}\"],\"type\":\"field\",\"inboundTag\":[\"streamingMedia-80\",\"streamingMedia-443\"],\"outboundTag\":\"direct\"},{\"domains\":[\"geosite:${domainList//,/\",\"geosite:}\"],\"type\":\"field\",\"inboundTag\":[\"streamingMedia-80\",\"streamingMedia-443\"],\"outboundTag\":\"blackhole-out\"}]" ${configPath}09_routing.json)
|
||||
echo "${routing}" | jq . >${configPath}09_routing.json
|
||||
else
|
||||
cat <<EOF >${configPath}09_routing.json
|
||||
{
|
||||
{
|
||||
"routing": {
|
||||
"rules": [
|
||||
{
|
||||
"source": [],
|
||||
"source": [
|
||||
"${setIPs//,/\",\"}"
|
||||
],
|
||||
"type": "field",
|
||||
"inboundTag": [
|
||||
"unblock-80",
|
||||
"unblock-443"
|
||||
"streamingMedia-80",
|
||||
"streamingMedia-443"
|
||||
],
|
||||
"outboundTag": "direct"
|
||||
},
|
||||
{
|
||||
"domains": [
|
||||
"geosite:netflix"
|
||||
"geosite:${domainList//,/\",\"geosite:}"
|
||||
],
|
||||
"type": "field",
|
||||
"inboundTag": [
|
||||
"unblock-80",
|
||||
"unblock-443"
|
||||
"streamingMedia-80",
|
||||
"streamingMedia-443"
|
||||
],
|
||||
"outboundTag": "blackhole-out"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
EOF
|
||||
|
||||
oldIFS="${IFS}"
|
||||
IFS=","
|
||||
# shellcheck disable=SC2206
|
||||
sourceIPs=(${setIPs})
|
||||
IFS="${oldIFS}"
|
||||
|
||||
local routing
|
||||
|
||||
for value in "${sourceIPs[@]}"; do
|
||||
routing=$(jq -r ".routing.rules[0].source += [\"${value}\"]" ${configPath}09_routing.json)
|
||||
echo "${routing}" | jq . >${configPath}09_routing.json
|
||||
done
|
||||
fi
|
||||
|
||||
reloadCore
|
||||
echoContent green " ---> 添加落地机入站解锁Netflix成功"
|
||||
echoContent green " ---> 添加落地机入站解锁成功"
|
||||
exit 0
|
||||
fi
|
||||
echoContent red " ---> ip不可为空"
|
||||
}
|
||||
|
||||
# 移除任意门解锁Netflix
|
||||
removeDokodemoDoorUnblockNetflix() {
|
||||
removeDokodemoDoorUnblockStreamingMedia() {
|
||||
|
||||
unInstallOutbounds streamingMedia-80
|
||||
unInstallOutbounds streamingMedia-443
|
||||
|
||||
unInstallRouting streamingMedia-80 inboundTag
|
||||
unInstallRouting streamingMedia-443 inboundTag
|
||||
|
||||
unInstallRouting streamingMedia-80 outboundTag
|
||||
unInstallRouting streamingMedia-443 outboundTag
|
||||
|
||||
unInstallOutbounds netflix-80
|
||||
unInstallOutbounds netflix-443
|
||||
unInstallRouting netflix-80
|
||||
unInstallRouting netflix-443
|
||||
rm -rf ${configPath}01_netflix_inbounds.json
|
||||
|
||||
reloadCore
|
||||
|
@ -3864,35 +3893,6 @@ reloadCore() {
|
|||
fi
|
||||
}
|
||||
|
||||
# 检查 vps是否支持Netflix
|
||||
checkNetflix() {
|
||||
echoContent red "\n注意事项"
|
||||
echoContent yellow " 1.只可检测vps是否支持Netflix"
|
||||
echoContent yellow " 2.无法检测代理配置dns解锁后是否支持Netflix"
|
||||
echoContent yellow " 3.可检测vps配置dns解锁后是否支持Netflix\n"
|
||||
echoContent skyBlue " ---> 检测中"
|
||||
netflixResult=$(curl -s -m 2 https://www.netflix.com | grep "Not Available")
|
||||
if [[ -n ${netflixResult} ]]; then
|
||||
echoContent red " ---> Netflix不可用"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
netflixResult=$(curl -s -m 2 https://www.netflix.com | grep "NSEZ-403")
|
||||
if [[ -n ${netflixResult} ]]; then
|
||||
echoContent red " ---> Netflix不可用"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echoContent skyBlue " ---> 检测绝命毒师是否可以播放"
|
||||
result=$(curl -s -m 2 https://www.netflix.com/title/70143836 | grep "page-404")
|
||||
if [[ -n ${result} ]]; then
|
||||
echoContent green " ---> 仅可看自制剧"
|
||||
exit 0
|
||||
fi
|
||||
echoContent green " ---> Netflix解锁"
|
||||
exit 0
|
||||
}
|
||||
|
||||
# dns解锁Netflix
|
||||
dnsUnlockNetflix() {
|
||||
if [[ -z "${configPath}" ]]; then
|
||||
|
@ -3931,7 +3931,7 @@ setUnlockDNS() {
|
|||
echoContent yellow "7.默认方案请输入1,默认方案包括以下内容"
|
||||
echoContent yellow "netflix,bahamut,hulu,hbo,disney,bbc,4chan,fox,abema,dmm,niconico,pixiv,bilibili,viu"
|
||||
read -r -p "请按照上面示例录入域名:" domainList
|
||||
if [[ "${domainList}" = "1" ]];then
|
||||
if [[ "${domainList}" = "1" ]]; then
|
||||
cat <<EOF >${configPath}11_dns.json
|
||||
{
|
||||
"dns": {
|
||||
|
@ -3961,7 +3961,7 @@ setUnlockDNS() {
|
|||
}
|
||||
}
|
||||
EOF
|
||||
elif [[ -n "${domainList}" ]];then
|
||||
elif [[ -n "${domainList}" ]]; then
|
||||
cat <<EOF >${configPath}11_dns.json
|
||||
{
|
||||
"dns": {
|
||||
|
@ -4341,7 +4341,7 @@ menu() {
|
|||
cd "$HOME" || exit
|
||||
echoContent red "\n=============================================================="
|
||||
echoContent green "作者:mack-a"
|
||||
echoContent green "当前版本:v2.5.42"
|
||||
echoContent green "当前版本:v2.5.43"
|
||||
echoContent green "Github:https://github.com/mack-a/v2ray-agent"
|
||||
echoContent green "描述:八合一共存脚本\c"
|
||||
showInstallStatus
|
||||
|
|
Loading…
Reference in New Issue