@php $fmtBytes = function (int $n): string { $u = ['B', 'KB', 'MB', 'GB', 'TB']; $i = 0; $v = (float) $n; while ($v >= 1024 && $i < count($u) - 1) { $v /= 1024; $i++; } return ($i === 0 ? (string) $n : number_format($v, 1)).' '.$u[$i]; }; $ago = function (int $ts): string { if ($ts <= 0) return __('wireguard.never'); $d = max(0, time() - $ts); if ($d < 60) return $d.'s'; if ($d < 3600) return intdiv($d, 60).'m'; if ($d < 86400) return intdiv($d, 3600).'h'; return intdiv($d, 86400).'d'; }; @endphp

{{ __('wireguard.eyebrow') }}

{{ __('wireguard.heading') }}

{{ __('wireguard.subtitle') }}

@if (! $status['configured'])

{{ __('wireguard.not_configured_body') }}

sudo clusev wg setup
@else @if ($status['stale'])
{{ __('wireguard.stale') }}
@endif @php $win = collect($windows)->mapWithKeys(fn ($s) => [$s => match ($s) { 3600 => __('wireguard.window_1h'), 86400 => __('wireguard.window_24h'), default => __('wireguard.window_7d'), }])->all(); $fmtB = function (int $n): string { $u = ['B', 'KB', 'MB', 'GB', 'TB']; $i = 0; $v = (float) $n; while ($v >= 1024 && $i < count($u) - 1) { $v /= 1024; $i++; } return ($i === 0 ? (string) $n : number_format($v, 1)).' '.$u[$i]; }; $pts = $traffic['points']; $n = max(1, count($pts) - 1); $peak = max(1, $traffic['peak_down'], $traffic['peak_up']); $line = function (string $key) use ($pts, $n, $peak) { $out = []; foreach ($pts as $i => $p) { $x = round($i / $n * 600, 1); $y = round(140 - ($p[$key] / $peak) * 132, 1); $out[] = $x.','.$y; } return implode(' ', $out); }; $hasTraffic = $traffic['total_down'] > 0 || $traffic['total_up'] > 0; @endphp
{{ __('wireguard.total_down') }}: {{ $fmtB($traffic['total_down']) }} {{ __('wireguard.total_up') }}: {{ $fmtB($traffic['total_up']) }}
@foreach ($windows as $w) @endforeach
@if ($hasTraffic) @else

{{ __('wireguard.no_traffic') }}

@endif
@forelse ($status['peers'] as $peer)
{{ $peer['name'] !== '' ? $peer['name'] : \Illuminate\Support\Str::limit($peer['pubkey'], 10, '…') }} {{ $peer['online'] ? __('wireguard.online') : __('wireguard.offline') }} {{ __('wireguard.last_handshake') }}: {{ $ago($peer['latest_handshake']) }} {{ $peer['endpoint'] !== '' ? $peer['endpoint'] : '—' }} {{ __('wireguard.down_up', ['rx' => $fmtBytes($peer['rx']), 'tx' => $fmtBytes($peer['tx'])]) }}
@empty

{{ __('wireguard.no_peers') }}

@endforelse
@if ($status['gate']['marker'] && $status['gate']['chain']) {{ __('wireguard.gate_on') }} @else {{ __('wireguard.gate_off') }} @endif

{{ __('wireguard.gate_escape') }}

{{ __('wireguard.subnet') }}
{{ $status['server']['subnet'] ?: '—' }}
{{ __('wireguard.server_ip') }}
{{ $status['server']['server_ip'] ?: '—' }}
{{ __('wireguard.port') }}
{{ $status['server']['port'] ?: '—' }}
{{ __('wireguard.endpoint') }}
{{ $status['server']['endpoint'] ?: '—' }}
{{ __('wireguard.service') }}
{{ $status['wg_quick'] }}
@endif