mirror of
https://github.com/netbirdio/plugins.git
synced 2026-05-22 18:44:07 -07:00
net/wireguard-go: pull all names into device registration after core change
PR: https://forum.opnsense.org/index.php?topic=37189.0
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
PLUGIN_NAME= wireguard-go
|
||||
PLUGIN_VERSION= 1.13
|
||||
PLUGIN_REVISION= 7
|
||||
PLUGIN_REVISION= 8
|
||||
PLUGIN_COMMENT= WireGuard VPN service Go implementation
|
||||
PLUGIN_CONFLICTS= wireguard
|
||||
PLUGIN_OBSOLETE= yes
|
||||
|
||||
@@ -50,11 +50,6 @@ function wireguard_services()
|
||||
'name' => 'wireguard-go',
|
||||
];
|
||||
|
||||
if (file_exists('/boot/modules/if_wg.ko') || file_exists('/boot/kernel/if_wg.ko')) {
|
||||
$service['name'] = 'wireguard';
|
||||
$service['nocheck'] = true;
|
||||
}
|
||||
|
||||
$services[] = $service;
|
||||
|
||||
return $services;
|
||||
@@ -89,14 +84,26 @@ function wireguard_xmlrpc_sync()
|
||||
$result['description'] = gettext('WireGuard');
|
||||
$result['services'] = ['wireguard-go'];
|
||||
|
||||
if (file_exists('/boot/modules/if_wg.ko') || file_exists('/boot/kernel/if_wg.ko')) {
|
||||
$result['services'] = ['wireguard'];
|
||||
}
|
||||
|
||||
return [$result];
|
||||
}
|
||||
|
||||
function wireguard_devices()
|
||||
{
|
||||
return [['pattern' => '^wg', 'volatile' => true]];
|
||||
$names = [];
|
||||
foreach ((new OPNsense\Wireguard\Server())->servers->server->iterateItems() as $key => $node) {
|
||||
if (!empty((string)$node->enabled)) {
|
||||
$names[(string)$node->interface] = [
|
||||
'descr' => sprintf('%s (WireGuard - %s)', (string)$node->interface, (string)$node->name),
|
||||
'ifdescr' => (string)$node->name,
|
||||
'name' => (string)$node->interface
|
||||
];
|
||||
}
|
||||
}
|
||||
return [[
|
||||
'configurable' => false,
|
||||
'pattern' => '^wg',
|
||||
'type' => 'wireguard',
|
||||
'volatile' => true,
|
||||
'names' => $names,
|
||||
]];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user