[tor-commits] [metrics-web/master] Adds ant task to update fallback directories in RS

karsten at torproject.org karsten at torproject.org
Mon Mar 9 10:29:38 UTC 2020


commit 1bef5acf3b2e0371da155203068e0d4b342dcada
Author: Iain R. Learmonth <irl at fsfe.org>
Date:   Thu Feb 27 11:27:11 2020 +0000

    Adds ant task to update fallback directories in RS
---
 build.xml                                    |  8 +++++++
 src/main/python/fallback_dir.py              | 31 ++++++++++++++++++++++++++++
 src/main/resources/web/js/rs/fallback_dir.js |  4 ++--
 3 files changed, 41 insertions(+), 2 deletions(-)

diff --git a/build.xml b/build.xml
index aef5f1b..bdb99a5 100644
--- a/build.xml
+++ b/build.xml
@@ -322,6 +322,14 @@
     </untar>
   </target>
 
+  <target name="update-fallback-dir-list"
+          description="Update the fallback directory list used by Relay Search">
+    <exec executable="bash">
+      <arg value="-c"/>
+      <arg value="python3 src/main/python/fallback_dir.py | tee src/main/resources/web/js/rs/fallback_dir.js"/>
+    </exec>
+  </target>
+
   <!-- The following line adds the common targets and properties
        for Metrics' Java Projects.
   -->
diff --git a/src/main/python/fallback_dir.py b/src/main/python/fallback_dir.py
new file mode 100644
index 0000000..a6721cf
--- /dev/null
+++ b/src/main/python/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/app/config/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 src/main/python/fallback_dir.py.
+
+To update run:
+
+ant update-fallback-dir-list
+*/
+
+var fallbackDirs = %s;
+
+function IsFallbackDir(fingerprint) {
+  return $.inArray(fingerprint, fallbackDirs) > -1;
+}
+""" % (json.dumps(fingerprints)))
+
diff --git a/src/main/resources/web/js/rs/fallback_dir.js b/src/main/resources/web/js/rs/fallback_dir.js
index 0f8eda9..ade34c5 100644
--- a/src/main/resources/web/js/rs/fallback_dir.js
+++ b/src/main/resources/web/js/rs/fallback_dir.js
@@ -1,11 +1,11 @@
 
 
 /*
-This file is generated by scripts/fallback_dir.py.
+This file is generated by src/main/python/fallback_dir.py.
 
 To update run:
 
-python3 scripts/fallback_dir.py > js/fallback_dir.js
+ant update-fallback-dir-list
 */
 
 var fallbackDirs = ["001524DD403D729F08F7E5D77813EF12756CFA8D", "025B66CEBC070FCB0519D206CF0CF4965C20C96E", "0338F9F55111FE8E3570E7DE117EF3AF999CC1D7", "0B85617241252517E8ECF2CFC7F4C1A32DCD153F", "0C039F35C2E40DCB71CD8A07E97C7FD7787D42D6", "113143469021882C3A4B82F084F8125B08EE471E", "11DF0017A43AF1F08825CD5D973297F81AB00FF3", "1211AC1BBB8A1AF7CBA86BCE8689AA3146B86423", "12AD30E5D25AA67F519780E2111E611A455FDC89", "12FD624EE73CEF37137C90D38B2406A66F68FAA2", "183005F78229D94EE51CE7795A42280070A48D0D", "185663B7C12777F052B2C2D23D7A239D8DA88A0F", "1938EBACBB1A7BFA888D9623C90061130E63BB3F", "1AE039EE0B11DB79E4B4B29CBA9F752864A0259E", "1CD17CB202063C51C7DAD3BACEF87ECE81C2350F", "1F6ABD086F40B890A33C93CC4606EE68B31C9556", "20462CBA5DA4C2D963567D17D0B7249718114A68", "204DFD2A2C6A0DC1FA0EACB495218E0B661704FD", "230A8B2A8BA861210D9B4BA97745AEC217A94207", "2F0F32AB1E5B943CA7D062C03F18960C86E70D94", "322C6E3A973BC10FC36DE3037AD27BC89F14723B", "32EE911D968BE3E016ECA572BB1ED0A9EE43FC2F", "330CD3DB
 6AD266DC70CDB512B036957D03D9BC59", "361D33C96D0F161275EE67E2C91EE10B276E778B", "375DCBB2DBD94E5263BC0C015F0C9E756669617E", "39F91959416763AFD34DBEEC05474411B964B2DC", "3AFDAAD91A15B4C6A7686A53AA8627CA871FF491", "3CA0D15567024D2E0B557DC0CF3E962B37999A79", "3CB4193EF4E239FCEDC4DC43468E0B0D6B67ACC3", "3E53D3979DB07EFD736661C934A1DED14127B684", "3F092986E9B87D3FDA09B71FA3A602378285C77A", "4061C553CA88021B8302F0814365070AAE617270", "4623A9EC53BFD83155929E56D6F7B55B5E718C24", "465D17C6FC297E3857B5C6F152006A1E212944EA", "46791D156C9B6C255C2665D4D8393EC7DBAA7798", "484A10BA2B8D48A5F0216674C8DD50EF27BC32F3", "489D94333DF66D57FFE34D9D59CC2D97E2CB0053", "4EB55679FA91363B97372554F8DC7C63F4E5B101", "4F0DB7E687FC7C0AE55C8F243DA8B0EB27FBF1F2", "509EAB4C5D10C9A9A24B4EA0CE402C047A2D64E6", "51E1CF613FD6F9F11FE24743C91D6F9981807D82", "547DA56F6B88B6C596B3E3086803CDA4F0EF8F21", "557ACEC850F54EEE65839F83CACE2B0825BE811E", "5BF17163CBE73D8CD9FDBE030C944EA05707DA93", "5E56738E7F97AA81DEEF59AF28494293DFBFC
 CDF", "616081EC829593AF4232550DE6FFAA1D75B37A90", "68F175CCABE727AA2D2309BCD8789499CEE36ED7", "6A7551EEE18F78A9813096E82BF84F740D32B911", "6EF897645B79B6CB35E853B32506375014DE3621", "7088D485934E8A403B81531F8C90BDC75FA43C98", "70C55A114C0EF3DC5784A4FAEE64388434A3398F", "72B2B12A3F60408BDBC98C6DF53988D3A0B3F0EE", "742C45F2D9004AADE0077E528A4418A6A81BC2BA", "745369332749021C6FAF100D327BC3BF1DF4707B", "77131D7E2EC1CA9B8D737502256DA9103599CE51", "775B0FAFDE71AADC23FFC8782B7BEB1D5A92733E", "79509683AB4C8DDAF90A120C69A4179C6CD5A387", "7BB70F8585DFC27E75D692970C0EEB0F22983A63", "7BFB908A3AA5B491DA4CA72CCBEE0E1F2A939B55", "7E281CD2C315C4F7A84BC7C8721C3BC974DDBFA3", "80AAF8D5956A43C197104CEF2550CD42D165C6FB", "8101421BEFCCF4C271D5483C5AABCAAD245BBB9D", "81B75D534F91BFB7C57AB67DA10BCEF622582AE8", "823AA81E277F366505545522CEDC2F529CE4DC3F", "844AE9CAD04325E955E2BE1521563B79FE7094B7", "8456DFA94161CDD99E480C2A2992C366C6564410", "855BC2DABE24C861CD887DB9B2E950424B49FC34", "85A885433E50B1874F11CE
 C9BE98451E24660976", "86C281AD135058238D7A337D546C902BE8505DDE", "8C00FA7369A7A308F6A137600F0FA07990D9D451", "8D79F73DCD91FC4F5017422FAC70074D6DB8DD81", "8FA37B93397015B2BC5A525C908485260BE9F422", "90A5D1355C4B5840E950EB61E673863A6AE3ACA1", "91D23D8A539B83D2FB56AA67ECD4D75CC093AC55", "91E4015E1F82DAF0121D62267E54A1F661AB6DC7", "924B24AFA7F075D059E8EEB284CC400B33D3D036", "9288B75B5FF8861EFF32A6BE8825CC38A4F9F8C2", "935F589545B8A271A722E330445BB99F67DBB058", "94C4B7B8C50C86A92B6A20107539EE2678CF9A28", "9772EFB535397C942C3AB8804FB35CFFAD012438", "99E246DB480B313A3012BC3363093CC26CD209C7", "9B31F1F1C1554F9FFB3455911F82E818EF7C7883", "9B816A5B3EB20B8E4E9B9D1FBA299BD3F40F0320", "9C900A7F6F5DD034CFFD192DAEC9CCAA813DB022", "9EAD5B2D3DBD96DBC80DCE423B0C345E920A758D", "9F7D6E6420183C2B76D3CE99624EBC98A21A967E", "A0F06C2FADF88D3A39AA3072B406F09D7095AC9E", "A2E6BB5C391CD46B38C55B4329C35304540771F1", "A53C46F5B157DD83366D45A8E99A244934A14C46", "A86EC24F5B8B964F67AC7C27CE92842025983274", "A9406A0
 06D6E7B5DA30F2C6D4E42A338B5E340B2", "AC2BEDD0BAC72838EA7E6F113F856C4E8018ACDB", "ACDD9E85A05B127BA010466C13C8C47212E8A38F", "ADB2C26629643DBB9F8FE0096E7D16F9414B4F8D", "AEDAC7081AE14B8D241ECF0FF17A2858AB4383D0", "B0553175AADB0501E5A61FC61CEA3970BE130FF2", "B06F093A3D4DFAD3E923F4F28A74901BD4F74EB1", "B143D439B72D239A419F8DCE07B8A8EB1B486FA7", "B2197C23A4FF5D1C49EE45BA7688BA8BCCD89A0B", "B291D30517D23299AD7CEE3E60DFE60D0E3A4664", "B4CAFD9CBFB34EC5DAAC146920DC7DFAFE91EA20", "B5212DB685A2A0FCFBAE425738E478D12361710D", "B57A87009FA838471FB2227DDE68165AB2A2FCC4", "B83DC1558F0D34353BB992EF93AFEAFDB226A73E", "B84F248233FEA90CAD439F292556A3139F6E1B82", "B86137AE9681701901C6720E55C16805B46BD8E3", "BB60F5BA113A0B8B44B7B37DE3567FE561E92F78", "BCEDF6C193AA687AE471B8A22EBF6BC57C2D285E", "BCEF908195805E03E92CCFE669C48738E556B9C5", "BD552C165E2ED2887D3F1CCE9CFF155DDA2D86E6", "BF0FB582E37F738CD33C3651125F2772705BB8E8", "BF735F669481EE1CCC348F0731551C933D1E2278", "C0192FF43E777250084175F4E59AC1BA2290
 CE38", "C0C4F339046EB824999F711D178472FDF53BE7F5", "C2AAB088555850FC434E68943F551072042B85F1", "C36A434DB54C66E1A97A5653858CE36024352C4D", "C793AB88565DDD3C9E4C6F15CCB9D8C7EF964CE9", "C90CA3B7FE01A146B8268D56977DC4A2C024B9EA", "CBD0D1BD110EC52963082D839AC6A89D0AE243E7", "D15AFF44BE641368B958A32FB6B071AC2136B8B1", "D1AFBF3117B308B6D1A7AA762B1315FD86A6B8AF", "D379A1CB8285748FFF64AE94296CA89878F25B22", "D405FCCF06ADEDF898DF2F29C9348DCB623031BA", "D50101A2ABD09DC245F7E96C0818D003CDD62351", "D5039E1EBFD96D9A3F9846BF99EC9F75EDDE902A", "D8B7A3A6542AA54D0946B9DC0257C53B6C376679", "DAA39FC00B196B353C2A271459C305C429AF09E4", "DB2682153AC0CCAECD2BD1E9EBE99C6815807A1E", "DC163DDEF4B6F0C6BC226F9F6656A5A30C5C5686", "DD823AFB415380A802DCAEB9461AE637604107FB", "DD8BD7307017407FCC36F8D04A688F74A0774C02", "DED6892FF89DBD737BA689698A171B2392EB3E82", "E41B16F7DDF52EBB1DB4268AB2FE340B37AD8904", "E51620B90DCB310138ED89EDEDD0A5C361AAE24E", "E81EF60A73B3809F8964F73766B01BAA0A171E20", "E8D114B3C78D8E6E7FEB1
 004650DD632C2143C9E", "EBE718E1A49EE229071702964F8DB1F318075FF8", "ED2338CAC2711B3E331392E1ED2831219B794024", "EE4AF632058F0734C1426B1AD689F47445CA2056", "EFEACD781604EB80FBC025EDEDEA2D523AEAAA2F", "F10BDE279AE71515DDCCCC61DC19AC8765F8A3CC", "F4263275CF54A6836EE7BD527B1328836A6F06E1", "F4C0EDAA0BF0F7EC138746F8FEF1CE26C7860265", "F6A358DD367B3282D6EF5824C9D45E1A19C7E815", "F8D27B163B9247B232A2EEE68DD8B698695C28DE", "F93D8F37E35C390BCAD9F9069E13085B745EC216", "FE296180018833AF03A8EACD5894A614623D3F76", "FFA72BD683BC2FCF988356E6BEC1E490F313FB07"];



More information about the tor-commits mailing list