]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Add a type and version header to the fallback directory mirror file
authorteor <teor2345@gmail.com>
Sun, 24 Dec 2017 00:36:45 +0000 (11:36 +1100)
committerteor <teor2345@gmail.com>
Fri, 5 Jan 2018 02:26:44 +0000 (13:26 +1100)
This helps external parsers like stem and Relay Search.

Implements ticket 24725.

changes/ticket24725 [new file with mode: 0644]
scripts/maint/updateFallbackDirs.py

diff --git a/changes/ticket24725 b/changes/ticket24725
new file mode 100644 (file)
index 0000000..2fe1848
--- /dev/null
@@ -0,0 +1,4 @@
+  o Minor features (fallback directory mirrors):
+    - Add a type and version header to the fallback directory mirror file.
+      This helps external parsers like stem and Relay Search.
+      Implements ticket 24725.
index cf96fc308fbb233c36b3e1bef0078e5d80603a25..7869d942c1ff065bcef3fdde9ec4ff53fda58229 100755 (executable)
@@ -68,6 +68,15 @@ except ImportError:
 
 ## Top-Level Configuration
 
+# We use semantic versioning: https://semver.org
+# In particular:
+# * major changes include removing a mandatory field, or anything else that
+#   would break an appropriately tolerant parser,
+# * minor changes include adding a field,
+# * patch changes include changing header comments or other unstructured
+#   content
+FALLBACK_FORMAT_VERSION = '2.0.0'
+
 # Output all candidate fallbacks, or only output selected fallbacks?
 OUTPUT_CANDIDATES = False
 
@@ -2124,6 +2133,9 @@ def list_fallbacks(whitelist, blacklist):
   """ Fetches required onionoo documents and evaluates the
       fallback directory criteria for each of the relays """
 
+  print "/* type=fallback */"
+  print ("/* version={} */"
+         .format(cleanse_c_multiline_comment(FALLBACK_FORMAT_VERSION)))
   logging.warning('Downloading and parsing Onionoo data. ' +
                   'This may take some time.')
   # find relays that could be fallbacks