[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [metrics-web/release] Fix unknown AS in aggregations



commit f7ce13e4f37cbf5540fe00e672bedd2b4906364f
Author: Iain R. Learmonth <irl@xxxxxxxx>
Date:   Fri Jul 6 11:17:58 2018 +0100

    Fix unknown AS in aggregations
    
    AS numbers are strings when returned from Onionoo.
    
    "AS0" is used instead of the integer 0 as the placeholder for unknown
    autonomous systems.
    
    Fixes: #26518
---
 src/main/resources/web/js/rs/collections/aggregates.js | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/main/resources/web/js/rs/collections/aggregates.js b/src/main/resources/web/js/rs/collections/aggregates.js
index 9ddce23..dbf65ea 100644
--- a/src/main/resources/web/js/rs/collections/aggregates.js
+++ b/src/main/resources/web/js/rs/collections/aggregates.js
@@ -30,8 +30,8 @@ define([
              This code will never be assigned for use with ISO 3166-1 and is "user-assigned".
              Fun fact: UN/LOCODE assigns XZ to represent installations in international waters. */
           relay.country = ((typeof relay.country) == "undefined") ? "xz" : relay.country;
-          relay.as_number = ((typeof relay.as_number) == "undefined") ? 0 : relay.as_number;
-          if (relay.as_number == 0) relay.as_name = "Unknown";
+          relay.as_number = ((typeof relay.as_number) == "undefined") ? "AS0" : relay.as_number;
+          if (relay.as_number == "AS0") relay.as_name = "Unknown";
 
           var ccAggregate = false;
           var asAggregate = false;
@@ -75,7 +75,7 @@ define([
             if (relay.country !== "xz") aggregates[aggregateKey].country.add(relay.country);
           }
           if (!asAggregate) {
-            if (relay.as_number !== 0) aggregates[aggregateKey].as.add(relay.as_number);
+            if (relay.as_number !== "AS0") aggregates[aggregateKey].as.add(relay.as_number);
           }
           aggregates[aggregateKey].relays++;
           if ((typeof relay.guard_probability) !== "undefined") aggregates[aggregateKey].guard_probability += relay.guard_probability;



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits