[tor-commits] [depictor/master] Revert to getting fallback dirs from stem (and include the table in the website)

tom at torproject.org tom at torproject.org
Sun Oct 16 21:57:20 UTC 2016


commit a7583a42c0103af34a2ea46395bd2a0a6c7ec960
Author: Tom Ritter <tom at ritter.vg>
Date:   Sun Oct 16 17:56:23 2016 -0400

    Revert to getting fallback dirs from stem (and include the table in the website)
---
 website.py       |  3 +--
 write_website.py | 41 ++---------------------------------------
 2 files changed, 3 insertions(+), 41 deletions(-)

diff --git a/website.py b/website.py
index a634c16..ba16c32 100755
--- a/website.py
+++ b/website.py
@@ -34,6 +34,7 @@ class WebsiteWriter:
 		self._write_consensus_parameters()
 		self._write_authority_keys()
 		self._write_bandwidth_scanner_status(True)
+		self._write_fallback_directory_status(True)
 		self._write_authority_versions()
 		self._write_download_statistics()
 		self._write_relay_info_summary()
@@ -1015,8 +1016,6 @@ class WebsiteWriter:
 			if relay_fp in self.fallback_dirs:
 				self.site.write(" <br />" if flagsWritten > 0 else "")
 				self.site.write("FallbackDir")
-				if 'disappeared_version' in self.fallback_dirs[relay_fp]:
-					self.site.write('(<' + self.fallback_dirs[relay_fp]['disappeared_version'] + ')')
 				flagsWritten += 1
 
 			self.site.write("</td>\n")
diff --git a/write_website.py b/write_website.py
index 2cf5de3..d76d242 100755
--- a/write_website.py
+++ b/write_website.py
@@ -64,45 +64,8 @@ def main():
 	f.close()
 
 	# Calculate the fallback directory info
-	import re
-	import urllib
-
-	GITWEB_FALLBACK_DIR_URL = 'https://gitweb.torproject.org/tor.git/plain/src/or/fallback_dirs.inc'
-	fallback_lines = urllib.urlopen(GITWEB_FALLBACK_DIR_URL).read()
-
-	fallback_dirs, attr = {}, {}
-	for line in fallback_lines.splitlines():
-		if line.startswith('"') or line.startswith('/*') or line.startswith(' *'):
-			if line.startswith('"'):
-				info_line_match = False
-				addr_line_match = re.match('"([\d\.]+):(\d+) orport=(\d+) id=([\dA-F]{40}).*', line)
-				ipv6_line_match = re.match('" ipv6=\[([\da-f:]+)\]:(\d+)"', line)
-			else:
-				info_line_match = re.match('\/\* Fallback was on (.+) list, but (.*) before (.+)', line)
-				addr_line_match = re.match(' * "([\d\.]+):(\d+) orport=(\d+) id=([\dA-F]{40}).*', line)
-				ipv6_line_match = re.match(' * " ipv6=\[([\da-f:]+)\]:(\d+)"', line)
-
-			if info_line_match:
-				appeared_version, removed_reason, disappeared_version = info_line_match.groups()	
-
-				attr['appeared_version'] = appeared_version
-				attr['removed_reason'] = removed_reason
-				attr['disappeared_version'] = disappeared_version
-			elif addr_line_match:
-				address, dir_port, or_port, fingerprint = addr_line_match.groups()
-
-				attr['address'] = address
-				attr['or_port'] = int(or_port)
-				attr['dir_port'] = int(dir_port)
-				attr['fingerprint'] = fingerprint
-			elif ipv6_line_match:
-				address, port = ipv6_line_match.groups()
-
-				attr['orport_v6'] = (address, int(port))
-			elif '" weight=' in line and 'fingerprint' in attr:
-				fallback_dirs[attr.get('fingerprint')] = attr
-
-				attr = {}
+	from stem.descriptor.remote import FallbackDirectory
+	fallback_dirs = stem.descriptor.remote.FallbackDirectory.from_remote()
 	# great for debugging
 	#import pickle
 	#pickle.dump(fallback_dirs, open('fallback_dirs.p', 'wb'))



More information about the tor-commits mailing list