diff options
Diffstat (limited to 'allium/templates/misc-networks.html')
-rw-r--r-- | allium/templates/misc-networks.html | 109 |
1 files changed, 62 insertions, 47 deletions
diff --git a/allium/templates/misc-networks.html b/allium/templates/misc-networks.html index 2eeabb1..c6f1191 100644 --- a/allium/templates/misc-networks.html +++ b/allium/templates/misc-networks.html @@ -1,54 +1,69 @@ -{% extends "skeleton.html" %} -{% set sorted_by_label = sorted_by.split(',')[0].split('.')[1] %} -{% block title %}Tor Relays :: Networks By {{ sorted_by_label|replace('_', ' ')|title }}{% endblock %} -{% block body %} -<h2><a href={{ path_prefix }}>Home</a> :: Networks By {{ sorted_by_label|replace('_', ' ')|title }}</h2> -<p>The set of all ({{ relays.json['sorted']['as']|length }}) recognized networks running at least one relay sorted by {{ sorted_by_label|replace('_', ' ') }}. This data is onionoo-derived and might be out of date with respect to other sources.</p> +{% extends "skeleton.html" -%} +{% set sorted_by_label = sorted_by.split(',')[0].split('.')[1] -%} +{% block title -%}Tor Relays :: Networks By {{ sorted_by_label|replace('_', +' ')|title }}{% endblock -%} +{% block body -%} +<h2><a href={{ path_prefix }}>Home</a> :: Networks By {{ +sorted_by_label|replace('_', ' ')|title }}</h2> +<p>The set of all ({{ relays.json['sorted']['as']|length }}) recognized networks +running at least one relay sorted by {{ sorted_by_label|replace('_', ' ') }}. +This data is onionoo-derived and might be out of date with respect to other +sources.</p> <table class="table table-condensed"> - <tr> - <th>AS Number</th> - <th>AS Name</th> - <th>Country</th> - {% if sorted_by_label == 'bandwidth' %} - <th>Bandwidth</th> - {% else %} - <th><a href="networks-by-bandwidth.html">Bandwidth</a></th> - {% endif %} - {% if sorted_by_label == 'exit_count' %} - <th>Exit / <a href="networks-by-middle-count.html">Middle</a></th> - {% elif sorted_by_label == 'middle_count' %} - <th><a href="networks-by-exit-count.html">Exit</a> / Middle</th> - {% else %} - <th><a href="networks-by-exit-count.html">Exit</a> / <a href="families-by-middle-count.html">Middle</a></th> - {% endif %} - </tr> - <tbody> - {% for k, v in relays.json['sorted']['as'].items()|sort(attribute=sorted_by, reverse=True) %} - <tr> - {% if v['bandwidth'] > 1000000 %} - {% set obs_bandwidth = '%s %s'|format((v['bandwidth'] / 1000000)|round(2, 'common'), 'MB/s') %} - {% else %} - {% set obs_bandwidth = '%s %s'|format((v['bandwidth'] / 1000)|round(2, 'common'), 'KB/s') %}{% endif %} +<tr> +<th>AS Number</th> +<th>AS Name</th> +<th>Country</th> +{% if sorted_by_label == 'bandwidth' -%} +<th>Bandwidth</th> +{% else -%} +<th><a href="networks-by-bandwidth.html">Bandwidth</a></th> +{% endif -%} - <td><a href="{{ path_prefix}}as/{{ k|escape }}/">{{ k|escape }}</a></td> +{% if sorted_by_label == 'exit_count' -%} +<th>Exit / <a href="networks-by-middle-count.html">Middle</a></th> +{% elif sorted_by_label == 'middle_count' -%} +<th><a href="networks-by-exit-count.html">Exit</a> / Middle</th> +{% else -%} +<th><a href="networks-by-exit-count.html">Exit</a> / <a +href="families-by-middle-count.html">Middle</a></th> +{% endif -%} +</tr> - {% if v['as_name'] %} - <td title="{{ v['as_name']|escape }}"><a href="https://bgp.he.net/{{ k|escape }}">{{ v['as_name']|truncate(20)|escape }}</a></td> - {% else %} - <td>Unknown</td> - {% endif %} +<tbody> +{% for k, v in relays.json['sorted']['as'].items()|sort(attribute=sorted_by, +reverse=True) -%} +<tr> +{% if v['bandwidth'] > 1000000 -%} +{% set obs_bandwidth = '%s %s'|format((v['bandwidth'] / 1000000)|round(2, +'common'), 'MB/s') -%} +{% else -%} +{% set obs_bandwidth = '%s %s'|format((v['bandwidth'] / 1000)|round(2, +'common'), 'KB/s') -%}{% endif -%} - {% if v['country'] %} - <td><a href="{{ path_prefix }}country/{{ v['country']|escape }}/"><img src="{{ path_prefix }}static/images/cc/{{ v['country']|escape }}.png" title="{{ v['country_name']|escape }}"alt="{{ v['country_name']|escape }}"></a></td> - {% else %} - <td>X</td> - {% endif %} +<td><a href="{{ path_prefix}}as/{{ k|escape }}/">{{ k|escape }}</a></td> - <td>{{ obs_bandwidth }}</td> +{% if v['as_name'] -%} +<td title="{{ v['as_name']|escape }}"><a href="https://bgp.he.net/{{ k|escape +}}">{{ v['as_name']|truncate(20)|escape }}</a></td> +{% else -%} +<td>Unknown</td> +{% endif -%} - <td>{{ v['exit_count'] }} / {{ v['middle_count'] }}</td> - </tr> - {% endfor %} - </tbody> +{% if v['country'] -%} +<td><a href="{{ path_prefix }}country/{{ v['country']|escape }}/"><img src="{{ +path_prefix }}static/images/cc/{{ v['country']|escape }}.png" title="{{ +v['country_name']|escape }}"alt="{{ v['country_name']|escape +}}"></a></td> +{% else -%} +<td>X</td> +{% endif -%} + +<td>{{ obs_bandwidth }}</td> + +<td>{{ v['exit_count'] }} / {{ v['middle_count'] }}</td> +</tr> +{% endfor -%} +</tbody> </table> -{% endblock %} +{% endblock -%} |