#!/bin/sh
modprobe wireguard
[ -e /dev/fd ] || ln -sf /proc/self/fd /dev/fd

case "$1" in

	start)
			echo "Starting all configured Wireguard interfaces"
			wg-quick up wg0
		;;

	stop)
			echo "Stopping Wireguard interface: wg0"
			wg-quick down wg0
		;;

	restart)
			wg-quick stop wg0
			sleep 1
			wg-quick start wg0
		;;

	status)
			wg show wg0
		;;

	*)
		echo "(start|stop|restart|status)"
		;;
esac

exit 0
