net/wireguard: hook up 'newwanip' and 'vpn' facilities #3565

This commit is contained in:
Franco Fichtner
2023-09-05 07:52:05 +02:00
parent e3284aef64
commit 949fbaa4ba
3 changed files with 35 additions and 4 deletions
+1 -2
View File
@@ -1,6 +1,5 @@
PLUGIN_NAME= wireguard
PLUGIN_VERSION= 2.0
PLUGIN_REVISION= 2
PLUGIN_VERSION= 2.1
PLUGIN_COMMENT= WireGuard VPN service kernel implementation
PLUGIN_DEPENDS= wireguard-kmod
PLUGIN_CONFLICTS= wireguard-go
@@ -102,3 +102,37 @@ function wireguard_devices()
{
return [['pattern' => '^wg', 'volatile' => true]];
}
function wireguard_configure()
{
return [
'newwanip' => ['wireguard_renew:2'],
'vpn' => ['wireguard_configure_do:2'],
];
}
function wireguard_configure_do($verbose = false, $unused = '')
{
if (!wireguard_enabled()) {
return;
}
service_log('Configuring WireGuard VPN...', $verbose);
configd_run('wireguard configure');
service_log("done.\n", $verbose);
}
function wireguard_renew($verbose = false, $unused = '')
{
if (!wireguard_enabled()) {
return;
}
service_log('Renewing WireGuard VPN...', $verbose);
configd_run('wireguard renew');
service_log("done.\n", $verbose);
}
@@ -1,2 +0,0 @@
#!/bin/sh
configctl -dq wireguard configure