Skip to content

Commit

Permalink
net/wireguard: hook up 'newwanip' and 'vpn' facilities #3565
Browse files Browse the repository at this point in the history
  • Loading branch information
fichtner committed Aug 31, 2023
1 parent 90a16b1 commit 7f6e513
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 2 deletions.
34 changes: 34 additions & 0 deletions net/wireguard/src/etc/inc/plugins.inc.d/wireguard.inc
Expand Up @@ -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);
}
2 changes: 0 additions & 2 deletions net/wireguard/src/etc/rc.syshook.d/start/50-wireguard

This file was deleted.

0 comments on commit 7f6e513

Please sign in to comment.