diff options
| author | Tom Ritter <tom@ritter.vg> | 2017-11-17 11:49:35 -0600 |
|---|---|---|
| committer | Tom Ritter <tom@ritter.vg> | 2017-11-17 11:49:35 -0600 |
| commit | 5a8e4af0d4a1b7ea62a79d37eda63b3a5c6bcd6c (patch) | |
| tree | 9ddde4ff541a82f71e704c89ab4f27c595f3d309 | |
| parent | a168d6af049fd9b08fcae161973a0696021dd529 (diff) | |
Add the ReachableIPv6 pseudoflag. Closes 24287
| -rwxr-xr-x | website.py | 26 |
1 files changed, 26 insertions, 0 deletions
@@ -29,7 +29,10 @@ class WebsiteWriter: directory_key_warning_time = datetime.timedelta(days=14) config = {} known_params = [] + already_added_pseudoflags = False def write_website(self, filename, include_relay_info=True): + if not self.already_added_pseudoflags: + self._add_pseudo_flags() self.site = open(filename, 'w') self._write_page_header(include_relay_info) self._write_valid_after_time() @@ -76,6 +79,29 @@ class WebsiteWriter: return self.consensus.valid_after #----------------------------------------------------------------------------------------- + def _add_pseudo_flags(self): + """ + Add any calculated or otherwise pseudoflags to the data structures + """ + self.already_added_pseudoflags = True + + # Add the ReachableIPv6 flag + for dirauth_nickname in self.known_authorities: + if dirauth_nickname in self.votes: + vote = self.votes[dirauth_nickname] + has_ipv6 = False + for r in vote.routers: + if len([a for a in vote.routers[r].or_addresses if a[2] == True]): + has_ipv6 = True + vote.routers[r].flags.append('ReachableIPv6') + if has_ipv6: + vote.known_flags.append('ReachableIPv6') + for r in self.consensus.routers: + if len([a for a in self.consensus.routers[r].or_addresses if a[2] == True]): + self.consensus.routers[r].flags.append('ReachableIPv6') + self.consensus.known_flags.append('ReachableIPv6') + + #----------------------------------------------------------------------------------------- def _write_page_header(self, include_relay_info): """ Write the HTML page header including the metrics website navigation. |
