[tor-commits] [depictor] 01/02: Update dirauth data

gitolite role git at cupani.torproject.org
Wed Dec 7 16:20:12 UTC 2022


This is an automated email from the git hooks/post-receive script.

tom pushed a commit to branch master
in repository depictor.

commit 132572cbf06f8efdb508467d0209a735ebfc467b
Author: Tom Ritter <tom at ritter.vg>
AuthorDate: Wed Dec 7 10:04:38 2022 -0500

    Update dirauth data
    
    Closes issue #18
---
 ...-63a476056017dda5ede35efc4e4f7acfcc1d7d1a.patch | 47 ++++++++++++++++++++++
 utility.py                                         | 11 ++++-
 2 files changed, 56 insertions(+), 2 deletions(-)

diff --git a/stem-63a476056017dda5ede35efc4e4f7acfcc1d7d1a.patch b/stem-63a476056017dda5ede35efc4e4f7acfcc1d7d1a.patch
new file mode 100644
index 0000000..f12f841
--- /dev/null
+++ b/stem-63a476056017dda5ede35efc4e4f7acfcc1d7d1a.patch
@@ -0,0 +1,47 @@
+diff --git a/stem/directory.py b/stem/directory.py
+index 710e598e..d61ef3d8 100644
+--- a/stem/directory.py
++++ b/stem/directory.py
+@@ -63,7 +63,7 @@ AUTHORITY_ADDR = re.compile('"([\\d\\.]+):(\\d+) ([\\dA-F ]{49})",')
+ FALLBACK_DIV = '/* ===== */'
+ FALLBACK_MAPPING = re.compile('/\\*\\s+(\\S+)=(\\S*)\\s+\\*/')
+ 
+-FALLBACK_ADDR = re.compile('"([\\d\\.]+):(\\d+) orport=(\\d+) id=([\\dA-F]{40}).*')
++FALLBACK_ADDR = re.compile('"([\\d\\.]+) orport=(\\d+) id=([\\dA-F]{40}).*')
+ FALLBACK_NICKNAME = re.compile('/\\* nickname=(\\S+) \\*/')
+ FALLBACK_EXTRAINFO = re.compile('/\\* extrainfo=([0-1]) \\*/')
+ FALLBACK_IPV6 = re.compile('" ipv6=\\[([\\da-f:]+)\\]:(\\d+)"')
+@@ -141,7 +141,7 @@ class Directory(object):
+       raise ValueError('%s has an invalid IPv4 address: %s' % (identifier, address))
+     elif not connection.is_valid_port(or_port):
+       raise ValueError('%s has an invalid ORPort: %s' % (identifier, or_port))
+-    elif not connection.is_valid_port(dir_port):
++    elif not connection.is_valid_port(dir_port, True):
+       raise ValueError('%s has an invalid DirPort: %s' % (identifier, dir_port))
+     elif not tor_tools.is_valid_fingerprint(fingerprint):
+       raise ValueError('%s has an invalid fingerprint: %s' % (identifier, fingerprint))
+@@ -418,7 +418,8 @@ class Fallback(Directory):
+       if mapping:
+         header[mapping.group(1)] = mapping.group(2)
+       else:
+-        raise OSError('Malformed fallback directory header line: %s' % line)
++        # Ignore unknown lines so the file can evolve without breaking this.
++        continue
+ 
+     Fallback._pop_section(lines)  # skip human readable comments
+ 
+@@ -433,12 +434,12 @@ class Fallback(Directory):
+       results = {}
+ 
+       for matches in _directory_entries(lines, Fallback._pop_section, (FALLBACK_ADDR, FALLBACK_NICKNAME, FALLBACK_EXTRAINFO, FALLBACK_IPV6), required = (FALLBACK_ADDR,)):
+-        address, dir_port, or_port, fingerprint = matches[FALLBACK_ADDR]  # type: ignore
++        address, or_port, fingerprint = matches[FALLBACK_ADDR]  # type: ignore
+ 
+         results[fingerprint] = Fallback(
+           address = address,
+           or_port = int(or_port),
+-          dir_port = int(dir_port),
++          dir_port = 0,
+           fingerprint = fingerprint,
+           nickname = matches.get(FALLBACK_NICKNAME),  # type: ignore
+           has_extrainfo = matches.get(FALLBACK_EXTRAINFO) == '1',
diff --git a/utility.py b/utility.py
index 58b1451..4395234 100755
--- a/utility.py
+++ b/utility.py
@@ -21,7 +21,14 @@ def get_dirauths():
 	if _dirAuths == None:
 		#Remove any BridgeAuths
 		_dirAuths = dict((k.lower(), v) for (k, v) in stem.directory.Authority.from_cache().items() if v.v3ident)
-		_dirAuths['moria1'].address = "128.31.0.34"
+		# Update IP addresses and other information that has changed since stem cut a release
+		del _dirAuths['faravahar']
+		_dirAuths['moria1'].address = "128.31.0.24"
+		_dirAuths['moria1'].or_port = 9201
+		_dirAuths['moria1'].dir_port = 9231
+		_dirAuths['moria1'].v3ident = "F533C81CEF0BC0267857C99B2F471ADF249FA232"
+		_dirAuths['moria1'].fingerprint = "1A25C6358DB91342AA51720A5038B72742732498"
+		_dirAuths['dizum'].address = "45.66.35.11"
 	return _dirAuths
 
 _bwAuths = None
@@ -29,7 +36,7 @@ def get_bwauths():
 	global config
 	global _bwAuths
 	if _bwAuths == None:
-		_bwAuths = dict((k.lower(), v) for (k, v) in stem.directory.Authority.from_cache().items() if v.nickname.lower() in config['bwauths'])
+		_bwAuths = dict((k.lower(), v) for (k, v) in get_dirauths().items() if v.nickname.lower() in config['bwauths'])
 	return _bwAuths
 
 # How to grab a vote or consensus with stem:

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the tor-commits mailing list