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

[tor-commits] [atlas/master] Flags fallback directory mirrors with an additional flag (Fixes: #21619)



commit 0d0871c01511468c7f9093163cdce1cffb55c51b
Author: Iain R. Learmonth <irl@xxxxxxxx>
Date:   Tue Nov 21 22:07:54 2017 +0000

    Flags fallback directory mirrors with an additional flag (Fixes: #21619)
---
 .../fallbackdir_16x16.png}                         | Bin
 js/fallback_dir.js                                 |  16 +++++++++++
 js/main.js                                         |   3 +-
 js/models/relay.js                                 |   4 ++-
 scripts/fallback_dir.py                            |  31 +++++++++++++++++++++
 templates/details/router.html                      |   8 ++++++
 templates/search/do.html                           |   3 ++
 7 files changed, 63 insertions(+), 2 deletions(-)

diff --git a/img/flags/loop_16x16.png b/img/properties/fallbackdir_16x16.png
similarity index 100%
rename from img/flags/loop_16x16.png
rename to img/properties/fallbackdir_16x16.png
diff --git a/js/fallback_dir.js b/js/fallback_dir.js
new file mode 100644
index 0000000..09b170b
--- /dev/null
+++ b/js/fallback_dir.js
@@ -0,0 +1,16 @@
+
+
+/*
+This file is generated by scripts/fallback_dir.py.
+
+To update run:
+
+python3 scripts/fallback_dir.py > js/fallback_dir.js
+*/
+
+var fallbackDirs = ["0111BA9B604669E636FFD5B503F382A4B7AD6E80", "01A9258A46E97FF8B2CAC7910577862C14F2C524", "025B66CEBC070FCB0519D206CF0CF4965C20C96E", "04250C3835019B26AA6764E85D836088BE441088", "0756B7CD4DFC8182BE23143FAC0642F515182CEB", "0818DAE0E2DDF795AEDEAC60B15E71901084F281", "0B85617241252517E8ECF2CFC7F4C1A32DCD153F", "0BEA4A88D069753218EAAAD6D22EA87B9A1319D6", "0D3EBA17E1C78F1E9900BABDB23861D46FCAF163", "0E8C0C8315B66DB5F703804B3889A1DD66C67CE0", "1211AC1BBB8A1AF7CBA86BCE8689AA3146B86423", "12AD30E5D25AA67F519780E2111E611A455FDC89", "12FD624EE73CEF37137C90D38B2406A66F68FAA2", "136F9299A5009A4E0E96494E723BDB556FB0A26B", "14419131033443AE6E21DA82B0D307F7CAE42BDB", "175921396C7C426309AB03775A9930B6F611F794", "185F2A57B0C4620582602761097D17DB81654F70", "1AF72E8906E6C49481A791A6F8F84F8DFEBBB2BA", "1DBAED235E3957DE1ABD25B4206BE71406FB61F8", "1ECD73B936CB6E6B3CD647CC204F108D9DF2C9F7", "20462CBA5DA4C2D963567D17D0B7249718114A68", "22F08CF09764C4E8982640D77F71ED72FF26A9AC", "230A8B2A
 8BA861210D9B4BA97745AEC217A94207", "231C2B9C8C31C295C472D031E06964834B745996", "2A4C448784F5A83AFE6C78DA357D5E31F7989DEB", "2BA2C8E96B2590E1072AECE2BDB5C48921BF8510", "2F0F32AB1E5B943CA7D062C03F18960C86E70D94", "30973217E70AF00EBE51797FF6D9AA720A902EAA", "30C19B81981F450C402306E2E7CFB6C3F79CB6B2", "322C6E3A973BC10FC36DE3037AD27BC89F14723B", "32EE911D968BE3E016ECA572BB1ED0A9EE43FC2F", "33DA0CAB7C27812EFF2E22C9705630A54D101FEB", "361D33C96D0F161275EE67E2C91EE10B276E778B", "36B9E7AC1E36B62A9D6F330ABEB6012BA7F0D400", "387B065A38E4DAA16D9D41C2964ECBC4B31D30FF", "39F096961ED2576975C866D450373A9913AFDC92", "3B33F6FCA645AD4E91428A3AF7DC736AD9FB727B", "3D6D0771E54056AEFC28BB1DE816951F11826E97", "3D7E274A87D9A89AF064C13D1EE4CA1F184F2600", "3E53D3979DB07EFD736661C934A1DED14127B684", "439D0447772CB107B886F7782DBC201FA26B92D1", "4623A9EC53BFD83155929E56D6F7B55B5E718C24", "46791D156C9B6C255C2665D4D8393EC7DBAA7798", "4791FC0692EAB60DF2BCCAFF940B95B74E7654F6", "47B596B81C9E6277B98623A84B7629798A16E
 8D5", "489D94333DF66D57FFE34D9D59CC2D97E2CB0053", "49E7AD01BB96F6FE3AB8C3B15BD2470B150354DF", "4A0C3E177AF684581EF780981AEAF51A98A6B5CF", "4CC9CC9195EC38645B699A33307058624F660CCF", "51E1CF613FD6F9F11FE24743C91D6F9981807D82", "5665A3904C89E22E971305EE8C1997BCA4123C69", "587E0A9552E4274B251F29B5B2673D38442EE4BF", "58ED9C9C35E433EE58764D62892B4FFD518A3CD0", "5A5E03355C1908EBF424CAF1F3ED70782C0D2F74", "5E853C94AB1F655E9C908924370A0A6707508C62", "5EB8D862E70981B8690DEDEF546789E26AB2BD24", "616081EC829593AF4232550DE6FFAA1D75B37A90", "68F175CCABE727AA2D2309BCD8789499CEE36ED7", "6A7551EEE18F78A9813096E82BF84F740D32B911", "6EF897645B79B6CB35E853B32506375014DE3621", "7187CED1A3871F837D0E60AC98F374AC541CB0DA", "722D365140C8C52DBB3C9FF6986E3CEFFE2BA812", "72B2B12A3F60408BDBC98C6DF53988D3A0B3F0EE", "7350AB9ED7568F22745198359373C04AC783C37C", "763C9556602BD6207771A7A3D958091D44C43228", "774555642FDC1E1D4FDF2E0C31B7CA9501C5C9C7", "789EA6C9AE9ADDD8760903171CFA9AC5741B0C70", "79861CF8522FC637EF046F
 7688F5289E49D94576", "7A32C9519D80CA458FC8B034A28F5F6815649A98", "7BB70F8585DFC27E75D692970C0EEB0F22983A63", "80AAF8D5956A43C197104CEF2550CD42D165C6FB", "823AA81E277F366505545522CEDC2F529CE4DC3F", "844AE9CAD04325E955E2BE1521563B79FE7094B7", "8672E8A01B4D3FA4C0BBE21C740D4506302EA487", "8844D87E9B038BE3270938F05AF797E1D3C74C0F", "892F941915F6A0C6E0958E52E0A9685C190CF45C", "8C00FA7369A7A308F6A137600F0FA07990D9D451", "8FA37B93397015B2BC5A525C908485260BE9F422", "9007C1D8E4F03D506A4A011B907A9E8D04E3C605", "91E4015E1F82DAF0121D62267E54A1F661AB6DC7", "9231DF741915AA1630031A93026D88726877E93A", "92CFD9565B24646CAC2D172D3DB503D69E777B8A", "92ECC9E0E2AF81BB954719B189AC362E254AD4A5", "94C4B7B8C50C86A92B6A20107539EE2678CF9A28", "998BF3ED7F70E33D1C307247B9626D9E7573C438", "99E246DB480B313A3012BC3363093CC26CD209C7", "9A0D54D3A6D2E0767596BF1515E6162A75B3293F", "9A68B85A02318F4E7E87F2828039FBD5D75B0142", "9B31F1F1C1554F9FFB3455911F82E818EF7C7883", "9BF04559224F0F1C3C953D641F1744AF0192543A", "9C900A7
 F6F5DD034CFFD192DAEC9CCAA813DB022", "9F5068310818ED7C70B0BC4087AB55CB12CB4377", "9F7D6E6420183C2B76D3CE99624EBC98A21A967E", "9FBEB75E8BC142565F12CBBE078D63310236A334", "A0766C0D3A667A3232C7D569DE94A28F9922FCB1", "A10C4F666D27364036B562823E5830BC448E046A", "A478E421F83194C114F41E94F95999672AED51FE", "A9406A006D6E7B5DA30F2C6D4E42A338B5E340B2", "ABCB4965F1FEE193602B50A365425105C889D3F8", "ABF7FBF389C9A747938B639B20E80620B460B2A9", "ACD889D86E02EDDAB1AFD81F598C0936238DC6D0", "ACDD9E85A05B127BA010466C13C8C47212E8A38F", "AD253B49E303C6AB1E048B014392AC569E8A7DAE", "ADB2C26629643DBB9F8FE0096E7D16F9414B4F8D", "AEA43CB1E47BE5F8051711B2BF01683DB1568E05", "AF322D83A4D2048B22F7F1AF5F38AFF4D09D0B76", "B0553175AADB0501E5A61FC61CEA3970BE130FF2", "B143D439B72D239A419F8DCE07B8A8EB1B486FA7", "B1D81825CFD7209BD1B4520B040EF5653C204A23", "B291D30517D23299AD7CEE3E60DFE60D0E3A4664", "B44FBE5366AD98B46D829754FA4AC599BAE41A6A", "B5212DB685A2A0FCFBAE425738E478D12361710D", "B6904ADD4C0D10CDA7179E051962350A69A6
 3243", "B83DC1558F0D34353BB992EF93AFEAFDB226A73E", "B84F248233FEA90CAD439F292556A3139F6E1B82", "BC7ACFAC04854C77167C7D66B7E471314ED8C410", "BCEDF6C193AA687AE471B8A22EBF6BC57C2D285E", "BCEF908195805E03E92CCFE669C48738E556B9C5", "C13B91384CDD52A871E3ECECE4EF74A7AC7DCB08", "C37BC191AC389179674578C3E6944E925FE186C2", "C414F28FD2BEC1553024299B31D4E726BEB8E788", "C793AB88565DDD3C9E4C6F15CCB9D8C7EF964CE9", "CBEFF7BA4A4062045133C053F2D70524D8BBE5BE", "D1B8AAA98C65F3DF7D8BB3AF881CAEB84A33D8EE", "D3E5EDDBE5159388704D6785BE51930AAFACEC6F", "D5039E1EBFD96D9A3F9846BF99EC9F75EDDE902A", "D5C33F3E203728EDF8361EA868B2939CCC43FAFB", "D62FB817B0288085FAC38A6DC8B36DCD85B70260", "D760C5B436E42F93D77EF2D969157EEA14F9B39C", "D9065F9E57899B3D272AA212317AF61A9B14D204", "DAA39FC00B196B353C2A271459C305C429AF09E4", "DD823AFB415380A802DCAEB9461AE637604107FB", "DD85503F2D1F52EF9EAD621E942298F46CD2FC10", "DDD7871C1B7FA32CB55061E08869A236E61BDDF8", "DEB73705B2929AE9BE87091607388939332EF123", "DED6892FF89DBD737BA68
 9698A171B2392EB3E82", "E3DB2E354B883B59E8DC56B3E7A353DDFD457812", "E589316576A399C511A9781A73DA4545640B479D", "E65D300F11E1DB12C534B0146BDAB6972F1A8A48", "EBE718E1A49EE229071702964F8DB1F318075FF8", "ED2338CAC2711B3E331392E1ED2831219B794024", "F10BDE279AE71515DDCCCC61DC19AC8765F8A3CC", "F406219CDD339026D160E53FCA0EF6857C70F109", "F69BED36177ED727706512BA6A97755025EEA0FB", "F8D27B163B9247B232A2EEE68DD8B698695C28DE", "F9246DEF2B653807236DA134F2AEAB103D58ABFE", "F93D8F37E35C390BCAD9F9069E13085B745EC216", "FC9AC8EA0160D88BCCFDE066940D7DD9FA45495B", "FD1871854BFC06D7B02F10742073069F0528B5CC", "FE296180018833AF03A8EACD5894A614623D3F76", "FFA72BD683BC2FCF988356E6BEC1E490F313FB07"];
+
+function IsFallbackDir(fingerprint) {
+  return $.inArray(fingerprint, fallbackDirs) > -1;
+}
+
diff --git a/js/main.js b/js/main.js
index 3b5a105..6c4984e 100644
--- a/js/main.js
+++ b/js/main.js
@@ -16,7 +16,8 @@ require.config({
     datatablesbs: 'libs/datatables/dataTables.bootstrap',
     d3js: 'libs/d3js/d3.v3.min',
     jssha: 'libs/jssha/sha1',
-    templates: '../templates'
+    templates: '../templates',
+    fallbackdir: 'fallback_dir'
   }
 
 });
diff --git a/js/models/relay.js b/js/models/relay.js
index 8b09d88..9540ac9 100644
--- a/js/models/relay.js
+++ b/js/models/relay.js
@@ -3,7 +3,8 @@ define([
   'jquery',
   'underscore',
   'backbone',
-  'helpers'
+  'helpers',
+  'fallbackdir'
 ], function($, _, Backbone){
 
 	var relayModel = Backbone.Model.extend({
@@ -159,6 +160,7 @@ define([
                     relay.platform = relay.platform ? relay.platform : null;
                     relay.recommended_version = (typeof relay.recommended_version !== 'undefined') ? relay.recommended_version : null;
                     relay.measured = (typeof relay.measured !== 'undefined') ? relay.measured : null;
+                    relay.fallback_dir = IsFallbackDir(relay.fingerprint);
                     relay.nickname = relay.nickname ? relay.nickname : "Unnamed";
                     relay.dir_address = relay.dir_address ? relay.dir_address : null;
                     relay.exit_policy = relay.exit_policy ? relay.exit_policy : null;
diff --git a/scripts/fallback_dir.py b/scripts/fallback_dir.py
new file mode 100644
index 0000000..76628da
--- /dev/null
+++ b/scripts/fallback_dir.py
@@ -0,0 +1,31 @@
+import json
+import re
+import urllib.request
+
+response = urllib.request.urlopen("https://gitweb.torproject.org/tor.git/plain/src/or/fallback_dirs.inc";)
+lines = [x.decode("ascii") for x in response.readlines()]
+
+fingerprints = []
+for line in lines:
+    if line.startswith("\""):
+        m = re.search('(?<=id=)\w+', line)
+        if m:
+            fingerprints.append(m.group(0))
+
+print("""
+
+/*
+This file is generated by scripts/fallback_dir.py.
+
+To update run:
+
+python3 scripts/fallback_dir.py > js/fallback_dir.js
+*/
+
+var fallbackDirs = %s;
+
+function IsFallbackDir(fingerprint) {
+  return $.inArray(fingerprint, fallbackDirs) > -1;
+}
+""" % (json.dumps(fingerprints)))
+
diff --git a/templates/details/router.html b/templates/details/router.html
index c193388..e2a4065 100644
--- a/templates/details/router.html
+++ b/templates/details/router.html
@@ -128,6 +128,14 @@
             <span class="inline">Unmeasured</span>
         </span>
     <% } %>
+    <% if (relay.get('fallback_dir') === true) {
+        propertyCount++;
+        %>
+        <span class="tip flags" title="Tor clients contact fallback directory mirrors during bootstrap, and download the consensus and authority certificates from them. We include a default list of mirrors in the Tor source code. These default mirrors need to be long-term stable, and on the same IPv4 and IPv6 addresses and ports.">
+            <img class="inline" alt="" src="img/properties/fallbackdir_16x16.png"/>
+            <span class="inline">FallbackDir</span>
+        </span>
+    <% } %>
     <%=propertyCount==0?'none':''%>
     </dd>
 
diff --git a/templates/search/do.html b/templates/search/do.html
index 31771b5..f98dd54 100644
--- a/templates/search/do.html
+++ b/templates/search/do.html
@@ -112,6 +112,9 @@
            <% if (relay.get('measured') === false) { %>
                 <img class="tip" src="img/properties/unmeasured_16x16.png" alt="Unmeasured" title="Unmeasured<br />This relay has not been measured by at least 3 bandwidth authorities and so its consensus weight is currently capped. This is expected for new relays.">
           <% } %>
+           <% if (relay.get('fallback_dir') === true) { %>
+                <img class="tip" src="img/properties/fallbackdir_16x16.png" alt="Unmeasured" title="FallbackDir<br />Tor clients contact fallback directory mirrors during bootstrap, and download the consensus and authority certificates from them. We include a default list of mirrors in the Tor source code. These default mirrors need to be long-term stable, and on the same IPv4 and IPv6 addresses and ports.">
+          <% } %>
             </td>
 			<td><%= relay.get('or_port') %></td>
 			<td><%= relay.get('dir_port') %></td>



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