commit 9fa650f3e20508a366ce71333b96015c54d2d70d
Author: Damian Johnson <atagar(a)torproject.org>
Date: Sun Mar 6 16:15:53 2016 -0800
Key fallback directories on fingerprint
Internal detail, but in our config file we keyed fallback directories on their
nickname. This made the config more readable but is a no-go since nicknames are
non-unique. At present tor has two Unnamed fallback directories and as a result
we could only have information about one.
This is all internal details. Only impact for users is that we're no longer
missing one of the fallbacks.
---
cache_fallback_directories.py | 10 +-
stem/descriptor/fallback_directories.cfg | 254 ++++++++++++++++---------------
stem/descriptor/remote.py | 24 +--
3 files changed, 146 insertions(+), 142 deletions(-)
diff --git a/cache_fallback_directories.py b/cache_fallback_directories.py
index d6a58a9..138f767 100755
--- a/cache_fallback_directories.py
+++ b/cache_fallback_directories.py
@@ -55,10 +55,10 @@ if __name__ == '__main__':
conf.set('stem_commit', stem_commit)
for directory in latest_fallback_directories.values():
- nickname = directory.nickname
- conf.set('%s.address' % nickname, directory.address)
- conf.set('%s.or_port' % nickname, str(directory.or_port))
- conf.set('%s.dir_port' % nickname, str(directory.dir_port))
- conf.set('%s.fingerprint' % nickname, directory.fingerprint)
+ fingerprint = directory.fingerprint
+ conf.set('%s.address' % fingerprint, directory.address)
+ conf.set('%s.or_port' % fingerprint, str(directory.or_port))
+ conf.set('%s.dir_port' % fingerprint, str(directory.dir_port))
+ conf.set('%s.nickname' % fingerprint, directory.nickname)
conf.save(stem.descriptor.remote.CACHE_PATH)
diff --git a/stem/descriptor/fallback_directories.cfg b/stem/descriptor/fallback_directories.cfg
index faf6105..d420fb5 100644
--- a/stem/descriptor/fallback_directories.cfg
+++ b/stem/descriptor/fallback_directories.cfg
@@ -1,126 +1,130 @@
tor_commit e2202146d16af22502fd4166ac926fefa6528dff
-stem_commit 7fceffac0f988670f4fd6b5eb061b2ebeee9e560
-Doedel22.address 178.254.44.135
-Doedel22.or_port 9001
-Doedel22.dir_port 9030
-Doedel22.fingerprint 8FA37B93397015B2BC5A525C908485260BE9F422
-Logforme.address 84.219.173.60
-Logforme.or_port 443
-Logforme.dir_port 9030
-Logforme.fingerprint 855BC2DABE24C861CD887DB9B2E950424B49FC34
-Doedel21.address 178.254.44.135
-Doedel21.or_port 443
-Doedel21.dir_port 80
-Doedel21.fingerprint AE6A8C18E7499B586CD36246AC4BCAFFBBF93AB2
-kitten4.address 212.47.237.95
-kitten4.or_port 9101
-kitten4.dir_port 9130
-kitten4.fingerprint 6FB38EB22E57EF7ED5EF00238F6A48E553735D88
-kitten3.address 212.47.237.95
-kitten3.or_port 9001
-kitten3.dir_port 9030
-kitten3.fingerprint 3F5D8A879C58961BB45A3D26AC41B543B40236D6
-Unnamed.address 217.12.199.208
-Unnamed.or_port 443
-Unnamed.dir_port 80
-Unnamed.fingerprint DF3AED4322B1824BF5539AE54B2D1B38E080FF05
-coby.address 51.255.33.237
-coby.or_port 9001
-coby.dir_port 9091
-coby.fingerprint A360C21FA87FFA2046D92C17086A6B47E5C68109
-Binnacle.address 108.53.208.157
-Binnacle.or_port 443
-Binnacle.dir_port 80
-Binnacle.fingerprint 4F0DB7E687FC7C0AE55C8F243DA8B0EB27FBF1F2
-fluxe3.address 78.47.18.110
-fluxe3.or_port 80
-fluxe3.dir_port 443
-fluxe3.fingerprint F8D27B163B9247B232A2EEE68DD8B698695C28DE
-rueckgrat.address 5.9.110.236
-rueckgrat.or_port 9001
-rueckgrat.dir_port 9030
-rueckgrat.fingerprint 0756B7CD4DFC8182BE23143FAC0642F515182CEB
-Nurnberg01.address 213.239.210.204
-Nurnberg01.or_port 443
-Nurnberg01.dir_port 22
-Nurnberg01.fingerprint 5BFDECCE9B4A23AE14EC767C5A2C1E10558B00B9
-wagner.address 5.175.233.86
-wagner.or_port 443
-wagner.dir_port 80
-wagner.fingerprint 5525D0429BFE5DC4F1B0E9DE47A4CFA169661E33
-kitten2.address 62.210.124.124
-kitten2.or_port 9101
-kitten2.dir_port 9130
-kitten2.fingerprint 2EBD117806EE43C3CC885A8F1E4DC60F207E7D3E
-Nurnberg02.address 213.239.220.25
-Nurnberg02.or_port 443
-Nurnberg02.dir_port 22
-Nurnberg02.fingerprint BEE2317AE127EB681C5AE1551C1EA0630580638A
-eriador.address 85.25.138.93
-eriador.or_port 4029
-eriador.dir_port 9030
-eriador.fingerprint 6DE61A6F72C1E5418A66BFED80DFB63E4C77668F
-Doedel26.address 178.254.20.134
-Doedel26.or_port 443
-Doedel26.dir_port 80
-Doedel26.fingerprint 9F5068310818ED7C70B0BC4087AB55CB12CB4377
-kitten1.address 62.210.124.124
-kitten1.or_port 9001
-kitten1.dir_port 9030
-kitten1.fingerprint 86E78DD3720C78DA8673182EF96C54B162CD660C
-bakunin.address 178.16.208.57
-bakunin.or_port 443
-bakunin.dir_port 80
-bakunin.fingerprint 92CFD9565B24646CAC2D172D3DB503D69E777B8A
-PedicaboMundi.address 144.76.14.145
-PedicaboMundi.or_port 143
-PedicaboMundi.dir_port 110
-PedicaboMundi.fingerprint 14419131033443AE6E21DA82B0D307F7CAE42BDB
-tornoderdednl.address 178.62.199.226
-tornoderdednl.or_port 443
-tornoderdednl.dir_port 80
-tornoderdednl.fingerprint CBEFF7BA4A4062045133C053F2D70524D8BBE5BE
-ratchet.address 170.130.1.7
-ratchet.or_port 9001
-ratchet.dir_port 9030
-ratchet.fingerprint FA3415659444AE006E7E9E5375E82F29700CFDFD
-Freebird32.address 178.254.13.126
-Freebird32.or_port 9001
-Freebird32.dir_port 9030
-Freebird32.fingerprint 0C475BA4D3AA3C289B716F95954CAD616E50C4E5
-Freebird31.address 178.254.13.126
-Freebird31.or_port 443
-Freebird31.dir_port 80
-Freebird31.fingerprint F9246DEF2B653807236DA134F2AEAB103D58ABFE
-12xBTME1.address 81.7.17.171
-12xBTME1.or_port 443
-12xBTME1.dir_port 80
-12xBTME1.fingerprint 00C4B4731658D3B4987132A3F77100CFCB190D97
-kili.address 178.62.173.203
-kili.or_port 9001
-kili.dir_port 9030
-kili.fingerprint DD85503F2D1F52EF9EAD621E942298F46CD2FC10
-fluxe4.address 131.188.40.188
-fluxe4.or_port 80
-fluxe4.dir_port 443
-fluxe4.fingerprint EBE718E1A49EE229071702964F8DB1F318075FF8
-pixelminer.address 81.7.14.246
-pixelminer.or_port 443
-pixelminer.dir_port 80
-pixelminer.fingerprint CE75BF0972ADD52AF8807602374E495C815DB304
-Nurnberg04.address 88.198.38.226
-Nurnberg04.or_port 443
-Nurnberg04.dir_port 22
-Nurnberg04.fingerprint 4B9E2C56FB42B891794FE2CD2FCAD08A320CC3BB
-Nurnberg03.address 85.10.201.38
-Nurnberg03.or_port 443
-Nurnberg03.dir_port 22
-Nurnberg03.fingerprint F6279A203C1950ACF592322A235647A05BFBCF91
-Doedel24.address 178.254.20.134
-Doedel24.or_port 9001
-Doedel24.dir_port 9030
-Doedel24.fingerprint 2CE96A8A1DA032664C90F574AFFBECE18A6E8DFC
-horizons.address 167.114.35.28
-horizons.or_port 9001
-horizons.dir_port 9030
-horizons.fingerprint E65D300F11E1DB12C534B0146BDAB6972F1A8A48
+stem_commit a96ec510539f2918bf93c50d63ce68e919f71209
+8FA37B93397015B2BC5A525C908485260BE9F422.address 178.254.44.135
+8FA37B93397015B2BC5A525C908485260BE9F422.or_port 9001
+8FA37B93397015B2BC5A525C908485260BE9F422.dir_port 9030
+8FA37B93397015B2BC5A525C908485260BE9F422.nickname Doedel22
+855BC2DABE24C861CD887DB9B2E950424B49FC34.address 84.219.173.60
+855BC2DABE24C861CD887DB9B2E950424B49FC34.or_port 443
+855BC2DABE24C861CD887DB9B2E950424B49FC34.dir_port 9030
+855BC2DABE24C861CD887DB9B2E950424B49FC34.nickname Logforme
+AE6A8C18E7499B586CD36246AC4BCAFFBBF93AB2.address 178.254.44.135
+AE6A8C18E7499B586CD36246AC4BCAFFBBF93AB2.or_port 443
+AE6A8C18E7499B586CD36246AC4BCAFFBBF93AB2.dir_port 80
+AE6A8C18E7499B586CD36246AC4BCAFFBBF93AB2.nickname Doedel21
+6FB38EB22E57EF7ED5EF00238F6A48E553735D88.address 212.47.237.95
+6FB38EB22E57EF7ED5EF00238F6A48E553735D88.or_port 9101
+6FB38EB22E57EF7ED5EF00238F6A48E553735D88.dir_port 9130
+6FB38EB22E57EF7ED5EF00238F6A48E553735D88.nickname kitten4
+3F5D8A879C58961BB45A3D26AC41B543B40236D6.address 212.47.237.95
+3F5D8A879C58961BB45A3D26AC41B543B40236D6.or_port 9001
+3F5D8A879C58961BB45A3D26AC41B543B40236D6.dir_port 9030
+3F5D8A879C58961BB45A3D26AC41B543B40236D6.nickname kitten3
+943C0C6841C1E914B9FCA796C6846620A5AF9BC7.address 217.12.210.214
+943C0C6841C1E914B9FCA796C6846620A5AF9BC7.or_port 443
+943C0C6841C1E914B9FCA796C6846620A5AF9BC7.dir_port 80
+943C0C6841C1E914B9FCA796C6846620A5AF9BC7.nickname Unnamed
+A360C21FA87FFA2046D92C17086A6B47E5C68109.address 51.255.33.237
+A360C21FA87FFA2046D92C17086A6B47E5C68109.or_port 9001
+A360C21FA87FFA2046D92C17086A6B47E5C68109.dir_port 9091
+A360C21FA87FFA2046D92C17086A6B47E5C68109.nickname coby
+4F0DB7E687FC7C0AE55C8F243DA8B0EB27FBF1F2.address 108.53.208.157
+4F0DB7E687FC7C0AE55C8F243DA8B0EB27FBF1F2.or_port 443
+4F0DB7E687FC7C0AE55C8F243DA8B0EB27FBF1F2.dir_port 80
+4F0DB7E687FC7C0AE55C8F243DA8B0EB27FBF1F2.nickname Binnacle
+F8D27B163B9247B232A2EEE68DD8B698695C28DE.address 78.47.18.110
+F8D27B163B9247B232A2EEE68DD8B698695C28DE.or_port 80
+F8D27B163B9247B232A2EEE68DD8B698695C28DE.dir_port 443
+F8D27B163B9247B232A2EEE68DD8B698695C28DE.nickname fluxe3
+0756B7CD4DFC8182BE23143FAC0642F515182CEB.address 5.9.110.236
+0756B7CD4DFC8182BE23143FAC0642F515182CEB.or_port 9001
+0756B7CD4DFC8182BE23143FAC0642F515182CEB.dir_port 9030
+0756B7CD4DFC8182BE23143FAC0642F515182CEB.nickname rueckgrat
+5BFDECCE9B4A23AE14EC767C5A2C1E10558B00B9.address 213.239.210.204
+5BFDECCE9B4A23AE14EC767C5A2C1E10558B00B9.or_port 443
+5BFDECCE9B4A23AE14EC767C5A2C1E10558B00B9.dir_port 22
+5BFDECCE9B4A23AE14EC767C5A2C1E10558B00B9.nickname Nurnberg01
+5525D0429BFE5DC4F1B0E9DE47A4CFA169661E33.address 5.175.233.86
+5525D0429BFE5DC4F1B0E9DE47A4CFA169661E33.or_port 443
+5525D0429BFE5DC4F1B0E9DE47A4CFA169661E33.dir_port 80
+5525D0429BFE5DC4F1B0E9DE47A4CFA169661E33.nickname wagner
+2EBD117806EE43C3CC885A8F1E4DC60F207E7D3E.address 62.210.124.124
+2EBD117806EE43C3CC885A8F1E4DC60F207E7D3E.or_port 9101
+2EBD117806EE43C3CC885A8F1E4DC60F207E7D3E.dir_port 9130
+2EBD117806EE43C3CC885A8F1E4DC60F207E7D3E.nickname kitten2
+BEE2317AE127EB681C5AE1551C1EA0630580638A.address 213.239.220.25
+BEE2317AE127EB681C5AE1551C1EA0630580638A.or_port 443
+BEE2317AE127EB681C5AE1551C1EA0630580638A.dir_port 22
+BEE2317AE127EB681C5AE1551C1EA0630580638A.nickname Nurnberg02
+DF3AED4322B1824BF5539AE54B2D1B38E080FF05.address 217.12.199.208
+DF3AED4322B1824BF5539AE54B2D1B38E080FF05.or_port 443
+DF3AED4322B1824BF5539AE54B2D1B38E080FF05.dir_port 80
+DF3AED4322B1824BF5539AE54B2D1B38E080FF05.nickname Unnamed
+6DE61A6F72C1E5418A66BFED80DFB63E4C77668F.address 85.25.138.93
+6DE61A6F72C1E5418A66BFED80DFB63E4C77668F.or_port 4029
+6DE61A6F72C1E5418A66BFED80DFB63E4C77668F.dir_port 9030
+6DE61A6F72C1E5418A66BFED80DFB63E4C77668F.nickname eriador
+9F5068310818ED7C70B0BC4087AB55CB12CB4377.address 178.254.20.134
+9F5068310818ED7C70B0BC4087AB55CB12CB4377.or_port 443
+9F5068310818ED7C70B0BC4087AB55CB12CB4377.dir_port 80
+9F5068310818ED7C70B0BC4087AB55CB12CB4377.nickname Doedel26
+86E78DD3720C78DA8673182EF96C54B162CD660C.address 62.210.124.124
+86E78DD3720C78DA8673182EF96C54B162CD660C.or_port 9001
+86E78DD3720C78DA8673182EF96C54B162CD660C.dir_port 9030
+86E78DD3720C78DA8673182EF96C54B162CD660C.nickname kitten1
+92CFD9565B24646CAC2D172D3DB503D69E777B8A.address 178.16.208.57
+92CFD9565B24646CAC2D172D3DB503D69E777B8A.or_port 443
+92CFD9565B24646CAC2D172D3DB503D69E777B8A.dir_port 80
+92CFD9565B24646CAC2D172D3DB503D69E777B8A.nickname bakunin
+14419131033443AE6E21DA82B0D307F7CAE42BDB.address 144.76.14.145
+14419131033443AE6E21DA82B0D307F7CAE42BDB.or_port 143
+14419131033443AE6E21DA82B0D307F7CAE42BDB.dir_port 110
+14419131033443AE6E21DA82B0D307F7CAE42BDB.nickname PedicaboMundi
+CBEFF7BA4A4062045133C053F2D70524D8BBE5BE.address 178.62.199.226
+CBEFF7BA4A4062045133C053F2D70524D8BBE5BE.or_port 443
+CBEFF7BA4A4062045133C053F2D70524D8BBE5BE.dir_port 80
+CBEFF7BA4A4062045133C053F2D70524D8BBE5BE.nickname tornoderdednl
+FA3415659444AE006E7E9E5375E82F29700CFDFD.address 170.130.1.7
+FA3415659444AE006E7E9E5375E82F29700CFDFD.or_port 9001
+FA3415659444AE006E7E9E5375E82F29700CFDFD.dir_port 9030
+FA3415659444AE006E7E9E5375E82F29700CFDFD.nickname ratchet
+0C475BA4D3AA3C289B716F95954CAD616E50C4E5.address 178.254.13.126
+0C475BA4D3AA3C289B716F95954CAD616E50C4E5.or_port 9001
+0C475BA4D3AA3C289B716F95954CAD616E50C4E5.dir_port 9030
+0C475BA4D3AA3C289B716F95954CAD616E50C4E5.nickname Freebird32
+F9246DEF2B653807236DA134F2AEAB103D58ABFE.address 178.254.13.126
+F9246DEF2B653807236DA134F2AEAB103D58ABFE.or_port 443
+F9246DEF2B653807236DA134F2AEAB103D58ABFE.dir_port 80
+F9246DEF2B653807236DA134F2AEAB103D58ABFE.nickname Freebird31
+00C4B4731658D3B4987132A3F77100CFCB190D97.address 81.7.17.171
+00C4B4731658D3B4987132A3F77100CFCB190D97.or_port 443
+00C4B4731658D3B4987132A3F77100CFCB190D97.dir_port 80
+00C4B4731658D3B4987132A3F77100CFCB190D97.nickname 12xBTME1
+DD85503F2D1F52EF9EAD621E942298F46CD2FC10.address 178.62.173.203
+DD85503F2D1F52EF9EAD621E942298F46CD2FC10.or_port 9001
+DD85503F2D1F52EF9EAD621E942298F46CD2FC10.dir_port 9030
+DD85503F2D1F52EF9EAD621E942298F46CD2FC10.nickname kili
+EBE718E1A49EE229071702964F8DB1F318075FF8.address 131.188.40.188
+EBE718E1A49EE229071702964F8DB1F318075FF8.or_port 80
+EBE718E1A49EE229071702964F8DB1F318075FF8.dir_port 443
+EBE718E1A49EE229071702964F8DB1F318075FF8.nickname fluxe4
+CE75BF0972ADD52AF8807602374E495C815DB304.address 81.7.14.246
+CE75BF0972ADD52AF8807602374E495C815DB304.or_port 443
+CE75BF0972ADD52AF8807602374E495C815DB304.dir_port 80
+CE75BF0972ADD52AF8807602374E495C815DB304.nickname pixelminer
+4B9E2C56FB42B891794FE2CD2FCAD08A320CC3BB.address 88.198.38.226
+4B9E2C56FB42B891794FE2CD2FCAD08A320CC3BB.or_port 443
+4B9E2C56FB42B891794FE2CD2FCAD08A320CC3BB.dir_port 22
+4B9E2C56FB42B891794FE2CD2FCAD08A320CC3BB.nickname Nurnberg04
+F6279A203C1950ACF592322A235647A05BFBCF91.address 85.10.201.38
+F6279A203C1950ACF592322A235647A05BFBCF91.or_port 443
+F6279A203C1950ACF592322A235647A05BFBCF91.dir_port 22
+F6279A203C1950ACF592322A235647A05BFBCF91.nickname Nurnberg03
+2CE96A8A1DA032664C90F574AFFBECE18A6E8DFC.address 178.254.20.134
+2CE96A8A1DA032664C90F574AFFBECE18A6E8DFC.or_port 9001
+2CE96A8A1DA032664C90F574AFFBECE18A6E8DFC.dir_port 9030
+2CE96A8A1DA032664C90F574AFFBECE18A6E8DFC.nickname Doedel24
+E65D300F11E1DB12C534B0146BDAB6972F1A8A48.address 167.114.35.28
+E65D300F11E1DB12C534B0146BDAB6972F1A8A48.or_port 9001
+E65D300F11E1DB12C534B0146BDAB6972F1A8A48.dir_port 9030
+E65D300F11E1DB12C534B0146BDAB6972F1A8A48.nickname horizons
diff --git a/stem/descriptor/remote.py b/stem/descriptor/remote.py
index 1afa70a..baba8ac 100644
--- a/stem/descriptor/remote.py
+++ b/stem/descriptor/remote.py
@@ -948,34 +948,34 @@ class FallbackDirectory(Directory):
results = {}
- for nickname in set([key.split('.')[0] for key in conf.keys()]):
- if nickname in ('tor_commit', 'stem_commit'):
+ for fingerprint in set([key.split('.')[0] for key in conf.keys()]):
+ if fingerprint in ('tor_commit', 'stem_commit'):
continue
attr = {}
- for attr_name in ('address', 'or_port', 'dir_port', 'fingerprint'):
- key = '%s.%s' % (nickname, attr_name)
+ for attr_name in ('address', 'or_port', 'dir_port', 'nickname'):
+ key = '%s.%s' % (fingerprint, attr_name)
attr[attr_name] = conf.get(key)
if not attr[attr_name]:
raise IOError("'%s' is missing from %s" % (key, CACHE_PATH))
if not connection.is_valid_ipv4_address(attr['address']):
- raise IOError("'%s.address' was an invalid address (%s)" % (nickname, attr['address']))
+ raise IOError("'%s.address' was an invalid address (%s)" % (fingerprint, attr['address']))
elif not connection.is_valid_port(attr['or_port']):
- raise IOError("'%s.or_port' was an invalid port (%s)" % (nickname, attr['or_port']))
+ raise IOError("'%s.or_port' was an invalid port (%s)" % (fingerprint, attr['or_port']))
elif not connection.is_valid_port(attr['dir_port']):
- raise IOError("'%s.dir_port' was an invalid port (%s)" % (nickname, attr['dir_port']))
- elif not tor_tools.is_valid_fingerprint(attr['fingerprint']):
- raise IOError("'%s.fingerprint' was an invalid fingerprint (%s)" % (nickname, attr['fingerprint']))
+ raise IOError("'%s.dir_port' was an invalid port (%s)" % (fingerprint, attr['dir_port']))
+ elif not tor_tools.is_valid_nickname(attr['nickname']):
+ raise IOError("'%s.nickname' was an invalid nickname (%s)" % (fingerprint, attr['nickname']))
- results[attr['fingerprint']] = FallbackDirectory(
+ results[fingerprint] = FallbackDirectory(
address = attr['address'],
or_port = int(attr['or_port']),
dir_port = int(attr['dir_port']),
- fingerprint = attr['fingerprint'],
- nickname = nickname,
+ fingerprint = fingerprint,
+ nickname = attr['nickname'],
)
return results