database download timeout limit

* database download timeout limit
* fix indentation
* change alternate dns
* remove wget downloader, ps. curl exists in the system by default
This commit is contained in:
Bard 2022-04-27 01:49:36 +08:00 committed by GitHub
parent cf2f3245d3
commit 4e4a89b7aa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -4,28 +4,24 @@ bakdns() {
if [ "$1" == "0" ]; then if [ "$1" == "0" ]; then
echo "119.29.29.29" echo "119.29.29.29"
elif [ "$1" == "1" ]; then elif [ "$1" == "1" ]; then
echo "101.226.4.6" echo "114.114.114.114"
fi fi
} }
exist() { exist() {
command -v "$1" >/dev/null 2>&1 command -v "$1" >/dev/null 2>&1
} }
getdat() { getdat() {
if exist curl; then curl --connect-timeout 60 -m 900 -fSLo "$TMPDIR/$1" "https://github.cooluc.com/https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/$1"
curl -fSLo "$TMPDIR/$1" "https://github.cooluc.com/https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/$1"
else
wget "https://github.cooluc.com/https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/$1" -nv -O "$TMPDIR/$1"
fi
} }
getdns() { getdns() {
if [ "$2" == "inactive" ]; then if [ "$2" == "inactive" ]; then
ubus call network.interface.wan status | jsonfilter -e "@['inactive']['dns-server'][$1]" ubus call network.interface.wan status | jsonfilter -e "@['inactive']['dns-server'][$1]"
else else
ubus call network.interface.wan status | jsonfilter -e "@['dns-server'][$1]" ubus call network.interface.wan status | jsonfilter -e "@['dns-server'][$1]"
fi fi
} }
pid() { pid() {