This commit is contained in:
parent
7e5d880156
commit
d93f63cf82
40 changed files with 448 additions and 649 deletions
|
|
@ -5,26 +5,33 @@
|
|||
exit 0
|
||||
}
|
||||
|
||||
PIPE="/var/run/vpnd.sock"
|
||||
send_cmd() {
|
||||
[ -p $PIPE ] && echo "$@" > $PIPE && \
|
||||
cat < $PIPE
|
||||
PIPE="/var/run/vpnd.sock"
|
||||
[ -p $PIPE ] && echo "$@" > $PIPE && cat < $PIPE
|
||||
}
|
||||
|
||||
IFNAME="$(send_cmd status)"
|
||||
router_status() {
|
||||
ssh -i "$HOME"/.ssh/id_watcher router vpn status laptop 2>/dev/null
|
||||
}
|
||||
|
||||
case "$IFNAME" in
|
||||
"msk") IFNAME="Moscow";;
|
||||
"rix") IFNAME="Riga";;
|
||||
case "$(ip link | grep 'awg_' | cut -d ' ' -f2 | tr -d ':' | sed 's,awg_,,')" in
|
||||
"int") IFNAME=" Saint-Petersburg";;
|
||||
"ext") IFNAME=" Riga";;
|
||||
esac
|
||||
|
||||
if [ -n "$IFNAME" ]; then
|
||||
echo " $IFNAME"
|
||||
[ -n "$IFNAME" ] && {
|
||||
echo "$IFNAME"
|
||||
exit 0
|
||||
fi
|
||||
}
|
||||
|
||||
DEFAULT_LINK="$(resolvectl status | grep 'Default Route: yes' -B10 | grep 'Link' | tail -1 | grep -Eo '\(.*\)' | tr -d '()')"
|
||||
DEFAULT_LINK="$(
|
||||
resolvectl status | \
|
||||
grep 'Default Route: yes' -B10 | \
|
||||
grep 'Link' | \
|
||||
tail -1 | \
|
||||
grep -Eo '\(.*\)' | \
|
||||
tr -d '()'
|
||||
)"
|
||||
|
||||
if resolvectl domain "$DEFAULT_LINK" | grep -q 'wzray.com'; then
|
||||
[ "$(ssh router vpn status laptop 2>/dev/null)" = '1' ] && echo " Local"
|
||||
fi
|
||||
resolvectl domain "$DEFAULT_LINK" | grep -q 'wzray.com' && \
|
||||
[ "$(router_status)" = '1' ] && echo ""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue