mirror of
https://github.com/Ysurac/openmptcprouter-feeds.git
synced 2025-03-09 15:40:03 +00:00
Add check on VPS and IP timeout config in web interface and add loop detection
This commit is contained in:
parent
6702b125ca
commit
4c56f5402f
10 changed files with 111 additions and 12 deletions
|
@ -3,11 +3,14 @@
|
|||
|
||||
intf=$1
|
||||
|
||||
timeout=$(uci -q get openmptcprouter.settings.status_getip_timeout)
|
||||
[ -z "$timeout" ] && timeout="1"
|
||||
|
||||
get_ip_from_server() {
|
||||
serverport=$(uci -q get openmptcprouter.$1.port)
|
||||
get_ip() {
|
||||
serverip=$1
|
||||
getip="$(curl -s -k -4 -m 2 --interface $intf https://$serverip:$serverport/clienthost)"
|
||||
getip="$(curl -s -k -4 -m ${timeout} --interface $intf https://$serverip:$serverport/clienthost)"
|
||||
[ -n "$getip" ] && getip=$(echo $getip | jsonfilter -e '@.client_host')
|
||||
if expr "$getip" : '[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*$' >/dev/null; then
|
||||
ip=$getip
|
||||
|
@ -23,7 +26,7 @@ get_ip_from_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")
|
||||
ipset add ss_rules_dst_bypass_all $checkip > /dev/null 2>&1
|
||||
getip="$(curl -s -4 -m 2 --interface $intf $check_ipv4_website)"
|
||||
getip="$(curl -s -4 -m ${timeout} --interface $intf $check_ipv4_website)"
|
||||
ipset del ss_rules_dst_bypass_all $checkip > /dev/null 2>&1
|
||||
if expr "$getip" : '[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*$' >/dev/null; then
|
||||
ip=$getip
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue