Skip to content

Commit

Permalink
fix(脚本): 修复socks5全局分流入站无法限制IP的问题、修复CDN节点添加IPv6读取失败的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
mack-a committed May 16, 2024
1 parent fa670fa commit cb6fa9f
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -848,8 +848,8 @@ readConfigHostPathUUID() {
currentPath=${currentPath::-2}
fi
fi
if [[ -f "/etc/v2ray-agent/cdn" ]] && grep -q "address" "/etc/v2ray-agent/cdn"; then
currentCDNAddress=$(grep "address" "/etc/v2ray-agent/cdn" | awk -F "[:]" '{print $2}')
if [[ -f "/etc/v2ray-agent/cdn" ]] && [[ -n "$(head -1 /etc/v2ray-agent/cdn)" ]]; then
currentCDNAddress=$(head -1 /etc/v2ray-agent/cdn)
else
currentCDNAddress="${currentHost}"
fi
Expand Down Expand Up @@ -5586,9 +5586,6 @@ unInstall() {
manageCDN() {
echoContent skyBlue "\n进度 $1/1 : CDN节点管理"
local setCDNDomain=
if [[ ! -f "/etc/v2ray-agent/cdn" ]]; then
touch "/etc/v2ray-agent/cdn"
fi

if echo "${currentInstallProtocolType}" | grep -qE ",1,|,2,|,3,|,5,"; then
echoContent red "=============================================================="
Expand Down Expand Up @@ -5622,15 +5619,15 @@ manageCDN() {
read -r -p "请输入想要自定义CDN IP或者域名:" setCDNDomain
;;
6)
sed -i "1d" "/etc/v2ray-agent/cdn"
echo >/etc/v2ray-agent/cdn
echoContent green " ---> 移除成功"
exit 0
;;
esac

if [[ -n "${setCDNDomain}" ]]; then
sed -i "1d" "/etc/v2ray-agent/cdn"
test -s "/etc/v2ray-agent/cdn" && sed -i "1i address:${setCDNDomain}" "/etc/v2ray-agent/cdn" || echo "address:${setCDNDomain}" >"/etc/v2ray-agent/cdn"
echo >/etc/v2ray-agent/cdn
echo "${setCDNDomain}" >"/etc/v2ray-agent/cdn"
echoContent green " ---> 修改CDN成功,重新查看用户管理或者订阅后生成新的节点内容"
else
echoContent red " ---> 不可以为空,请重新输入"
Expand Down Expand Up @@ -7152,6 +7149,13 @@ setSocks5InboundRouting() {

read -r -p "是否允许所有网站?请选择[y/n]:" socks5InboundRoutingDomainStatus
if [[ "${socks5InboundRoutingDomainStatus}" == "y" ]]; then
addSingBoxRouteRule "01_direct_outbound" "" "socks5_inbound_route"
local route=
route=$(jq ".route.rules[0].inbound = [\"socks5_inbound\"]" "${singBoxConfigPath}socks5_inbound_route.json")
route=$(echo "${route}" | jq ".route.rules[0].source_ip_cidr=${socks5InboundRoutingIPs}")
echo "${route}" | jq . >"${singBoxConfigPath}socks5_inbound_route.json"

addSingBoxOutbound block
addSingBoxOutbound "01_direct_outbound"
else
echoContent yellow "录入示例:netflix,openai,v2ray-agent.com\n"
Expand Down Expand Up @@ -9154,7 +9158,7 @@ menu() {
cd "$HOME" || exit
echoContent red "\n=============================================================="
echoContent green "作者:mack-a"
echoContent green "当前版本:v3.2.51"
echoContent green "当前版本:v3.2.52"
echoContent green "Github:https://github.com/mack-a/v2ray-agent"
echoContent green "描述:八合一共存脚本\c"
showInstallStatus
Expand Down

0 comments on commit cb6fa9f

Please sign in to comment.