1
0
Fork 0
This commit is contained in:
Arthur K. 2026-01-06 07:36:53 +03:00
parent c449dfcb5f
commit 559939e2f4
Signed by: wzray
GPG key ID: B97F30FDC4636357
49 changed files with 729 additions and 252 deletions

View file

@ -17,6 +17,7 @@ awg-quick() {
DEFAULT_LINK="$(resolvectl status | grep 'Default Route: yes' -B10 | grep 'Link' | tail -1 | grep -Eo '\(.*\)' | tr -d '()')"
IS_LOCAL=0
if resolvectl domain "$DEFAULT_LINK" | grep -q 'wzray.com'; then
IS_LOCAL=1
fi
@ -26,6 +27,7 @@ IFNAME="awg_ext"
while [ "$#" -gt 0 ]; do
case "$1" in
i|int|internal) IFNAME='awg_int';;
-f) IS_LOCAL=0;;
*) echo "Wrong argument!" >&2; exit 1;;
esac
shift
@ -35,7 +37,7 @@ UP_NAME="$(ip link | grep 'awg_' | cut -d ' ' -f 2 | sed 's,:,,')"
if [ -n "$UP_NAME" ]; then
awg-quick down "$UP_NAME"
elif [ -n "$IS_LOCAL" ]; then
elif [ "$IS_LOCAL" = 1 ]; then
send_router_cmd toggle
else
awg-quick up "${IFNAME}"