Detect IP VPN if is enabled
This commit is contained in:
parent
141b9a8f30
commit
a2d8e3bf02
@ -49,8 +49,12 @@ case $1 in
|
||||
AF=inet6? ;;
|
||||
esac
|
||||
|
||||
# if no interface is found, use the first device with a global scope
|
||||
IPADDR=$(ip addr show "$IF" | perl -n -e "/$AF ([^\/]+).* scope global/ && print \$1 and exit")
|
||||
# look for the vpn connection, if no interface is found, use the first device with a global scope
|
||||
if [[ $(ip addr show tun0) ]]; then
|
||||
IPADDR=$(ip addr show tun0 | awk '/inet.*brd/ {print $2}' | awk -F'/' '{print $1}')
|
||||
else
|
||||
IPADDR=$(ip addr show "$IF" | perl -n -e "/$AF ([^\/]+).* scope global/ && print \$1 and exit")
|
||||
fi
|
||||
|
||||
case $BLOCK_BUTTON in
|
||||
3) echo -n "$IPADDR" | xclip -q -se c ;;
|
||||
|
Loading…
x
Reference in New Issue
Block a user