Add a nickname to each fallback in a C comment

This makes it easier for operators to find their relays, and allows stem to
use nicknames to identify fallbacks.

Implements ticket 24600.
This commit is contained in:
teor 2017-12-23 00:23:12 +11:00
parent 384a450a47
commit 561f18e724
No known key found for this signature in database
GPG Key ID: 740D9E39025272A2
2 changed files with 12 additions and 0 deletions

5
changes/ticket24600 Normal file
View File

@ -0,0 +1,5 @@
o Minor features (fallback directory mirrors):
- Add a nickname to each fallback in a C comment. This makes it easier for
operators to find their relays, and allows stem to use nicknames to
identify fallbacks.
Implements ticket 24600.

View File

@ -1331,6 +1331,7 @@ class Candidate(object):
def fallbackdir_info(self, dl_speed_ok): def fallbackdir_info(self, dl_speed_ok):
# "address:dirport orport=port id=fingerprint" # "address:dirport orport=port id=fingerprint"
# "[ipv6=addr:orport]" # "[ipv6=addr:orport]"
# /* nickname=name */
# , # ,
# #
# Do we want a C string, or a commented-out string? # Do we want a C string, or a commented-out string?
@ -1355,6 +1356,12 @@ class Candidate(object):
if self.has_ipv6(): if self.has_ipv6():
s += '" ipv6=%s:%d"'%(cleanse_c_string(self.ipv6addr), self.ipv6orport) s += '" ipv6=%s:%d"'%(cleanse_c_string(self.ipv6addr), self.ipv6orport)
s += '\n' s += '\n'
if not comment_string:
s += '/* '
s += 'nickname=%s'%(cleanse_c_string(self._data['nickname']))
if not comment_string:
s += ' */'
s += '\n'
s += ',' s += ','
if comment_string: if comment_string:
s += '\n' s += '\n'