add wg support
This commit is contained in:
parent
14ec1eca2e
commit
b3a36d9dbe
5 changed files with 106 additions and 12 deletions
25
util/toggle_wg.xsh
Executable file
25
util/toggle_wg.xsh
Executable file
|
|
@ -0,0 +1,25 @@
|
|||
import sys
|
||||
|
||||
isup = "does not exist." not in $(ip link show dev wg0 2>&1)
|
||||
|
||||
try:
|
||||
match sys.argv[1]:
|
||||
case "toggle":
|
||||
if isup:
|
||||
footclient wg-quick down wg0
|
||||
else:
|
||||
footclient wg-quick up wg0
|
||||
case "status":
|
||||
if isup:
|
||||
print("u")
|
||||
else:
|
||||
print("d")
|
||||
case _:
|
||||
raise RuntimeError
|
||||
|
||||
except (RuntimeError, IndexError):
|
||||
print('"toggle" or "status" must be provided')
|
||||
exit(1)
|
||||
|
||||
exit(0)
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue