[tor-commits] [atlas/master] Displays IPv6 address in search results table
irl at torproject.org
irl at torproject.org
Fri Jan 5 16:43:51 UTC 2018
commit f691593edc0bdfc3a2423df4d4de34f9db70d1b3
Author: Iain R. Learmonth <irl at fsfe.org>
Date: Fri Jan 5 14:33:39 2018 +0000
Displays IPv6 address in search results table
---
js/models/relay.js | 1 +
js/views/search/do.js | 1 +
templates/search/do.html | 4 +++-
3 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/js/models/relay.js b/js/models/relay.js
index 78a8378..70cef1c 100644
--- a/js/models/relay.js
+++ b/js/models/relay.js
@@ -206,6 +206,7 @@ define([
relay.or_address = relay.or_addresses ? relay.or_addresses[0].split(":")[0] : null;
relay.unreachable_or_addresses = relay.unreachable_or_addresses ? relay.unreachable_or_addresses : [];
relay.or_v6_addresses = $.grep(relay.or_addresses, function(n, i) { return n.indexOf("[") == 0; });
+ relay.or_v6_address = (relay.or_v6_addresses.length > 0) ? relay.or_v6_addresses[0].split("]")[0].replace(/\[/, "") : null;
relay.unreachable_or_v4_addresses = $.grep(relay.unreachable_or_addresses, function(n, i) { return n.indexOf(".") != -1; });
relay.unreachable_or_v6_addresses = $.grep(relay.unreachable_or_addresses, function(n, i) { return n.indexOf("[") == 0; });
relay.or_port = relay.or_addresses ? relay.or_addresses[0].split(":")[1] : 0;
diff --git a/js/views/search/do.js b/js/views/search/do.js
index bed2e8c..18b1f05 100644
--- a/js/views/search/do.js
+++ b/js/views/search/do.js
@@ -37,6 +37,7 @@ define([
null, //Uptime
null, //Country
{ "sType": "ip-address" }, //IP Address
+ { "sType": "ip-address" }, //IPv6 Address
null, //Flags
null, //Additional Flags
null, //ORPort
diff --git a/templates/search/do.html b/templates/search/do.html
index e0dadfd..5908e80 100644
--- a/templates/search/do.html
+++ b/templates/search/do.html
@@ -59,7 +59,8 @@
<th>Bandwidth</th>
<th>Uptime</th>
<th>Country</th>
- <th>IP</th>
+ <th>IPv4</th>
+ <th>IPv6</th>
<th>Flags</th>
<th style="white-space: nowrap;">Add. Flags</th>
<th>ORPort</th>
@@ -100,6 +101,7 @@
<td data-order="Unknown"><img class="tip inline country" title="Unknown" alt="Unknown" src="img/cc/xz.png"></td>
<% } %>
<td><%= relay.get('or_address') %></td>
+ <td><%= (relay.get('or_v6_address')) ? relay.get('or_v6_address') : '-' %></td>
<td class="flags-cell">
<% _.each(relay.get('flags'), function(flag) { %><img class="tip flags" src="img/flags/<%= flag[1] %>.png" alt="<%= flag[0] %>" title="<%= flag[0] %><br /><%= flag[2] %>"/><% }); %>
</td>
More information about the tor-commits
mailing list