fix(脚本): 修复sing-box IPv6全局、warp全局导致核心启动失败问题

pull/909/head^2
mack-a 2023-12-24 22:10:07 +08:00
parent 7745311fe8
commit a85f615264
1 changed files with 77 additions and 68 deletions

View File

@ -5537,31 +5537,35 @@ ipv6Routing() {
read -r -p "是否确认设置?[y/n]:" IPv6OutStatus read -r -p "是否确认设置?[y/n]:" IPv6OutStatus
if [[ "${IPv6OutStatus}" == "y" ]]; then if [[ "${IPv6OutStatus}" == "y" ]]; then
cat <<EOF >${configPath}10_ipv4_outbounds.json if [[ "${coreInstallType}" == "1" ]]; then
{ cat <<EOF >${configPath}10_ipv4_outbounds.json
"outbounds":[ {
{ "outbounds":[
"protocol":"freedom", {
"settings":{ "protocol":"freedom",
"domainStrategy":"UseIPv6" "settings":{
}, "domainStrategy":"UseIPv6"
"tag":"IPv6_out" },
} "tag":"IPv6_out"
] }
} ]
}
EOF EOF
rm ${configPath}09_routing.json >/dev/null 2>&1 rm ${configPath}09_routing.json >/dev/null 2>&1
fi
if [[ "${coreInstallType}" == "2" ]]; then
configurationSingBoxRoute delete wireguard_out_IPv4
configurationSingBoxRoute delete wireguard_out_IPv6
removeSingBoxOutbound IPv4_out
removeSingBoxOutbound wireguard_out_IPv4
removeSingBoxOutbound wireguard_outbound
addSingBoxOutbound IPv6_out
fi
echoContent green " ---> IPv6全局出站设置成功" echoContent green " ---> IPv6全局出站设置成功"
configurationSingBoxRoute delete wireguard_out_IPv4
configurationSingBoxRoute delete wireguard_out_IPv6
removeSingBoxOutbound IPv4_out
removeSingBoxOutbound wireguard_out_IPv4
removeSingBoxOutbound wireguard_outbound
addSingBoxOutbound IPv6_out
else else
echoContent green " ---> 放弃设置" echoContent green " ---> 放弃设置"
exit 0 exit 0
fi fi
@ -6169,57 +6173,62 @@ warpRoutingReg() {
if [[ "${warpOutStatus}" == "y" ]]; then if [[ "${warpOutStatus}" == "y" ]]; then
readConfigWarpReg readConfigWarpReg
if [[ "${coreInstallType}" == "1" ]]; then
cat <<EOF >${configPath}10_ipv4_outbounds.json cat <<EOF >${configPath}10_ipv4_outbounds.json
{ {
"outbounds":[ "outbounds":[
{ {
"protocol": "wireguard", "protocol": "wireguard",
"settings": { "settings": {
"secretKey": "${secretKeyWarpReg}", "secretKey": "${secretKeyWarpReg}",
"address": [ "address": [
"${address}" "${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"
} }
], ],
"reserved": ${reservedWarpReg}, "reserved": ${reservedWarpReg},
"mtu": 1280 "mtu": 1280
}, },
"tag": "wireguard_out_${type}" "tag": "wireguard_out_${type}"
} }
] ]
} }
EOF EOF
rm ${configPath}09_routing.json >/dev/null 2>&1 rm ${configPath}09_routing.json >/dev/null 2>&1
configurationSingBoxRoute delete IPv4
configurationSingBoxRoute delete IPv6
removeSingBoxOutbound direct
removeSingBoxOutbound IPv4_out
removeSingBoxOutbound IPv6_out
configurationSingBoxRoute delete wireguard_out_IPv4
configurationSingBoxRoute delete wireguard_out_IPv6
if [[ "${type}" == "IPv4" ]]; then
removeSingBoxOutbound wireguard_out_IPv6
else
removeSingBoxOutbound wireguard_out_IPv4
fi fi
# outbound if [[ "${coreInstallType}" == "2" ]]; then
addSingBoxOutbound "wireguard_out_${type}" "wireguard_out" configurationSingBoxRoute delete IPv4
addSingBoxWireGuardOut configurationSingBoxRoute delete IPv6
removeSingBoxOutbound direct
removeSingBoxOutbound IPv4_out
removeSingBoxOutbound IPv6_out
configurationSingBoxRoute delete wireguard_out_IPv4
configurationSingBoxRoute delete wireguard_out_IPv6
if [[ "${type}" == "IPv4" ]]; then
removeSingBoxOutbound wireguard_out_IPv6
else
removeSingBoxOutbound wireguard_out_IPv4
fi
# outbound
addSingBoxOutbound "wireguard_out_${type}" "wireguard_out"
addSingBoxWireGuardOut
fi
echoContent green " ---> WARP全局出站设置成功" echoContent green " ---> WARP全局出站设置成功"
else else
echoContent green " ---> 放弃设置" echoContent green " ---> 放弃设置"
@ -8283,7 +8292,7 @@ menu() {
cd "$HOME" || exit cd "$HOME" || exit
echoContent red "\n==============================================================" echoContent red "\n=============================================================="
echoContent green "作者mack-a" echoContent green "作者mack-a"
echoContent green "当前版本v3.1.14" echoContent green "当前版本v3.1.15"
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