sane-scripts: better vpn factoring
This commit is contained in:
parent
005a79e680
commit
07e6ec2533
|
@ -24,6 +24,7 @@ resholve.mkDerivation {
|
|||
file
|
||||
findutils
|
||||
gnugrep
|
||||
gnused
|
||||
gocryptfs
|
||||
ifuse
|
||||
inetutils
|
||||
|
@ -36,6 +37,7 @@ resholve.mkDerivation {
|
|||
ssh-to-age
|
||||
sops
|
||||
sudo
|
||||
systemd
|
||||
util-linux
|
||||
which
|
||||
];
|
||||
|
@ -69,6 +71,7 @@ resholve.mkDerivation {
|
|||
"cannot:${rsync}/bin/rsync"
|
||||
"cannot:${sops}/bin/sops"
|
||||
"cannot:${ssh-to-age}/bin/ssh-to-age"
|
||||
"cannot:${systemd}/bin/systemctl"
|
||||
];
|
||||
};
|
||||
};
|
||||
|
|
|
@ -2,16 +2,17 @@
|
|||
|
||||
# first arg should be the region, e.g. `us` or `ukr`
|
||||
|
||||
case $1 in
|
||||
ukr)
|
||||
iface=wg-quick-ovpnd-ukr;;
|
||||
us)
|
||||
iface=wg-quick-ovpnd-us;;
|
||||
us-atlanta)
|
||||
iface=wg-quick-ovpnd-us-atlanta;;
|
||||
*)
|
||||
echo "invalid vpn name '$1'"; exit 1;;
|
||||
esac
|
||||
vpns=$(systemctl list-unit-files | grep wg-quick-ovpnd- | cut -f 1 -d ' ' | sed s'/^wg-quick-ovpnd-\([a-zA-Z-]*\)\.service$/\1/g')
|
||||
|
||||
if ! [ $(echo "$vpns" | grep "^$1$") ]
|
||||
then
|
||||
echo "invalid vpn name '$1'"
|
||||
echo "choices:"
|
||||
echo "$vpns"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
iface=wg-quick-ovpnd-$1.service
|
||||
|
||||
echo vpn: $(curl https://ipinfo.io/ip)
|
||||
sudo systemctl stop $iface
|
||||
|
|
|
@ -2,16 +2,17 @@
|
|||
|
||||
# first arg should be the region, e.g. `us` or `ukr`
|
||||
|
||||
case $1 in
|
||||
ukr)
|
||||
iface=wg-quick-ovpnd-ukr;;
|
||||
us)
|
||||
iface=wg-quick-ovpnd-us;;
|
||||
us-atlanta)
|
||||
iface=wg-quick-ovpnd-us-atlanta;;
|
||||
*)
|
||||
echo "invalid vpn name '$1'"; exit 1;;
|
||||
esac
|
||||
vpns=$(systemctl list-unit-files | grep wg-quick-ovpnd- | cut -f 1 -d ' ' | sed s'/^wg-quick-ovpnd-\([a-zA-Z-]*\)\.service$/\1/g')
|
||||
|
||||
if ! [ $(echo "$vpns" | grep "^$1$") ]
|
||||
then
|
||||
echo "invalid vpn name '$1'"
|
||||
echo "choices:"
|
||||
echo "$vpns"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
iface=wg-quick-ovpnd-$1.service
|
||||
|
||||
echo plain: $(curl https://ipinfo.io/ip)
|
||||
sudo systemctl start $iface
|
||||
|
|
Loading…
Reference in New Issue
Block a user