mirror of https://github.com/mack-a/v2ray-agent
feat(脚本): ipv6分流与任意门共存(出站)
parent
0b0b6c4559
commit
2ae7f30f37
103
install.sh
103
install.sh
|
@ -1533,6 +1533,17 @@ EOF
|
||||||
"domainStrategy":"UseIPv4"
|
"domainStrategy":"UseIPv4"
|
||||||
},
|
},
|
||||||
"tag":"IPv4-out"
|
"tag":"IPv4-out"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"protocol":"freedom",
|
||||||
|
"settings":{
|
||||||
|
"domainStrategy":"UseIPv6"
|
||||||
|
},
|
||||||
|
"tag":"IPv6-out"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"protocol":"blackhole",
|
||||||
|
"tag":"blackhole-out"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -1872,6 +1883,17 @@ EOF
|
||||||
"domainStrategy":"UseIPv4"
|
"domainStrategy":"UseIPv4"
|
||||||
},
|
},
|
||||||
"tag":"IPv4-out"
|
"tag":"IPv4-out"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"protocol":"freedom",
|
||||||
|
"settings":{
|
||||||
|
"domainStrategy":"UseIPv6"
|
||||||
|
},
|
||||||
|
"tag":"IPv6-out"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"protocol":"blackhole",
|
||||||
|
"tag":"blackhole-out"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -3002,7 +3024,7 @@ checkIPv6() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# ipv6 人机验证
|
# ipv6 分流
|
||||||
ipv6Routing() {
|
ipv6Routing() {
|
||||||
if [[ -z "${configPath}" ]]; then
|
if [[ -z "${configPath}" ]]; then
|
||||||
echoContent red " ---> 未安装,请使用脚本安装"
|
echoContent red " ---> 未安装,请使用脚本安装"
|
||||||
|
@ -3028,6 +3050,20 @@ ipv6Routing() {
|
||||||
echoContent yellow "6.录入示例:google,youtube,facebook\n"
|
echoContent yellow "6.录入示例:google,youtube,facebook\n"
|
||||||
read -r -p "请按照上面示例录入域名:" domainList
|
read -r -p "请按照上面示例录入域名:" domainList
|
||||||
|
|
||||||
|
if [[ -f "${configPath}09_routing.json" ]];then
|
||||||
|
local routing=
|
||||||
|
if grep -q "IPv6-out" ${configPath}09_routing.json;then
|
||||||
|
local ipv6OutIndex=$(jq .routing.rules[].outboundTag ${configPath}09_routing.json|awk '{print ""NR""":"$0}'|grep "IPv6-out"|awk -F "[:]" '{print $1}'|head -1)
|
||||||
|
if [[ ${ipv6OutIndex} -gt 0 ]];then
|
||||||
|
routing=$(jq -r 'del(.routing.rules['$(expr ${ipv6OutIndex} - 1)'])' ${configPath}09_routing.json)
|
||||||
|
echo "${routing}" |jq . >${configPath}09_routing.json
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
routing=$(jq -r '.routing.rules += [{"type":"field","domain":["geosite:'${domainList//,/\",\"geosite:}'"],"outboundTag":"IPv6-out"}]' ${configPath}09_routing.json)
|
||||||
|
|
||||||
|
echo "${routing}"|jq . >${configPath}09_routing.json
|
||||||
|
else
|
||||||
cat <<EOF >${configPath}09_routing.json
|
cat <<EOF >${configPath}09_routing.json
|
||||||
{
|
{
|
||||||
"routing":{
|
"routing":{
|
||||||
|
@ -3044,6 +3080,7 @@ ipv6Routing() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
|
fi
|
||||||
|
|
||||||
cat <<EOF >${configPath}10_ipv4_outbounds.json
|
cat <<EOF >${configPath}10_ipv4_outbounds.json
|
||||||
{
|
{
|
||||||
|
@ -3061,6 +3098,10 @@ EOF
|
||||||
"domainStrategy":"UseIPv6"
|
"domainStrategy":"UseIPv6"
|
||||||
},
|
},
|
||||||
"tag":"IPv6-out"
|
"tag":"IPv6-out"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"protocol":"blackhole",
|
||||||
|
"tag":"blackhole-out"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -3079,11 +3120,22 @@ EOF
|
||||||
"domainStrategy":"UseIPv4"
|
"domainStrategy":"UseIPv4"
|
||||||
},
|
},
|
||||||
"tag":"IPv4-out"
|
"tag":"IPv4-out"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"protocol":"freedom",
|
||||||
|
"settings":{
|
||||||
|
"domainStrategy":"UseIPv6"
|
||||||
|
},
|
||||||
|
"tag":"IPv6-out"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"protocol":"blackhole",
|
||||||
|
"tag":"blackhole-out"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
echoContent green " ---> 人机验证卸载成功"
|
echoContent green " ---> IPv6分流卸载成功"
|
||||||
else
|
else
|
||||||
echoContent red " ---> 选择错误"
|
echoContent red " ---> 选择错误"
|
||||||
ipv6HumanVerification
|
ipv6HumanVerification
|
||||||
|
@ -3155,6 +3207,17 @@ setDokodemoDoorUnblockNetflixOutbounds() {
|
||||||
},
|
},
|
||||||
"tag":"IPv4-out"
|
"tag":"IPv4-out"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"protocol":"freedom",
|
||||||
|
"settings":{
|
||||||
|
"domainStrategy":"UseIPv6"
|
||||||
|
},
|
||||||
|
"tag":"IPv6-out"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"protocol":"blackhole",
|
||||||
|
"tag":"blackhole-out"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"tag":"netflix-80",
|
"tag":"netflix-80",
|
||||||
"protocol":"freedom",
|
"protocol":"freedom",
|
||||||
|
@ -3174,6 +3237,21 @@ setDokodemoDoorUnblockNetflixOutbounds() {
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
|
if [[ -f "${configPath}09_routing.json" ]] ;then
|
||||||
|
local routing=
|
||||||
|
if grep -q "netflix-" ${configPath}09_routing.json;then
|
||||||
|
jq .routing.rules[].outboundTag ${configPath}09_routing.json|awk '{print ""NR""":"$0}'|grep "netflix-"|awk -F "[:]" '{print $1}'| while read -r index;do
|
||||||
|
local netflixIndex=$(jq .routing.rules[].outboundTag ${configPath}09_routing.json|awk '{print ""NR""":"$0}'|grep "netflix-"|awk -F "[:]" '{print $1}'|head -1)
|
||||||
|
if [[ ${netflixIndex} -gt 0 ]];then
|
||||||
|
routing=$(jq -r 'del(.routing.rules['$(expr ${netflixIndex} - 1)'])' ${configPath}09_routing.json)
|
||||||
|
echo "${routing}" |jq . >${configPath}09_routing.json
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
local 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)
|
||||||
|
echo "${routing}"|jq . >${configPath}09_routing.json
|
||||||
|
else
|
||||||
cat <<EOF >${configPath}09_routing.json
|
cat <<EOF >${configPath}09_routing.json
|
||||||
{
|
{
|
||||||
"routing": {
|
"routing": {
|
||||||
|
@ -3201,6 +3279,7 @@ EOF
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
|
fi
|
||||||
reloadCore
|
reloadCore
|
||||||
echoContent green " ---> 添加Netflix出战解锁成功"
|
echoContent green " ---> 添加Netflix出战解锁成功"
|
||||||
echoContent yellow " ---> 不支持trojan的相关节点"
|
echoContent yellow " ---> 不支持trojan的相关节点"
|
||||||
|
@ -3273,6 +3352,13 @@ EOF
|
||||||
},
|
},
|
||||||
"tag":"IPv4-out"
|
"tag":"IPv4-out"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"protocol":"freedom",
|
||||||
|
"settings":{
|
||||||
|
"domainStrategy":"UseIPv6"
|
||||||
|
},
|
||||||
|
"tag":"IPv6-out"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"protocol":"blackhole",
|
"protocol":"blackhole",
|
||||||
"tag":"blackhole-out"
|
"tag":"blackhole-out"
|
||||||
|
@ -3340,6 +3426,17 @@ removeDokodemoDoorUnblockNetflix() {
|
||||||
"domainStrategy":"UseIPv4"
|
"domainStrategy":"UseIPv4"
|
||||||
},
|
},
|
||||||
"tag":"IPv4-out"
|
"tag":"IPv4-out"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"protocol":"freedom",
|
||||||
|
"settings":{
|
||||||
|
"domainStrategy":"UseIPv6"
|
||||||
|
},
|
||||||
|
"tag":"IPv6-out"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"protocol":"blackhole",
|
||||||
|
"tag":"blackhole-out"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -3799,7 +3896,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.4.45"
|
echoContent green "当前版本:v2.5.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
|
||||||
|
|
Loading…
Reference in New Issue