luci-app-mosdns: mosdns.sh: use geoip-only-cn-private for geodat_update

This commit is contained in:
sbwml 2023-06-12 07:26:10 +08:00
parent b8ac086a54
commit 21c4be1aeb

View File

@ -64,18 +64,17 @@ adlist_update() (
) )
geodat_update() ( geodat_update() (
geodat_download() ( TMPDIR=$(mktemp -d) || exit 1
google_status=$(curl -I -4 -m 3 -o /dev/null -s -w %{http_code} http://www.google.com/generate_204) google_status=$(curl -I -4 -m 3 -o /dev/null -s -w %{http_code} http://www.google.com/generate_204)
[ "$google_status" -ne "204" ] && mirror="https://ghproxy.com/" [ "$google_status" -ne "204" ] && mirror="https://ghproxy.com/"
echo -e "\e[1;32mDownloading "$mirror"https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/$1\e[0m" # geoip.dat - cn-private
curl --connect-timeout 60 -m 900 --ipv4 -kfSLo "$TMPDIR/$1" ""$mirror"https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/$1" echo -e "\e[1;32mDownloading "$mirror"https://github.com/Loyalsoldier/geoip/releases/latest/download/geoip-only-cn-private.dat\e[0m"
) curl --connect-timeout 60 -m 900 --ipv4 -kfSLo "$TMPDIR/geoip.dat" ""$mirror"https://github.com/Loyalsoldier/geoip/releases/latest/download/geoip-only-cn-private.dat"
TMPDIR=$(mktemp -d) || exit 1 [ $? -ne 0 ] && rm -rf "$TMPDIR" && exit 1
geodat_download geoip.dat && geodat_download geosite.dat # geosite.dat
if [ $? -ne 0 ]; then echo -e "\e[1;32mDownloading "$mirror"https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geosite.dat\e[0m"
rm -rf "$TMPDIR" curl --connect-timeout 60 -m 900 --ipv4 -kfSLo "$TMPDIR/geosite.dat" ""$mirror"https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geosite.dat"
exit 1 [ $? -ne 0 ] && rm -rf "$TMPDIR" && exit 1
fi
cp -f "$TMPDIR"/* /usr/share/v2ray cp -f "$TMPDIR"/* /usr/share/v2ray
rm -rf "$TMPDIR" rm -rf "$TMPDIR"
) )