dns/dnscrypt-proxy: fix regex of course

We don't need non-capture groups so simplify a bit and fetch
the second capture group with the port.
This commit is contained in:
Franco Fichtner
2023-03-27 10:05:55 +02:00
parent 53bd339164
commit 73abcfe3b5
@@ -51,8 +51,8 @@ function dnscryptproxy_services()
$ports = [];
foreach (explode(',', (string)$model->listen_addresses) as $addrport) {
if (preg_match('/^(?:(\[.+\]:)|([\d\.]+:))[\d]+$/', $addrport, $matches)) {
$ports[$matches[1]] = 1;
if (preg_match('/^(\[.+\]|[\d\.]+):([\d]+)$/', $addrport, $matches)) {
$ports[$matches[2]] = 1;
}
}