mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-13 08:09:41 +00:00
openvpn: bring instances into server field
While here condense the input a little and show the default port in case it was left empty. PR: https://forum.opnsense.org/index.php?topic=35337.0
This commit is contained in:
parent
0a4eacfb6a
commit
ee4496702d
@ -30,6 +30,7 @@ namespace OPNsense\OpenVPN\FieldTypes;
|
||||
|
||||
use OPNsense\Base\FieldTypes\BaseListField;
|
||||
use OPNsense\Core\Config;
|
||||
use OPNsense\OpenVPN\OpenVPN;
|
||||
|
||||
/**
|
||||
* @package OPNsense\Base\FieldTypes
|
||||
@ -47,11 +48,16 @@ class OpenVPNServerField extends BaseListField
|
||||
isset(Config::getInstance()->object()->openvpn->$ref)
|
||||
) {
|
||||
foreach (Config::getInstance()->object()->openvpn->$ref as $server) {
|
||||
$label = (string)$server->description ?? '';
|
||||
$label .= ' ( ' . (string)$server->local_port . ' / ' . (string)$server->protocol . ' )';
|
||||
$label = (string)$server->description ?? '';
|
||||
$label .= ' (' . (string)$server->local_port . ' / ' . (string)$server->protocol . ')';
|
||||
self::$internalCacheOptionList[(string)$server->vpnid] = $label;
|
||||
}
|
||||
}
|
||||
foreach ((new OpenVPN())->Instances->Instance->iterateItems() as $node_uuid => $node) {
|
||||
if ((string)$node->role == 'server') {
|
||||
self::$internalCacheOptionList[$node_uuid] = (string)$node->description . ' (' . (!empty((string)$node->port) ? (string)$node->port : '1194') . ' / ' . strtoupper((string)$node->proto) . ')';
|
||||
}
|
||||
}
|
||||
natcasesort(self::$internalCacheOptionList);
|
||||
}
|
||||
$this->internalOptionList = self::$internalCacheOptionList;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user