diff options
author | teor <teor2345@gmail.com> | 2017-12-24 11:36:45 +1100 |
---|---|---|
committer | teor <teor2345@gmail.com> | 2018-01-05 13:26:44 +1100 |
commit | 8d226a2c7b78dc1db998cb6ba075c0170b7cc521 (patch) | |
tree | f57c4238c39746d644fe46552a174c4d1b709c54 | |
parent | e3a2324083e370069a0caea1d07f7c58dc11c7af (diff) | |
download | tor-8d226a2c7b78dc1db998cb6ba075c0170b7cc521.tar.gz tor-8d226a2c7b78dc1db998cb6ba075c0170b7cc521.zip |
Add a type and version header to the fallback directory mirror file
This helps external parsers like stem and Relay Search.
Implements ticket 24725.
-rw-r--r-- | changes/ticket24725 | 4 | ||||
-rwxr-xr-x | scripts/maint/updateFallbackDirs.py | 12 |
2 files changed, 16 insertions, 0 deletions
diff --git a/changes/ticket24725 b/changes/ticket24725 new file mode 100644 index 0000000000..2fe1848ab4 --- /dev/null +++ b/changes/ticket24725 @@ -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. diff --git a/scripts/maint/updateFallbackDirs.py b/scripts/maint/updateFallbackDirs.py index cf96fc308f..7869d942c1 100755 --- a/scripts/maint/updateFallbackDirs.py +++ b/scripts/maint/updateFallbackDirs.py @@ -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 |