mirror of
https://github.com/Ysurac/openmptcprouter-feeds.git
synced 2025-03-09 15:40:03 +00:00
Changes for WAN IPv6 support in status page
This commit is contained in:
parent
57debb6681
commit
0be1a3b119
5 changed files with 309 additions and 41 deletions
|
@ -28,8 +28,10 @@ get_ip_from_website() {
|
|||
}
|
||||
|
||||
[ -z "$intf" ] && return
|
||||
ip=""
|
||||
config_load openmptcprouter
|
||||
config_foreach get_ip_from_server server
|
||||
[ -z "$ip" ] && get_ip_from_website
|
||||
echo $ip
|
||||
if [ -n "$(ip -4 a show dev $intf)" ]; then
|
||||
ip=""
|
||||
config_load openmptcprouter
|
||||
config_foreach get_ip_from_server server
|
||||
[ -z "$ip" ] && get_ip_from_website
|
||||
echo $ip
|
||||
fi
|
37
luci-app-openmptcprouter/root/bin/omr-ip6-intf
Executable file
37
luci-app-openmptcprouter/root/bin/omr-ip6-intf
Executable file
|
@ -0,0 +1,37 @@
|
|||
#!/bin/sh
|
||||
. /lib/functions.sh
|
||||
|
||||
intf=$1
|
||||
|
||||
get_ip_from_server() {
|
||||
serverip=$(uci -q get openmptcprouter.$1.ip)
|
||||
serverport=$(uci -q get openmptcprouter.$1.port)
|
||||
getip="$(curl -s -k -6 -m 2 --interface $intf https://$serverip:$serverport/clienthost)"
|
||||
[ -n "$getip" ] && getip=$(echo $getip | jsonfilter -e '@.client_host')
|
||||
if [ -n "$(echo "$getip" | grep :)" ]; then
|
||||
ip=$getip
|
||||
break
|
||||
fi
|
||||
}
|
||||
|
||||
get_ip_from_website() {
|
||||
check_ipv6_website="$(uci -q get openmptcprouter.settings.check_ipv6_website)"
|
||||
[ -z "$check_ipv6_website" ] && check_ipv6_website="http://ipv6.openmptcprouter.com"
|
||||
checkip=$(echo $check_ipv6_website | sed -e 's/https:\/\///' -e 's/http:\/\///' | xargs dig +short AAAA | tr -d "\n")
|
||||
ipset add ss_rules6_dst_bypass_all $checkip > /dev/null 2>&1
|
||||
getip="$(curl -s -6 -m 2 --interface $intf $check_ipv6_website)"
|
||||
ipset del ss_rules6_dst_bypass_all $checkip > /dev/null 2>&1
|
||||
if [ -n "$(echo "$getip" | grep :)" ]; then
|
||||
ip=$getip
|
||||
break
|
||||
fi
|
||||
}
|
||||
|
||||
[ -z "$intf" ] && return
|
||||
if [ -n "$(ip -6 a show dev $intf)" ]; then
|
||||
ip=""
|
||||
config_load openmptcprouter
|
||||
config_foreach get_ip_from_server server
|
||||
[ -z "$ip" ] && get_ip_from_website
|
||||
echo $ip
|
||||
fi
|
|
@ -1,7 +1,16 @@
|
|||
#!/bin/sh
|
||||
INTERFACE=$2
|
||||
if [ -z "$INTERFACE" ]; then
|
||||
tracebox -m 20 -l "pkt = ip{dst=to} / tcp{dst=65101} / MPCAPABLE / MSS / WSCALE if string.find(tostring(tracebox(pkt)),'-TCPOptionMPTCPCapable') then print 'MPTCP disabled' elseif string.find(tostring(tracebox(pkt)),'MPTCP') then print 'MPTCP enabled' end" $1
|
||||
SERVER=$1
|
||||
if [ -n "$(resolveip -4 $SERVER)" ]; then
|
||||
if [ -z "$INTERFACE" ]; then
|
||||
tracebox -m 20 -l "pkt = ip{dst=to} / tcp{dst=65101} / MPCAPABLE / MSS / WSCALE if string.find(tostring(tracebox(pkt)),'-TCPOptionMPTCPCapable') then print 'MPTCP disabled' elseif string.find(tostring(tracebox(pkt)),'MPTCP') then print 'MPTCP enabled' end" $SERVER
|
||||
else
|
||||
tracebox -m 20 -l "pkt = ip{dst=to} / tcp{dst=65101} / MPCAPABLE / MSS / WSCALE if string.find(tostring(tracebox(pkt)),'-TCPOptionMPTCPCapable') then print 'MPTCP disabled' elseif string.find(tostring(tracebox(pkt)),'MPTCP') then print 'MPTCP enabled' end" -i $INTERFACE $SERVER
|
||||
fi
|
||||
else
|
||||
tracebox -m 20 -l "pkt = ip{dst=to} / tcp{dst=65101} / MPCAPABLE / MSS / WSCALE if string.find(tostring(tracebox(pkt)),'-TCPOptionMPTCPCapable') then print 'MPTCP disabled' elseif string.find(tostring(tracebox(pkt)),'MPTCP') then print 'MPTCP enabled' end" -i $INTERFACE $1
|
||||
if [ -z "$INTERFACE" ]; then
|
||||
tracebox -6 -m 20 -l "pkt = ip{dst=to} / tcp{dst=65101} / MPCAPABLE / MSS / WSCALE if string.find(tostring(tracebox(pkt)),'-TCPOptionMPTCPCapable') then print 'MPTCP disabled' elseif string.find(tostring(tracebox(pkt)),'MPTCP') then print 'MPTCP enabled' end" $SERVER
|
||||
else
|
||||
tracebox -6 -m 20 -l "pkt = ip{dst=to} / tcp{dst=65101} / MPCAPABLE / MSS / WSCALE if string.find(tostring(tracebox(pkt)),'-TCPOptionMPTCPCapable') then print 'MPTCP disabled' elseif string.find(tostring(tracebox(pkt)),'MPTCP') then print 'MPTCP enabled' end" -i $INTERFACE $SERVER
|
||||
fi
|
||||
fi
|
Loading…
Add table
Add a link
Reference in a new issue