summaryrefslogtreecommitdiff
path: root/home/wayland/pkgs/wayland-scripts/src/bin/vpn
diff options
context:
space:
mode:
Diffstat (limited to 'home/wayland/pkgs/wayland-scripts/src/bin/vpn')
-rwxr-xr-xhome/wayland/pkgs/wayland-scripts/src/bin/vpn19
1 files changed, 19 insertions, 0 deletions
diff --git a/home/wayland/pkgs/wayland-scripts/src/bin/vpn b/home/wayland/pkgs/wayland-scripts/src/bin/vpn
new file mode 100755
index 0000000..db0353a
--- /dev/null
+++ b/home/wayland/pkgs/wayland-scripts/src/bin/vpn
@@ -0,0 +1,19 @@
+#!/bin/sh
+
+exit_node="${1:-kay}"
+
+note()
+{
+ command -v notify-send > /dev/null &&
+ notify-send "󰒒 vpn" "$1"
+ printf "%s\n" "$1"
+}
+
+if tailscale exit-node list | grep -q "selected"; then
+ tailscale set --exit-node= &&
+ note "Connection was dropped"
+
+else
+ tailscale set --exit-node="$exit_node" &&
+ note "Traffic routed through $exit_node"
+fi