src: style sweep

This commit is contained in:
Franco Fichtner 2024-04-15 08:01:36 +02:00
parent 8f9ee84579
commit 4390deb8c3
3 changed files with 7 additions and 6 deletions

View File

@ -174,7 +174,7 @@ class ClientController extends ApiMutableModelControllerBase
return $this->setBase('configbuilder', 'clients.client', $uuid);
}
public function getServerInfoAction($uuid=null)
public function getServerInfoAction($uuid = null)
{
$result = ['status' => 'failed'];
if ($this->request->isGet()) {
@ -196,7 +196,7 @@ class ClientController extends ApiMutableModelControllerBase
$used_addresses[] = inet_ntop(inet_pton(explode('/', $addr)[0]));
}
foreach ($peers as $peer) {
$this_peer = $this->getModel()->getNodeByReference('clients.client.'.$peer);
$this_peer = $this->getModel()->getNodeByReference('clients.client.' . $peer);
if ($this_peer != null) {
foreach (array_filter(explode(',', (string)$this_peer->tunneladdress)) as $addr) {
$used_addresses[] = inet_ntop(inet_pton(explode('/', $addr)[0]));

View File

@ -520,8 +520,8 @@ class Util
$bits = explode('/', $cidr)[1];
$inet_start = inet_pton($range[0]);
if (str_contains($range[0], ':')) {
for ($i=0; $i < pow(2, min(128 - (int)$bits, 32)); ++$i) {
yield inet_ntop($inet_start | inet_pton('0000::'. dechex($i)));
for ($i = 0; $i < pow(2, min(128 - (int)$bits, 32)); ++$i) {
yield inet_ntop($inet_start | inet_pton('0000::' . dechex($i)));
}
} else {
/**
@ -529,7 +529,7 @@ class Util
* unless size is >= 31 in which case these may be omitted acording to RFC3021
*/
$range_start = (int)$bits >= 31 ? 0 : 1;
$range_stop = (int)$bits >= 31 ? pow(2, 32 - (int)$bits) : pow(2, 32 - (int)$bits) - 1 ;
$range_stop = (int)$bits >= 31 ? pow(2, 32 - (int)$bits) : pow(2, 32 - (int)$bits) - 1;
for ($i = $range_start; $i < $range_stop; ++$i) {
yield inet_ntop($inet_start | inet_pton(long2ip($i)));
}

View File

@ -29,7 +29,8 @@
require_once("interfaces.inc");
require_once("config.inc");
function map_ifs($ifs, $data) {
function map_ifs($ifs, $data)
{
$result = ["interfaces" => []];
$temp = gettimeofday();
$result['time'] = (double)$temp["sec"] + (double)$temp["usec"] / 1000000.0;