feat(脚本): 添加第三方warp IPv4分流、修改clashmeta external-controller端口、优化端口检测
parent
2409fb9e6b
commit
97e2ca1dcb
92
install.sh
92
install.sh
|
@ -987,6 +987,16 @@ installWarp() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# 通过dns检查域名的IP
|
||||||
|
checkDNSIP() {
|
||||||
|
local domain=$1
|
||||||
|
local dnsIP=
|
||||||
|
dnsIP=$(dig @1.1.1.1 +short "${domain}")
|
||||||
|
if [[ -z "${dnsIP}" ]]; then
|
||||||
|
echoContent red " ---> 无法通过DNS获取IP,请检查解析记录"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
}
|
||||||
# 检查端口实际开放状态
|
# 检查端口实际开放状态
|
||||||
checkPortOpen() {
|
checkPortOpen() {
|
||||||
|
|
||||||
|
@ -1431,6 +1441,7 @@ customPortFunction() {
|
||||||
allowPort "${port}"
|
allowPort "${port}"
|
||||||
echoContent yellow "\n ---> 端口: ${port}"
|
echoContent yellow "\n ---> 端口: ${port}"
|
||||||
if [[ -z "${btDomain}" ]]; then
|
if [[ -z "${btDomain}" ]]; then
|
||||||
|
checkDNSIP "${domain}"
|
||||||
checkPortOpen "${port}" "${domain}"
|
checkPortOpen "${port}" "${domain}"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
|
@ -5431,9 +5442,10 @@ readConfigWarpReg() {
|
||||||
reservedWarpReg=$(grep <"/etc/v2ray-agent/warp/config" reserved | awk -F "[:]" '{print $2}')
|
reservedWarpReg=$(grep <"/etc/v2ray-agent/warp/config" reserved | awk -F "[:]" '{print $2}')
|
||||||
|
|
||||||
}
|
}
|
||||||
# warp分流-第三方
|
# warp分流-第三方IPv4
|
||||||
warpRoutingReg() {
|
warpRoutingReg() {
|
||||||
echoContent skyBlue "\n进度 $1/${totalProgress} : WARP分流[第三方-IPv6]"
|
local type=$2
|
||||||
|
echoContent skyBlue "\n进度 $1/${totalProgress} : WARP分流[第三方]"
|
||||||
echoContent red "=============================================================="
|
echoContent red "=============================================================="
|
||||||
if [[ ! -f "/etc/v2ray-agent/warp/warp-reg" ]]; then
|
if [[ ! -f "/etc/v2ray-agent/warp/warp-reg" ]]; then
|
||||||
echo
|
echo
|
||||||
|
@ -5460,8 +5472,19 @@ warpRoutingReg() {
|
||||||
echoContent yellow "4.卸载WARP分流"
|
echoContent yellow "4.卸载WARP分流"
|
||||||
echoContent red "=============================================================="
|
echoContent red "=============================================================="
|
||||||
read -r -p "请选择:" warpStatus
|
read -r -p "请选择:" warpStatus
|
||||||
|
|
||||||
|
readConfigWarpReg
|
||||||
|
local address=
|
||||||
|
if [[ ${type} == "IPv4" ]]; then
|
||||||
|
address="172.16.0.2/32"
|
||||||
|
elif [[ ${type} == "IPv6" ]]; then
|
||||||
|
address="${addressWarpReg}/128"
|
||||||
|
else
|
||||||
|
echoContent red " ---> IP获取失败,退出安装"
|
||||||
|
fi
|
||||||
|
|
||||||
if [[ "${warpStatus}" == "1" ]]; then
|
if [[ "${warpStatus}" == "1" ]]; then
|
||||||
jq -r -c '.routing.rules[]|select (.outboundTag=="wireguard-out")|.domain' ${configPath}09_routing.json | jq -r
|
jq -r -c '.routing.rules[]|select (.outboundTag=="wireguard-out-"'"${type}"'""")|.domain' ${configPath}09_routing.json | jq -r
|
||||||
exit 0
|
exit 0
|
||||||
elif [[ "${warpStatus}" == "2" ]]; then
|
elif [[ "${warpStatus}" == "2" ]]; then
|
||||||
echoContent yellow "# 注意事项"
|
echoContent yellow "# 注意事项"
|
||||||
|
@ -5469,14 +5492,12 @@ warpRoutingReg() {
|
||||||
|
|
||||||
read -r -p "请按照上面示例录入域名:" domainList
|
read -r -p "请按照上面示例录入域名:" domainList
|
||||||
|
|
||||||
addInstallRouting wireguard-out outboundTag "${domainList}"
|
addInstallRouting wireguard-out-"${type}" outboundTag "${domainList}"
|
||||||
|
|
||||||
unInstallOutbounds wireguard-out
|
unInstallOutbounds wireguard-out-"${type}"
|
||||||
|
|
||||||
readConfigWarpReg
|
|
||||||
|
|
||||||
local outbounds
|
local outbounds
|
||||||
outbounds=$(jq -r '.outbounds += [{"protocol":"wireguard","settings":{"secretKey":"'"${secretKeyWarpReg}"'","address":["'"${addressWarpReg}"'/128"],"peers":[{"publicKey":"'"${publicKeyWarpReg}"'","allowedIPs":["0.0.0.0/0","::/0"],"endpoint":"162.159.192.1:2408"}],"reserved":'"${reservedWarpReg}"',"mtu":1280},"tag":"wireguard-out"}]' ${configPath}10_ipv4_outbounds.json)
|
outbounds=$(jq -r '.outbounds += [{"protocol":"wireguard","settings":{"secretKey":"'"${secretKeyWarpReg}"'","address":["'"${address}"'"],"peers":[{"publicKey":"'"${publicKeyWarpReg}"'","allowedIPs":["0.0.0.0/0","::/0"],"endpoint":"162.159.192.1:2408"}],"reserved":'"${reservedWarpReg}"',"mtu":1280},"tag":"wireguard-out-'"${type}"'"}]' ${configPath}10_ipv4_outbounds.json)
|
||||||
|
|
||||||
echo "${outbounds}" | jq . >${configPath}10_ipv4_outbounds.json
|
echo "${outbounds}" | jq . >${configPath}10_ipv4_outbounds.json
|
||||||
|
|
||||||
|
@ -5501,14 +5522,14 @@ warpRoutingReg() {
|
||||||
"settings": {
|
"settings": {
|
||||||
"secretKey": "${secretKeyWarpReg}",
|
"secretKey": "${secretKeyWarpReg}",
|
||||||
"address": [
|
"address": [
|
||||||
"${addressWarpReg}/128"
|
${address}
|
||||||
],
|
],
|
||||||
"peers": [
|
"peers": [
|
||||||
{
|
{
|
||||||
"publicKey": "${publicKeyWarpReg}",
|
"publicKey": "${publicKeyWarpReg}",
|
||||||
"allowedIPs": [
|
"allowedIPs": [
|
||||||
"0.0.0.0/0",
|
"0.0.0.0/0",
|
||||||
"::/0"
|
"::/0"
|
||||||
],
|
],
|
||||||
"endpoint": "162.159.192.1:2408"
|
"endpoint": "162.159.192.1:2408"
|
||||||
}
|
}
|
||||||
|
@ -5516,7 +5537,7 @@ warpRoutingReg() {
|
||||||
"reserved": ${reservedWarpReg},
|
"reserved": ${reservedWarpReg},
|
||||||
"mtu": 1280
|
"mtu": 1280
|
||||||
},
|
},
|
||||||
"tag": "wireguard-out"
|
"tag": "wireguard-out-${type}"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -5530,10 +5551,19 @@ EOF
|
||||||
|
|
||||||
elif [[ "${warpStatus}" == "4" ]]; then
|
elif [[ "${warpStatus}" == "4" ]]; then
|
||||||
|
|
||||||
unInstallRouting wireguard-out outboundTag
|
unInstallRouting wireguard-out-"${type}" outboundTag
|
||||||
|
|
||||||
|
unInstallOutbounds wireguard-out-"${type}"
|
||||||
|
if [[ "${type}" == "IPv4" ]]; then
|
||||||
|
if ! grep -q "wireguard-out-IPv6" <${configPath}10_ipv4_outbounds.json; then
|
||||||
|
rm -rf /etc/v2ray-agent/warp/config >/dev/null 2>&1
|
||||||
|
fi
|
||||||
|
elif [[ "${type}" == "IPv6" ]]; then
|
||||||
|
if ! grep -q "wireguard-out-IPv4" <${configPath}10_ipv4_outbounds.json; then
|
||||||
|
rm -rf /etc/v2ray-agent/warp/config >/dev/null 2>&1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
unInstallOutbounds wireguard-out
|
|
||||||
rm -rf /etc/v2ray-agent/warp/config >/dev/null 2>&1
|
|
||||||
if ! grep -q "IPv4-out" <"${configPath}10_ipv4_outbounds.json"; then
|
if ! grep -q "IPv4-out" <"${configPath}10_ipv4_outbounds.json"; then
|
||||||
|
|
||||||
cat <<EOF >${configPath}10_ipv4_outbounds.json
|
cat <<EOF >${configPath}10_ipv4_outbounds.json
|
||||||
|
@ -5574,38 +5604,40 @@ EOF
|
||||||
routingToolsMenu() {
|
routingToolsMenu() {
|
||||||
echoContent skyBlue "\n功能 1/${totalProgress} : 分流工具"
|
echoContent skyBlue "\n功能 1/${totalProgress} : 分流工具"
|
||||||
echoContent red "\n=============================================================="
|
echoContent red "\n=============================================================="
|
||||||
echoContent yellow "1.WARP分流【官方】"
|
echoContent yellow "1.WARP分流【第三方 IPv4】"
|
||||||
echoContent yellow "2.IPv6分流"
|
echoContent yellow "2.WARP分流【第三方 IPv6】"
|
||||||
echoContent yellow "3.任意门分流"
|
echoContent yellow "3.IPv6分流"
|
||||||
echoContent yellow "4.DNS分流"
|
echoContent yellow "4.任意门分流"
|
||||||
echoContent yellow "5.VMess+WS+TLS分流"
|
echoContent yellow "5.DNS分流"
|
||||||
echoContent yellow "6.SNI反向代理分流"
|
echoContent yellow "6.VMess+WS+TLS分流"
|
||||||
echoContent yellow "7.WARP分流【第三方】"
|
echoContent yellow "7.SNI反向代理分流"
|
||||||
|
|
||||||
read -r -p "请选择:" selectType
|
read -r -p "请选择:" selectType
|
||||||
|
|
||||||
case ${selectType} in
|
case ${selectType} in
|
||||||
1)
|
1)
|
||||||
warpRouting 1
|
warpRoutingReg 1 IPv4
|
||||||
;;
|
;;
|
||||||
2)
|
2)
|
||||||
ipv6Routing 1
|
warpRoutingReg 1 IPv6
|
||||||
;;
|
;;
|
||||||
3)
|
3)
|
||||||
dokodemoDoorRouting 1
|
ipv6Routing 1
|
||||||
;;
|
;;
|
||||||
4)
|
4)
|
||||||
dnsRouting 1
|
dokodemoDoorRouting 1
|
||||||
;;
|
;;
|
||||||
5)
|
5)
|
||||||
vmessWSRouting 1
|
dnsRouting 1
|
||||||
;;
|
;;
|
||||||
6)
|
6)
|
||||||
sniRouting 1
|
vmessWSRouting 1
|
||||||
;;
|
;;
|
||||||
7)
|
7)
|
||||||
warpRoutingReg 1
|
sniRouting 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
}
|
}
|
||||||
# 流媒体工具箱
|
# 流媒体工具箱
|
||||||
streamingToolbox() {
|
streamingToolbox() {
|
||||||
|
@ -6626,7 +6658,7 @@ socks-port: 7891
|
||||||
allow-lan: true
|
allow-lan: true
|
||||||
mode: Rule
|
mode: Rule
|
||||||
log-level: debug
|
log-level: debug
|
||||||
external-controller: 127.0.0.1:9090
|
external-controller: 127.0.0.1:7908
|
||||||
dns:
|
dns:
|
||||||
enable: true
|
enable: true
|
||||||
ipv6: false
|
ipv6: false
|
||||||
|
@ -7340,7 +7372,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.7"
|
echoContent green "当前版本:v2.9.8"
|
||||||
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