<!doctype html>

<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <title>UDP BitTorrent tracker statistics</title>

    {#- Include stylesheet like this to prevent code editor syntax warnings #}
    { stylesheet | unescaped }
</head>

<body>
    <h1>BitTorrent tracker statistics</h1>

    {#- <p> <strong>Tracker software:</strong> <a href="https://github.com/greatest-ape/aquatic">aquatic_udp</a> </p> #}

    <p>
        <strong>Updated:</strong> { last_updated } (UTC)
    </p>

    {{ if ipv4_active }}

    <h2>IPv4</h2>

    <table>
        <caption>* Torrent/peer count is updated every { peer_update_interval } seconds</caption>
        <tr>
            <th scope="row">Number of torrents</th>
            <td>{ ipv4.num_torrents } *</td>
        </tr>
        <tr>
            <th scope="row">Number of peers</th>
            <td>{ ipv4.num_peers } *</td>
        </tr>
        <tr>
            <th scope="row">Requests / second</th>
            <td>{ ipv4.requests_per_second }</td>
        </tr>
        <tr>
            <th scope="row">Total responses / second</th>
            <td>{ ipv4.responses_per_second_total }</td>
        </tr>
        <tr>
            <th scope="row">Connect responses / second</th>
            <td>{ ipv4.responses_per_second_connect }</td>
        </tr>
        <tr>
            <th scope="row">Announce responses / second</th>
            <td>{ ipv4.responses_per_second_announce }</td>
        </tr>
        <tr>
            <th scope="row">Scrape responses / second</th>
            <td>{ ipv4.responses_per_second_scrape }</td>
        </tr>
        <tr>
            <th scope="row">Error responses / second</th>
            <td>{ ipv4.responses_per_second_error }</td>
        </tr>
        <tr>
            <th scope="row">Bandwidth (RX)</th>
            <td>{ ipv4.rx_mbits } mbit/s</td>
        </tr>
        <tr>
            <th scope="row">Bandwidth (TX)</th>
            <td>{ ipv4.tx_mbits } mbit/s</td>
        </tr>
    </table>

    {{ if extended_active }}

    <h3>Peers per torrent</h3>

    <table>
        <caption>Updated every { peer_update_interval } seconds</caption>
        <tr>
            <th scope="row">Minimum</th>
            <td>{ ipv4.peer_histogram.min }</td>
        </tr>
        <tr>
            <th scope="row">10th percentile</th>
            <td>{ ipv4.peer_histogram.p10 }</td>
        </tr>
        <tr>
            <th scope="row">20th percentile</th>
            <td>{ ipv4.peer_histogram.p20 }</td>
        </tr>
        <tr>
            <th scope="row">30th percentile</th>
            <td>{ ipv4.peer_histogram.p30 }</td>
        </tr>
        <tr>
            <th scope="row">40th percentile</th>
            <td>{ ipv4.peer_histogram.p40 }</td>
        </tr>
        <tr>
            <th scope="row">50th percentile</th>
            <td>{ ipv4.peer_histogram.p50 }</td>
        </tr>
        <tr>
            <th scope="row">60th percentile</th>
            <td>{ ipv4.peer_histogram.p60 }</td>
        </tr>
        <tr>
            <th scope="row">70th percentile</th>
            <td>{ ipv4.peer_histogram.p70 }</td>
        </tr>
        <tr>
            <th scope="row">80th percentile</th>
            <td>{ ipv4.peer_histogram.p80 }</td>
        </tr>
        <tr>
            <th scope="row">90th percentile</th>
            <td>{ ipv4.peer_histogram.p90 }</td>
        </tr>
        <tr>
            <th scope="row">95th percentile</th>
            <td>{ ipv4.peer_histogram.p95 }</td>
        </tr>
        <tr>
            <th scope="row">99th percentile</th>
            <td>{ ipv4.peer_histogram.p99 }</td>
        </tr>
        <tr>
            <th scope="row">99.9th percentile</th>
            <td>{ ipv4.peer_histogram.p999 }</td>
        </tr>
        <tr>
            <th scope="row">Maximum</th>
            <td>{ ipv4.peer_histogram.max }</td>
        </tr>
    </table>
    
    {{ endif }}

    {{ endif }}

    {{ if ipv6_active }}

    <h2>IPv6</h2>

    <table>
        <caption>* Torrent/peer count is updated every { peer_update_interval } seconds</caption>
        <tr>
            <th scope="row">Number of torrents</th>
            <td>{ ipv6.num_torrents } *</td>
        </tr>
        <tr>
            <th scope="row">Number of peers</th>
            <td>{ ipv6.num_peers } *</td>
        </tr>
        <tr>
            <th scope="row">Requests / second</th>
            <td>{ ipv6.requests_per_second }</td>
        </tr>
        <tr>
            <th scope="row">Total responses / second</th>
            <td>{ ipv6.responses_per_second_total }</td>
        </tr>
        <tr>
            <th scope="row">Connect responses / second</th>
            <td>{ ipv6.responses_per_second_connect }</td>
        </tr>
        <tr>
            <th scope="row">Announce responses / second</th>
            <td>{ ipv6.responses_per_second_announce }</td>
        </tr>
        <tr>
            <th scope="row">Scrape responses / second</th>
            <td>{ ipv6.responses_per_second_scrape }</td>
        </tr>
        <tr>
            <th scope="row">Error responses / second</th>
            <td>{ ipv6.responses_per_second_error }</td>
        </tr>
        <tr>
            <th scope="row">Bandwidth (RX)</th>
            <td>{ ipv6.rx_mbits } mbit/s</td>
        </tr>
        <tr>
            <th scope="row">Bandwidth (TX)</th>
            <td>{ ipv6.tx_mbits } mbit/s</td>
        </tr>
    </table>

    {{ if extended_active }}

    <h3>Peers per torrent</h3>

    <table>
        <caption>Updated every { peer_update_interval } seconds</caption>
        <tr>
            <th scope="row">Minimum</th>
            <td>{ ipv6.peer_histogram.min }</td>
        </tr>
        <tr>
            <th scope="row">10th percentile</th>
            <td>{ ipv6.peer_histogram.p10 }</td>
        </tr>
        <tr>
            <th scope="row">20th percentile</th>
            <td>{ ipv6.peer_histogram.p20 }</td>
        </tr>
        <tr>
            <th scope="row">30th percentile</th>
            <td>{ ipv6.peer_histogram.p30 }</td>
        </tr>
        <tr>
            <th scope="row">40th percentile</th>
            <td>{ ipv6.peer_histogram.p40 }</td>
        </tr>
        <tr>
            <th scope="row">50th percentile</th>
            <td>{ ipv6.peer_histogram.p50 }</td>
        </tr>
        <tr>
            <th scope="row">60th percentile</th>
            <td>{ ipv6.peer_histogram.p60 }</td>
        </tr>
        <tr>
            <th scope="row">70th percentile</th>
            <td>{ ipv6.peer_histogram.p70 }</td>
        </tr>
        <tr>
            <th scope="row">80th percentile</th>
            <td>{ ipv6.peer_histogram.p80 }</td>
        </tr>
        <tr>
            <th scope="row">90th percentile</th>
            <td>{ ipv6.peer_histogram.p90 }</td>
        </tr>
        <tr>
            <th scope="row">95th percentile</th>
            <td>{ ipv6.peer_histogram.p95 }</td>
        </tr>
        <tr>
            <th scope="row">99th percentile</th>
            <td>{ ipv6.peer_histogram.p99 }</td>
        </tr>
        <tr>
            <th scope="row">99.9th percentile</th>
            <td>{ ipv6.peer_histogram.p999 }</td>
        </tr>
        <tr>
            <th scope="row">Maximum</th>
            <td>{ ipv6.peer_histogram.max }</td>
        </tr>
    </table>
    
    {{ endif }}

    {{ endif }}

    {{ if extended_active }}

    <h2>Peer clients</h2>

    <table>
        <thead>
            <tr>
                <th>Client</th>
                <th>Count</th>
            </tr>
        </thead>
        <tbody>
            {{ for value in peer_clients }}
            <tr>
                <td>{ value.0 }</td>
                <td>{ value.1 }</td>
            </tr>
            {{ endfor }}
        </tbody>
    </table>

    {{ endif }}
</body>
</html>