aboutsummaryrefslogtreecommitdiff
path: root/tor-metrics/templates
diff options
context:
space:
mode:
Diffstat (limited to 'tor-metrics/templates')
-rw-r--r--tor-metrics/templates/families.html47
-rw-r--r--tor-metrics/templates/index.html4
-rw-r--r--tor-metrics/templates/misc-families.html64
-rw-r--r--tor-metrics/templates/misc-networks.html (renamed from tor-metrics/templates/networks.html)29
4 files changed, 87 insertions, 57 deletions
diff --git a/tor-metrics/templates/families.html b/tor-metrics/templates/families.html
deleted file mode 100644
index cbf8e8b..0000000
--- a/tor-metrics/templates/families.html
+++ /dev/null
@@ -1,47 +0,0 @@
-{% extends "skeleton.html" %}
-{% block title %}Tor Relays :: Families{% endblock %}
-{% block body %}
-<h2><a href="./">Home</a> :: Families</h2>
-<p>The set of all relay families with > 1 effective members. The first_seen parameter is taken from the oldest relay in the family.</p>
-<table class="table table-condensed">
- <tr>
- <th>Family</th>
- <th>Bandwidth</th>
- <th class="visible-md visible-lg">Contact</th>
- <th>Exit Count</th>
- <th>Middle Count</th>
- <th>First Seen<th>
- </tr>
- <tbody>
- {% set processed = dict() %}
- {% for k, v in relays.json['sorted']['family'].items()|sort(attribute='1.bw', reverse=True) %}
- {% if relays.json['relays'][v['relays'][0]]['fingerprint'] not in processed %}
- <tr>
- {% if v['bw'] > 1000000 %}
- {% set obs_bandwidth = '%s %s'|format((v['bw'] / 1000000)|round(2, 'common'), 'MB/s') %}
- {% else %}
- {% set obs_bandwidth = '%s %s'|format((v['bw'] / 1000)|round(2, 'common'), 'KB/s') %}{% endif %}
-
- <td><a href="{{ path_prefix}}family/{{ k|escape }}/">{{ k|escape }}</a></td>
-
- <td>{{ obs_bandwidth }}</td>
-
- {% if v['contact'] %}
- <td class="visible-md visible-lg"><a href="{{ path_prefix }}contact/{{ v['contact']|hash }}/" title="{{ v['contact']|escape }}">{{ v['contact']|truncate(50)|escape }}<a></td>
- {% else %}
- <td>none</td>{% endif %}
-
- <td>{{ v['exit_count'] }}</td>
- <td>{{ v['middle_count'] }}</td>
-
- <td>{{ v['first_seen'].split(' ', 1)[0]|escape }}</td>
-
- {% for r in v['relays'] %}
- {% set _dummy = processed.update({relays.json['relay_subset'][r]['fingerprint']: None}) %}
- {% endfor %}
- </tr>
- {% endif %}
- {% endfor %}
- </tbody>
-</table>
-{% endblock %}
diff --git a/tor-metrics/templates/index.html b/tor-metrics/templates/index.html
index 7447be7..c3b0e96 100644
--- a/tor-metrics/templates/index.html
+++ b/tor-metrics/templates/index.html
@@ -1,5 +1,5 @@
{% extends "relay-list.html" %}
{% block title %}Tor Relays{% endblock %}
-{% block header %}Tor Metrics (<a href="http://d6amkx45augz4kskvjryv3bmmwyf7vw4k3uwxsh5egnibw2igl5aozqd.onion/">v3</a>, <a href="https://github.com/tempname1024/tor-metrics">git</a>) :: <a href="./networks.html">Networks</a>, <a href="./families.html">Families</a>{% endblock %}
-{% block description %}Relay listings are statically generated every hour. Last fetch was at {{ relays.timestamp }}. Listing top 500 relays; <a href="all.html">view full list</a>.{% endblock %}
+{% block header %}Tor Metrics (<a href="http://d6amkx45augz4kskvjryv3bmmwyf7vw4k3uwxsh5egnibw2igl5aozqd.onion/">v3</a>, <a href="https://github.com/tempname1024/tor-metrics">git</a>) :: <a href="./misc/families-by-bandwidth.html">Networks</a>, <a href="./misc/families-by-bandwidth.html">Families</a>{% endblock %}
+{% block description %}Relay listings are statically generated every hour. Last fetch was at {{ relays.timestamp }}. Listing top 500 relays; <a href="misc/all.html">view full list</a>.{% endblock %}
diff --git a/tor-metrics/templates/misc-families.html b/tor-metrics/templates/misc-families.html
new file mode 100644
index 0000000..8df7d6d
--- /dev/null
+++ b/tor-metrics/templates/misc-families.html
@@ -0,0 +1,64 @@
+{% extends "skeleton.html" %}
+{% set sorted_by_label = sorted_by.split(',')[0].split('.')[1] %}
+{% block title %}Tor Relays :: Families By {{ sorted_by_label|replace('_', ' ')|title }}{% endblock %}
+{% block body %}
+<h2><a href={{ path_prefix }}>Home</a> :: Families By {{ sorted_by_label|replace('_', ' ')|title }}</h2>
+<p>The set of all relay families with > 1 effective members, sorted by {{ sorted_by_label|replace('_', ' ') }}. The first seen parameter is taken from the oldest relay in the family.</p>
+<table class="table table-condensed">
+ <tr>
+ <th>Family</th>
+ {% if sorted_by_label == 'bandwidth' %}
+ <th>Bandwidth</th>
+ {% else %}
+ <th><a href="families-by-bandwidth.html">Bandwidth</a></th>
+ {% endif %}
+ <th class="visible-md visible-lg">Contact</th>
+ {% if sorted_by_label == 'exit_count' %}
+ <th>Exit Count</th>
+ {% else %}
+ <th><a href="families-by-exit-count.html">Exit Count</a></th>
+ {% endif %}
+ {% if sorted_by_label == 'middle_count' %}
+ <th>Middle Count</th>
+ {% else %}
+ <th><a href="families-by-middle-count.html">Middle Count</a></th>
+ {% endif %}
+ {% if sorted_by_label == 'first_seen' %}
+ <th>First Seen</th>
+ {% else %}
+ <th><a href="families-by-first-seen.html">First Seen</a></th>
+ {% endif %}
+ </tr>
+ <tbody>
+ {% set processed = dict() %}
+ {% for k, v in relays.json['sorted']['family'].items()|sort(attribute=sorted_by, reverse=True) %}
+ {% if relays.json['relays'][v['relays'][0]]['fingerprint'] not in processed %}
+ <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 %}
+
+ <td><a href="{{ path_prefix}}family/{{ k|escape }}/">{{ k|escape }}</a></td>
+
+ <td>{{ obs_bandwidth }}</td>
+
+ {% if v['contact'] %}
+ <td class="visible-md visible-lg"><a href="{{ path_prefix }}contact/{{ v['contact']|hash }}/" title="{{ v['contact']|escape }}">{{ v['contact']|truncate(50)|escape }}<a></td>
+ {% else %}
+ <td>none</td>{% endif %}
+
+ <td>{{ v['exit_count'] }}</td>
+ <td>{{ v['middle_count'] }}</td>
+
+ <td>{{ v['first_seen'].split(' ', 1)[0]|escape }}</td>
+
+ {% for r in v['relays'] %}
+ {% set _dummy = processed.update({relays.json['relay_subset'][r]['fingerprint']: None}) %}
+ {% endfor %}
+ </tr>
+ {% endif %}
+ {% endfor %}
+ </tbody>
+</table>
+{% endblock %}
diff --git a/tor-metrics/templates/networks.html b/tor-metrics/templates/misc-networks.html
index 46ac549..97b7c28 100644
--- a/tor-metrics/templates/networks.html
+++ b/tor-metrics/templates/misc-networks.html
@@ -1,24 +1,37 @@
{% extends "skeleton.html" %}
-{% block title %}Tor Relays :: Networks{% endblock %}
+{% 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="./">Home</a> :: Networks</h2>
-<p>The set of all ({{ relays.json['sorted']['as']|length }}) recognized networks running at least one relay. This data is onionoo-derived and might be out of date with respect to other sources.</p>
+<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 Count</th>
- <th>Middle Count<th>
+ {% else %}
+ <th><a href="networks-by-exit-count.html">Exit Count</a></th>
+ {% endif %}
+ {% if sorted_by_label == 'middle_count' %}
+ <th>Middle Count</th>
+ {% else %}
+ <th><a href="networks-by-middle-count.html">Middle Count</a></th>
+ {% endif %}
</tr>
<tbody>
- {% for k, v in relays.json['sorted']['as'].items()|sort(attribute='1.bw', reverse=True) %}
+ {% for k, v in relays.json['sorted']['as'].items()|sort(attribute=sorted_by, reverse=True) %}
<tr>
- {% if v['bw'] > 1000000 %}
- {% set obs_bandwidth = '%s %s'|format((v['bw'] / 1000000)|round(2, 'common'), 'MB/s') %}
+ {% 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['bw'] / 1000)|round(2, 'common'), 'KB/s') %}{% endif %}
+ {% set obs_bandwidth = '%s %s'|format((v['bandwidth'] / 1000)|round(2, 'common'), 'KB/s') %}{% endif %}
<td><a href="{{ path_prefix}}as/{{ k|escape }}/">{{ k|escape }}</a></td>