2018-07-24 15:08:27 +00:00
|
|
|
#!/bin/sh
|
2019-07-29 08:36:22 +00:00
|
|
|
check_ipv4_website="$(uci -q get openmptcprouter.settings.check_ipv4_website)"
|
|
|
|
[ -z "$check_ipv4_website" ] && check_ipv4_website="http://ip.openmptcprouter.com"
|
|
|
|
checkip=$(echo $check_ipv4_website | sed -e 's/https:\/\///' -e 's/http:\/\///' | xargs dig +short A | tr -d "\n")
|
2018-09-19 21:08:07 +00:00
|
|
|
ipset add ss_rules_dst_bypass_all $checkip > /dev/null 2>&1
|
2019-07-29 08:36:22 +00:00
|
|
|
ip="$(curl -s -4 -m 3 --interface $1 $check_ipv4_website)"
|
2018-09-19 21:08:07 +00:00
|
|
|
ipset del ss_rules_dst_bypass_all $checkip > /dev/null 2>&1
|
2019-06-26 16:37:48 +00:00
|
|
|
if expr "$ip" : '[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*$' >/dev/null; then
|
|
|
|
echo $ip
|
|
|
|
fi
|