1
0
Fork 0
mirror of https://github.com/Ysurac/openmptcprouter-feeds.git synced 2025-02-12 18:41:51 +00:00

Fix ASN check

This commit is contained in:
Ycarus 2018-09-20 10:09:03 +02:00
parent 8f62658f19
commit 24981ca89e
2 changed files with 11 additions and 3 deletions

View file

@ -258,9 +258,13 @@ fi
# Save wan settings for status page
if [ "$(uci -q get openmptcprouter.$OMR_TRACKER_INTERFACE.lc)" = "" ] || [ $(($(date +"%s") - $(uci -q get openmptcprouter.$OMR_TRACKER_INTERFACE.lc))) -gt 3600 ]; then
_log "Get status and settings for $OMR_TRACKER_INTERFACE..."
local ipaddr="$(omr-ip-intf $OMR_TRACKER_DEVICE)"
[ -n "$ipaddr" ] && {
local asn="$(wget -4 -qO- -T 5 http://api.iptoasn.com/v1/as/ip/$ipaddr | jsonfilter -e '@.as_description')"
local asn="$(wget -4 -qO- -T 5 http://api.iptoasn.com/v1/as/ip/$ipaddr | jsonfilter -q -e '@.as_description')"
[ -z "$asn" ] && {
asn="$(whois $ipaddr 2>/dev/null | grep -i 'netname' | awk '{print $2}')"
}
local serverip=$(uci -q get shadowsocks-libev.sss0.server)
[ -n "$serverip" ] && {
uci -q set openmptcprouter.$OMR_TRACKER_INTERFACE.mptcp_status="$(omr-tracebox-mptcp $serverip $OMR_TRACKER_DEVICE)"
@ -289,6 +293,10 @@ if [ "$(uci -q get openmptcprouter.$OMR_TRACKER_INTERFACE.lc)" = "" ] || [ $(($(
elif [ -n "$asn" ]; then
uci -q set openmptcprouter.$OMR_TRACKER_INTERFACE.lc=$(date +"%s")
fi
if [ "$(uci -q get openmptcprouter.$OMR_TRACKER_INTERFACE.lc)" = "" ] || [ $(($(date +"%s") - $(uci -q get openmptcprouter.$OMR_TRACKER_INTERFACE.lc))) -gt 3600 ]; then
uci -q set openmptcprouter.$OMR_TRACKER_INTERFACE.lc=$(( $(date +"%s") - 3500 ))
fi
uci -q commit openmptcprouter
}
_log "Get status and settings for $OMR_TRACKER_INTERFACE... Done"
fi

View file

@ -9,7 +9,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=omr-tracker
PKG_VERSION:=1.6
PKG_VERSION:=1.7
PKG_RELEASE:=1
include $(INCLUDE_DIR)/package.mk
@ -19,7 +19,7 @@ define Package/$(PKG_NAME)
CATEGORY:=Network
TITLE:=OpenMPTCProuter tracker
PKGARCH:=all
DEPENDS:=+bind-dig +httping
DEPENDS:=+bind-dig +httping +whois
endef
define Package/$(PKG_NAME)/description