feat(脚本): 添加google人机验证、添加检测ipv6的方法

pull/534/merge
mack-a 2020-12-18 17:40:05 +08:00
parent 927d8e491e
commit f18ae5740e
1 changed files with 111 additions and 15 deletions

View File

@ -90,6 +90,10 @@ initVar(){
# UUID # UUID
currentUUID= currentUUID=
# pingIPv6 pingIPv4
pingIPv4=
pingIPv6=
} }
# 检测安装方式 # 检测安装方式
@ -1515,24 +1519,33 @@ EOF
EOF EOF
# outbounds # outbounds
cat << EOF > /etc/v2ray-agent/v2ray/conf/10_outbounds.json cat << EOF > /etc/v2ray-agent/v2ray/conf/10_ipv4_outbounds.json
{ {
"outbounds": [ "outbounds": [
{ {
"protocol": "freedom", "protocol": "freedom",
"settings": { "settings": {
"domainStrategy": "UseIPv4" "domainStrategy": "UseIPv4"
} },
}, "tag": "IPv4-out"
{
"tag": "blocked",
"protocol": "blackhole",
"settings": {}
} }
] ]
} }
EOF EOF
cat << EOF > /etc/v2ray-agent/v2ray/conf/10_bt_outbounds.json
{
"outbounds": [
{
"protocol": "blackhole",
"settings": {}
"tag": "blocked",
}
]
}
EOF
# dns # dns
cat << EOF > /etc/v2ray-agent/v2ray/conf/11_dns.json cat << EOF > /etc/v2ray-agent/v2ray/conf/11_dns.json
{ {
@ -1809,20 +1822,28 @@ EOF
} }
EOF EOF
# outbounds # outbounds
cat << EOF > /etc/v2ray-agent/xray/conf/10_outbounds.json cat << EOF > /etc/v2ray-agent/xray/conf/10_ipv4_outbounds.json
{ {
"outbounds": [ "outbounds": [
{ {
"protocol": "freedom", "protocol": "freedom",
"settings": { "settings": {
"domainStrategy": "UseIPv4" "domainStrategy": "UseIPv4"
} },
}, "tag": "IPv4-out"
}
]
}
EOF
cat << EOF > /etc/v2ray-agent/xray/conf/10_bt_outbounds.json
{
"outbounds": [
{ {
"tag": "blocked",
"protocol": "blackhole", "protocol": "blackhole",
"settings": {} "settings": {},
"tag": "blocked"
} }
] ]
} }
@ -2632,6 +2653,78 @@ aliasInstall(){
fi fi
} }
# 检查ipv6、ipv4
checkIPv6(){
pingIPv6=`ping -6 -c 1 -W 1000 www.google.com|sed '2{s/[^(]*(//;s/).*//;q;}'|tail -n +2`
if [[ -z "${pingIPv6}" ]]
then
echoContent red " ---> 不支持ipv6"
exit;
fi
}
# ipv6 人机验证
ipv6HumanVerification(){
if [[ -z "${configPath}" ]]
then
echoContent red " ---> 未安装,请使用脚本安装"
menu
exit;
fi
checkIPv6
cat << EOF > ${configPath}09_routing.json
{
"routing":{
"domainStrategy": "AsIs",
"rules": [
{
"type": "field",
"protocol": [
"bittorrent"
],
"outboundTag": "blocked"
},
{
"type": "field",
"domain": [
"domain:google.com",
"domain:google.com.hk"
],
"outboundTag": "IP6-out"
}
]
}
}
EOF
# cat << EOF > ${configPath}10_ipv6_outbounds.json
cat << EOF > ${configPath}10_ipv4_outbounds.json
{
"outbounds": [
{
"protocol": "freedom",
"settings": {
"domainStrategy": "UseIPv4"
},
"tag": "IPv4-out"
},
{
"protocol": "freedom",
"settings": {
"domainStrategy": "UseIPv6"
},
"tag": "IP6-out"
}
]
}
EOF
echoContent green " ---> 人机验证修改成功"
handleXray stop
handleXray start
}
# v2ray-core个性化安装 # v2ray-core个性化安装
customV2RayInstall(){ customV2RayInstall(){
echoContent skyBlue "\n========================个性化安装============================" echoContent skyBlue "\n========================个性化安装============================"
@ -2916,7 +3009,7 @@ menu(){
cd cd
echoContent red "\n==============================================================" echoContent red "\n=============================================================="
echoContent green "作者mack-a" echoContent green "作者mack-a"
echoContent green "当前版本v2.2.0" echoContent green "当前版本v2.2.1"
echoContent green "Githubhttps://github.com/mack-a/v2ray-agent" echoContent green "Githubhttps://github.com/mack-a/v2ray-agent"
echoContent green "描述:七合一共存脚本" echoContent green "描述:七合一共存脚本"
echoContent red "==============================================================" echoContent red "=============================================================="
@ -2928,7 +3021,7 @@ menu(){
echoContent yellow "5.更新证书" echoContent yellow "5.更新证书"
echoContent yellow "6.更换CDN节点" echoContent yellow "6.更换CDN节点"
echoContent yellow "7.多用户管理[todo]" echoContent yellow "7.多用户管理[todo]"
echoContent yellow "8.ipv6人机验证[todo]" echoContent yellow "8.ipv6人机验证"
echoContent skyBlue "-------------------------版本管理-----------------------------" echoContent skyBlue "-------------------------版本管理-----------------------------"
echoContent yellow "9.core版本管理" echoContent yellow "9.core版本管理"
echoContent yellow "10.升级Trojan-Go" echoContent yellow "10.升级Trojan-Go"
@ -2963,6 +3056,9 @@ menu(){
#7) #7)
#resetUUID 1 #resetUUID 1
#;; #;;
8)
ipv6HumanVerification
;;
9) 9)
coreVersionManageMenu 1 coreVersionManageMenu 1
;; ;;