feat(脚本): 修复卸载warp分流后没有清除分流规则的问题、增加socks5分流设置优先解析类型、完善sing-box分流查看域名

pull/1006/head
mack-a 2024-03-20 15:48:17 +08:00
parent f334d533db
commit 7383310cbe
1 changed files with 55 additions and 16 deletions

View File

@ -5867,6 +5867,7 @@ ipv6Routing() {
echoContent yellow "Xray-core" echoContent yellow "Xray-core"
jq -r -c '.routing.rules[]|select (.outboundTag=="IPv6_out")|.domain' ${configPath}09_routing.json | jq -r jq -r -c '.routing.rules[]|select (.outboundTag=="IPv6_out")|.domain' ${configPath}09_routing.json | jq -r
elif [[ ! -f "${configPath}09_routing.json" && -f "${configPath}IPv6_out.json" ]]; then elif [[ ! -f "${configPath}09_routing.json" && -f "${configPath}IPv6_out.json" ]]; then
echoContent yellow "Xray-core"
echoContent green " ---> 已设置IPv6全局分流" echoContent green " ---> 已设置IPv6全局分流"
else else
echoContent yellow " ---> 未安装IPv6分流" echoContent yellow " ---> 未安装IPv6分流"
@ -5874,9 +5875,14 @@ ipv6Routing() {
fi fi
if [[ -n "${singBoxConfigPath}" ]]; then if [[ -f "${singBoxConfigPath}IPv6_out_route.json" ]]; then
echoContent yellow "sing-box" echoContent yellow "sing-box"
jq -r -c '.route.rules[]|select (.outbound=="IPv6_out")' "${singBoxConfigPath}IPv6_out_route.json" | jq -r jq -r -c '.route.rules[]|select (.outbound=="IPv6_out")' "${singBoxConfigPath}IPv6_out_route.json" | jq -r
elif [[ ! -f "${singBoxConfigPath}IPv6_out_route.json" && -f "${singBoxConfigPath}IPv6_out.json" ]]; then
echoContent yellow "sing-box"
echoContent green " ---> 已设置IPv6全局分流"
else
echoContent yellow " ---> 未安装IPv6分流"
fi fi
exit 0 exit 0
@ -6268,19 +6274,27 @@ installWarpReg() {
showWireGuardDomain() { showWireGuardDomain() {
local type=$1 local type=$1
# xray # xray
if [[ -f "${configPath}09_routing.json" ]]; then if [[ "${coreInstallType}" == "1" ]]; then
echoContent yellow "Xray-core" if [[ -f "${configPath}09_routing.json" ]]; then
jq -r -c '.routing.rules[]|select (.outboundTag=="wireguard_out_'"${type}"'")|.domain' ${configPath}09_routing.json | jq -r echoContent yellow "Xray-core"
elif [[ ! -f "${configPath}09_routing.json" && -f "${configPath}wireguard_out_${type}.json" ]]; then jq -r -c '.routing.rules[]|select (.outboundTag=="wireguard_out_'"${type}"'")|.domain' ${configPath}09_routing.json | jq -r
echoContent green " ---> 已设置warp ${type}全局分流" elif [[ ! -f "${configPath}09_routing.json" && -f "${configPath}wireguard_out_${type}.json" ]]; then
else echoContent yellow "Xray-core"
echoContent yellow " ---> 未安装warp分流" echoContent green " ---> 已设置warp ${type}全局分流"
else
echoContent yellow " ---> 未安装warp ${type}分流"
fi
fi fi
# sing-box # sing-box
if [[ -f "${singBoxConfigPath}wireguard_out_${type}_route.json" ]]; then if [[ -f "${singBoxConfigPath}wireguard_out_${type}_route.json" ]]; then
echoContent yellow "sing-box" echoContent yellow "sing-box"
jq -r -c '.route.rules[]' "${singBoxConfigPath}wireguard_out_${type}_route.json" | jq -r jq -r -c '.route.rules[]' "${singBoxConfigPath}wireguard_out_${type}_route.json" | jq -r
elif [[ ! -f "${singBoxConfigPath}wireguard_out_${type}_route.json" && -f "${singBoxConfigPath}wireguard_out_${type}.json" ]]; then
echoContent yellow "sing-box"
echoContent green " ---> 已设置warp ${type}全局分流"
else
echoContent yellow " ---> 未安装warp ${type}分流"
fi fi
} }
@ -6443,16 +6457,24 @@ warpRoutingReg() {
fi fi
elif [[ "${warpStatus}" == "4" ]]; then elif [[ "${warpStatus}" == "4" ]]; then
removeSingBoxConfig "wireguard_out_${type}_route" if [[ "${coreInstallType}" == "1" ]]; then
unInstallRouting "wireguard_out_${type}" outboundTag
removeSingBoxConfig "wireguard_out_${type}" removeXrayOutbound "wireguard_out_${type}"
removeXrayOutbound "wireguard_out_${type}" addXrayOutbound "z_direct_outbound"
fi
addSingBoxOutbound "01_direct_outbound" if [[ -n "${singBoxConfigPath}" ]]; then
addXrayOutbound "z_direct_outbound" removeSingBoxConfig "wireguard_out_${type}_route"
removeSingBoxConfig "wireguard_out_${type}"
addSingBoxOutbound "01_direct_outbound"
fi
echoContent green " ---> 卸载WARP ${type}分流完毕" echoContent green " ---> 卸载WARP ${type}分流完毕"
else else
echoContent red " ---> 选择错误" echoContent red " ---> 选择错误"
exit 0 exit 0
fi fi
@ -6535,6 +6557,7 @@ socks5Routing() {
echoContent red "\n==============================================================" echoContent red "\n=============================================================="
echoContent red "# 注意事项" echoContent red "# 注意事项"
echoContent yellow "# 流量明文访问" echoContent yellow "# 流量明文访问"
echoContent yellow "# 只能用于不会被阻断访问的网络环境下的不同机器之间的流量转发,请不要用于代理访问" echoContent yellow "# 只能用于不会被阻断访问的网络环境下的不同机器之间的流量转发,请不要用于代理访问"
echoContent yellow "# 使用教程https://www.v2ray-agent.com/archives/1683226921000#heading-5 \n" echoContent yellow "# 使用教程https://www.v2ray-agent.com/archives/1683226921000#heading-5 \n"
@ -6749,6 +6772,21 @@ setSocks5Inbound() {
echoContent green "用户名称:${socks5RoutingUUID}" echoContent green "用户名称:${socks5RoutingUUID}"
echoContent green "用户密码:${socks5RoutingUUID}" echoContent green "用户密码:${socks5RoutingUUID}"
echoContent yellow "\n请选择分流域名DNS解析类型"
echoContent yellow "# 注意事项需要保证vps支持相应的DNS解析"
echoContent yellow "1.IPv4[回车默认]"
echoContent yellow "2.IPv6"
read -r -p 'IP类型:' socks5InboundDomainStrategyStatus
local domainStrategy=
if [[ -z "${socks5InboundDomainStrategyStatus}" || "${socks5InboundDomainStrategyStatus}" == "1" ]]; then
domainStrategy="ipv4_only"
elif [[ "${socks5InboundDomainStrategyStatus}" == "2" ]]; then
domainStrategy="ipv6_only"
else
echoContent red " ---> 选择类型错误"
exit 0
fi
cat <<EOF >/etc/v2ray-agent/sing-box/conf/config/20_socks5_inbounds.json cat <<EOF >/etc/v2ray-agent/sing-box/conf/config/20_socks5_inbounds.json
{ {
"inbounds":[ "inbounds":[
@ -6762,7 +6800,8 @@ setSocks5Inbound() {
"username": "${socks5RoutingUUID}", "username": "${socks5RoutingUUID}",
"password": "${socks5RoutingUUID}" "password": "${socks5RoutingUUID}"
} }
] ],
"domain_strategy":"${domainStrategy}"
} }
] ]
} }
@ -8734,7 +8773,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.2.30" echoContent green "当前版本v3.2.31"
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