release v2

This commit is contained in:
mercury
2023-01-20 21:47:27 +04:00
parent 75fb0bbc6c
commit 66ac1d5285
4 changed files with 32 additions and 20 deletions
+18 -16
View File
@@ -985,24 +985,26 @@ DNS-over-HTTPS with IP:
$text[] = " port: {$status['interface']['listening port']}";
$text[] = " publickey: {$status['interface']['public key']}";
$text[] = "\nPeers:";
foreach ($conf['peers'] as $k => $v) {
foreach ($clients as $cl) {
if ($cl['interface']['Address'] == $v['AllowedIPs']) {
$allowed_ips = $cl['peers'][0]['AllowedIPs'];
if (!empty($conf['peers'])) {
foreach ($conf['peers'] as $k => $v) {
foreach ($clients as $cl) {
if ($cl['interface']['Address'] == $v['AllowedIPs']) {
$allowed_ips = $cl['peers'][0]['AllowedIPs'];
}
}
$conf['peers'][$k]['status'] = $this->getStatusPeer($v['PublicKey'], $status['peers']);
$conf['peers'][$k]['online'] = preg_match('~^(\d+ seconds|[12] minute)~', $conf['peers'][$k]['status']['latest handshake']) ? $conf['peers'][$k]['status']['endpoint'] : 'OFFLINE';
}
usort($conf['peers'], fn($a, $b) => ($a['online'] == 'OFFLINE') <=> ($b['online'] == 'OFFLINE'));
foreach ($conf['peers'] as $k => $v) {
preg_match_all('~([0-9.]+\.?)\s(\w+)~', $v['status']['transfer'], $m);
$text[] = ($v['online'] == 'OFFLINE' ? '(OFFLINE) ' : '')
. "{$this->getName($v)} "
. ($v['online'] != 'OFFLINE' ? "({$v['online']})" : '')
. ($m[0] ? " {$m[1][0]}{$m[2][0]} / {$m[1][1]}{$m[2][1]}" : '')
. "\n"
;
}
$conf['peers'][$k]['status'] = $this->getStatusPeer($v['PublicKey'], $status['peers']);
$conf['peers'][$k]['online'] = preg_match('~^(\d+ seconds|[12] minute)~', $conf['peers'][$k]['status']['latest handshake']) ? $conf['peers'][$k]['status']['endpoint'] : 'OFFLINE';
}
usort($conf['peers'], fn($a, $b) => ($a['online'] == 'OFFLINE') <=> ($b['online'] == 'OFFLINE'));
foreach ($conf['peers'] as $k => $v) {
preg_match_all('~([0-9.]+\.?)\s(\w+)~', $v['status']['transfer'], $m);
$text[] = ($v['online'] == 'OFFLINE' ? '(OFFLINE) ' : '')
. "{$this->getName($v)} "
. ($v['online'] != 'OFFLINE' ? "({$v['online']})" : '')
. ($m[0] ? " {$m[1][0]}{$m[2][0]} / {$m[1][1]}{$m[2][1]}" : '')
. "\n"
;
}
$text = "Menu -> Wireguard\n\n<code>" . implode(PHP_EOL, $text) . '</code>';
$data = [