From 4e4a89b7aa253b0b01fadb6a0cf002597c8e422f Mon Sep 17 00:00:00 2001 From: Bard Date: Wed, 27 Apr 2022 01:49:36 +0800 Subject: [PATCH] database download timeout limit * database download timeout limit * fix indentation * change alternate dns * remove wget downloader, ps. curl exists in the system by default --- root/usr/share/mosdns/library.sh | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/root/usr/share/mosdns/library.sh b/root/usr/share/mosdns/library.sh index 76409bb..ff967c9 100755 --- a/root/usr/share/mosdns/library.sh +++ b/root/usr/share/mosdns/library.sh @@ -4,28 +4,24 @@ bakdns() { if [ "$1" == "0" ]; then echo "119.29.29.29" elif [ "$1" == "1" ]; then - echo "101.226.4.6" + echo "114.114.114.114" fi } exist() { - command -v "$1" >/dev/null 2>&1 + command -v "$1" >/dev/null 2>&1 } getdat() { - if exist curl; then - 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 + curl --connect-timeout 60 -m 900 -fSLo "$TMPDIR/$1" "https://github.cooluc.com/https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/$1" } getdns() { - if [ "$2" == "inactive" ]; then - ubus call network.interface.wan status | jsonfilter -e "@['inactive']['dns-server'][$1]" - else - ubus call network.interface.wan status | jsonfilter -e "@['dns-server'][$1]" - fi + if [ "$2" == "inactive" ]; then + ubus call network.interface.wan status | jsonfilter -e "@['inactive']['dns-server'][$1]" + else + ubus call network.interface.wan status | jsonfilter -e "@['dns-server'][$1]" + fi } pid() {