commit 6af98a8ac813a8b34052539dbad0f71797e39908 Author: Michael Wolf mikewolf@riseup.net Date: Sat Apr 19 15:06:31 2014 -0400
Remove leading spaces to reduce HTML size
* Remove leading spaces (Implements part 3 of ticket #11563) * Improve alignment of HTML in source --- .../torproject/doctor/MetricsWebsiteReport.java | 650 ++++++++++---------- 1 file changed, 325 insertions(+), 325 deletions(-)
diff --git a/src/org/torproject/doctor/MetricsWebsiteReport.java b/src/org/torproject/doctor/MetricsWebsiteReport.java index 428bee2..f6f59f8 100644 --- a/src/org/torproject/doctor/MetricsWebsiteReport.java +++ b/src/org/torproject/doctor/MetricsWebsiteReport.java @@ -102,52 +102,52 @@ public class MetricsWebsiteReport { this.bw.write("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 " + "Transitional//EN\">\n" + "<html>\n" - + " <head>\n" - + " <title>Consensus health</title>\n" - + " <meta http-equiv="content-type" content="text/html; " - + "charset=ISO-8859-1">\n" - + " <link href="/css/stylesheet-ltr.css" type="text/css" " + + "<head>\n" + + "<title>Consensus health</title>\n" + + "<meta http-equiv="content-type" content="text/html; " + + "charset=ISO-8859-1">\n" + + "<link href="/css/stylesheet-ltr.css" type="text/css" " + "rel="stylesheet">\n" - + " <link href="/images/favicon.ico" " + + "<link href="/images/favicon.ico" " + "type="image/x-icon" rel="shortcut icon">\n" - + " </head>\n" - + " <body>\n" - + " <style>\n" - + " tr:nth-child(2n) {\n" - + " background-color:#eeeeee;\n" - + " }\n" - + " .oiv {\n" - + " color:red;\n" - + " }\n" - + " .oic {\n" - + " color:gray;\n" - + " text-decoration:line-through;\n" - + " }\n" - + " .ic {\n" - + " color:blue;\n" - + " }\n" - + " .tbl-hdr {\n" - + " height:3em;\n" - + " vertical-align:bottom;\n" - + " }\n" - + " </style>\n" - + " <div class="center">\n" - + " <div class="main-column">\n" - + " <h2>Consensus Health</h2>\n" - + " <br>\n" - + " <p>This page shows statistics about the current " + + "</head>\n" + + "<body>\n" + + "<style>\n" + + "tr:nth-child(2n) {\n" + + "background-color:#eeeeee;\n" + + "}\n" + + ".oiv {\n" + + "color:red;\n" + + "}\n" + + ".oic {\n" + + "color:gray;\n" + + "text-decoration:line-through;\n" + + "}\n" + + ".ic {\n" + + "color:blue;\n" + + "}\n" + + ".tbl-hdr {\n" + + "height:3em;\n" + + "vertical-align:bottom;\n" + + "}\n" + + "</style>\n" + + "<div class="center">\n" + + "<div class="main-column">\n" + + "<h2>Consensus Health</h2>\n" + + "<br>\n" + + "<p>This page shows statistics about the current " + "consensus and votes to facilitate debugging of the " + "directory consensus process.</p>\n"); }
/* Write the valid-after time of the downloaded consensus. */ private void writeValidAfterTime() throws IOException { - this.bw.write(" <br>\n" - + " <a name="validafter">\n" - + " <h3><a href="#validafter" class="anchor">" + this.bw.write("<br>\n" + + "<a name="validafter">\n" + + "<h3><a href="#validafter" class="anchor">" + "Valid-after time</a></h3>\n" - + " <br>\n" - + " <p>Consensus was published "); + + "<br>\n" + + "<p>Consensus was published "); if (this.downloadedConsensus.getValidAfterMillis() < System.currentTimeMillis() - 3L * 60L * 60L * 1000L) { this.bw.write("<span class="oiv">" @@ -163,59 +163,58 @@ public class MetricsWebsiteReport {
/* Write the lists of known flags. */ private void writeKnownFlags() throws IOException { - this.bw.write(" <br>\n" - + " <a name="knownflags">\n" - + " <h3><a href="#knownflags" class="anchor">Known " + this.bw.write("<br>\n" + + "<a name="knownflags">\n" + + "<h3><a href="#knownflags" class="anchor">Known " + "flags</a></h3>\n" - + " <br>\n" - + " <table border="0" cellpadding="4" " + + "<br>\n" + + "<table border="0" cellpadding="4" " + "cellspacing="0" summary="">\n" - + " <colgroup>\n" - + " <col width="160">\n" - + " <col width="640">\n" - + " </colgroup>\n"); + + "<colgroup>\n" + + "<col width="160">\n" + + "<col width="640">\n" + + "</colgroup>\n"); if (this.downloadedVotes.size() < 1) { - this.bw.write(" <tr><td>(No votes.)</td><td></td></tr>\n"); + this.bw.write("<tr><td>(No votes.)</td><td></td></tr>\n"); } else { for (RelayNetworkStatusVote vote : this.downloadedVotes.values()) { - this.bw.write(" <tr>\n" - + " <td>" + vote.getNickname() + "</td>\n" - + " <td>known-flags"); + this.bw.write("<tr>\n" + + "<td>" + vote.getNickname() + "</td>\n" + + "<td>known-flags"); for (String knownFlag : vote.getKnownFlags()) { this.bw.write(" " + knownFlag); } - this.bw.write("</td>\n" - + " </tr>\n"); + this.bw.write( "</td>\n" + + "</tr>\n"); } } - this.bw.write(" <tr>\n" - + " <td class="ic">consensus</td>\n" - + " <td class="ic">known-flags"); + this.bw.write( "<tr>\n" + + "<td class="ic">consensus</td>\n" + + "<td class="ic">known-flags"); for (String knownFlag : this.downloadedConsensus.getKnownFlags()) { this.bw.write(" " + knownFlag); } - this.bw.write("</td>\n" - + " </tr>\n" - + " </table>\n"); + this.bw.write( "</td>\n" + + "</tr>\n" + + "</table>\n"); }
/* Write the number of relays voted about. */ private void writeNumberOfRelaysVotedAbout() throws IOException { - this.bw.write(" <br>\n" - + " <a name="numberofrelays">\n" - + " <h3><a href="#numberofrelays" class="anchor">" + this.bw.write("<br>\n" + + "<a name="numberofrelays">\n" + + "<h3><a href="#numberofrelays" class="anchor">" + "Number of relays voted about</a></h3>\n" - + " <br>\n" - + " <table border="0" cellpadding="4" " + + "<br>\n" + + "<table border="0" cellpadding="4" " + "cellspacing="0" summary="">\n" - + " <colgroup>\n" - + " <col width="160">\n" - + " <col width="320">\n" - + " <col width="320">\n" - + " </colgroup>\n"); + + "<colgroup>\n" + + "<col width="160">\n" + + "<col width="320">\n" + + "<col width="320">\n" + + "</colgroup>\n"); if (this.downloadedVotes.size() < 1) { - this.bw.write(" <tr><td>(No votes.)</td><td></td><td></td>" - + "</tr>\n"); + this.bw.write("<tr><td>(No votes.)</td><td></td><td></td></tr>\n"); } else { for (RelayNetworkStatusVote vote : this.downloadedVotes.values()) { int runningRelays = 0; @@ -225,12 +224,12 @@ public class MetricsWebsiteReport { runningRelays++; } } - this.bw.write(" <tr>\n" - + " <td>" + vote.getNickname() + "</td>\n" - + " <td>" + vote.getStatusEntries().size() + this.bw.write("<tr>\n" + + "<td>" + vote.getNickname() + "</td>\n" + + "<td>" + vote.getStatusEntries().size() + " total</td>\n" - + " <td>" + runningRelays + " Running</td>\n" - + " </tr>\n"); + + "<td>" + runningRelays + " Running</td>\n" + + "</tr>\n"); } } int runningRelays = 0; @@ -240,82 +239,82 @@ public class MetricsWebsiteReport { runningRelays++; } } - this.bw.write(" <tr>\n" - + " <td class="ic">consensus</td>\n" - + " <td/>\n" - + " <td class="ic">" + runningRelays + this.bw.write( "<tr>\n" + + "<td class="ic">consensus</td>\n" + + "<td/>\n" + + "<td class="ic">" + runningRelays + " Running</td>\n" - + " </tr>\n" - + " </table>\n"); + + "</tr>\n" + + "</table>\n"); }
/* Write the supported consensus methods of directory authorities and * the resulting consensus method. */ private void writeConsensusMethods() throws IOException { - this.bw.write(" <br>\n" - + " <a name="consensusmethods">\n" - + " <h3><a href="#consensusmethods" class="anchor">" + this.bw.write("<br>\n" + + "<a name="consensusmethods">\n" + + "<h3><a href="#consensusmethods" class="anchor">" + "Consensus methods</a></h3>\n" - + " <br>\n" - + " <table border="0" cellpadding="4" " + + "<br>\n" + + "<table border="0" cellpadding="4" " + "cellspacing="0" summary="">\n" - + " <colgroup>\n" - + " <col width="160">\n" - + " <col width="640">\n" - + " </colgroup>\n"); + + "<colgroup>\n" + + "<col width="160">\n" + + "<col width="640">\n" + + "</colgroup>\n"); if (this.downloadedVotes.size() < 1) { - this.bw.write(" <tr><td>(No votes.)</td><td></td></tr>\n"); + this.bw.write("<tr><td>(No votes.)</td><td></td></tr>\n"); } else { for (RelayNetworkStatusVote vote : this.downloadedVotes.values()) { List<Integer> consensusMethods = vote.getConsensusMethods(); if (consensusMethods.contains( this.downloadedConsensus.getConsensusMethod())) { - this.bw.write(" <tr>\n" - + " <td>" + vote.getNickname() + "</td>\n" - + " <td>consensus-methods"); + this.bw.write("<tr>\n" + + "<td>" + vote.getNickname() + "</td>\n" + + "<td>consensus-methods"); for (int consensusMethod : consensusMethods) { this.bw.write(" " + String.valueOf(consensusMethod)); } - this.bw.write("</td>\n" - + " </tr>\n"); + this.bw.write( "</td>\n" + + "</tr>\n"); } else { - this.bw.write(" <tr>\n" - + " <td><span class="oiv">" + this.bw.write("<tr>\n" + + "<td><span class="oiv">" + vote.getNickname() + "</span></td>\n" - + " <td><span class="oiv">" + + "<td><span class="oiv">" + "consensus-methods"); for (int consensusMethod : consensusMethods) { this.bw.write(" " + String.valueOf(consensusMethod)); } - this.bw.write("</span></td>\n" - + " </tr>\n"); + this.bw.write( "</span></td>\n" + + "</tr>\n"); } } } - this.bw.write(" <tr>\n" - + " <td class="ic">consensus</td>\n" - + " <td class="ic">consensus-method " + this.bw.write( "<tr>\n" + + "<td class="ic">consensus</td>\n" + + "<td class="ic">consensus-method " + this.downloadedConsensus.getConsensusMethod() - + "</td>\n" - + " </tr>\n" - + " </table>\n"); + + "</td>\n" + + "</tr>\n" + + "</table>\n"); }
/* Write recommended versions. */ private void writeRecommendedVersions() throws IOException { - this.bw.write(" <br>\n" - + " <a name="recommendedversions">\n" - + " <h3><a href="#recommendedversions" class="anchor">" + this.bw.write("<br>\n" + + "<a name="recommendedversions">\n" + + "<h3><a href="#recommendedversions" class="anchor">" + "Recommended versions</a></h3>\n" - + " <br>\n" - + " <table border="0" cellpadding="4" " + + "<br>\n" + + "<table border="0" cellpadding="4" " + "cellspacing="0" summary="">\n" - + " <colgroup>\n" - + " <col width="160">\n" - + " <col width="640">\n" - + " </colgroup>\n"); + + "<colgroup>\n" + + "<col width="160">\n" + + "<col width="640">\n" + + "</colgroup>\n"); if (this.downloadedVotes.size() < 1) { - this.bw.write(" <tr><td>(No votes.)</td><td></td></tr>\n"); + this.bw.write("<tr><td>(No votes.)</td><td></td></tr>\n"); } else { for (RelayNetworkStatusVote vote : this.downloadedVotes.values()) { List<String> voteRecommendedClientVersions = @@ -323,27 +322,28 @@ public class MetricsWebsiteReport { if (voteRecommendedClientVersions != null) { if (downloadedConsensus.getRecommendedClientVersions().equals( voteRecommendedClientVersions)) { - this.bw.write(" <tr>\n" - + " <td>" + vote.getNickname() + "</td>\n" - + " <td>client-versions "); + this.bw.write("<tr>\n" + + "<td>" + vote.getNickname() + "</td>\n" + + "<td>client-versions "); int i = 0; for (String version : voteRecommendedClientVersions) { this.bw.write((i++ > 0 ? "," : "") + version); } - this.bw.write("</td>\n" - + " </tr>\n"); + this.bw.write( "</td>\n" + + "</tr>\n"); } else { - this.bw.write(" <tr>\n" - + " <td><span class="oiv">" + this.bw.write("<tr>\n" + + "<td><span class="oiv">" + vote.getNickname() + "</span></td>\n" - + " <td><span class="oiv">client-versions "); + + "<td><span class="oiv">client-versions "); int i = 0; for (String version : voteRecommendedClientVersions) { this.bw.write((i++ > 0 ? "," : "") + version); } - this.bw.write("</span></td>\n" - + " </tr>\n"); + this.bw.write( "</span>" + + "</td>\n" + + "</tr>\n"); } } List<String> voteRecommendedServerVersions = @@ -351,67 +351,67 @@ public class MetricsWebsiteReport { if (voteRecommendedServerVersions != null) { if (downloadedConsensus.getRecommendedServerVersions().equals( voteRecommendedServerVersions)) { - this.bw.write(" <tr>\n" - + " <td></td>\n" - + " <td>server-versions "); + this.bw.write("<tr>\n" + + "<td></td>\n" + + "<td>server-versions "); int i = 0; for (String version : voteRecommendedServerVersions) { this.bw.write((i++ > 0 ? "," : "") + version); } - this.bw.write("</td>\n" - + " </tr>\n"); + this.bw.write( "</td>\n" + + "</tr>\n"); } else { - this.bw.write(" <tr>\n" - + " <td></td>\n" - + " <td><span class="oiv">server-versions "); + this.bw.write("<tr>\n" + + "<td></td>\n" + + "<td><span class="oiv">server-versions "); int i = 0; for (String version : voteRecommendedServerVersions) { this.bw.write((i++ > 0 ? "," : "") + version); } this.bw.write("</span></td>\n" - + " </tr>\n"); + + "</tr>\n"); } } } } - this.bw.write(" <tr>\n" - + " <td class="ic">consensus</td>\n" - + " <td class="ic">client-versions "); + this.bw.write( "<tr>\n" + + "<td class="ic">consensus</td>\n" + + "<td class="ic">client-versions "); int i = 0; for (String version : downloadedConsensus.getRecommendedClientVersions()) { this.bw.write((i++ > 0 ? "," : "") + version); } - this.bw.write("</td>\n" - + " </tr>\n" - + " <tr>\n" - + " <td></td>\n" - + " <td class="ic">server-versions "); + this.bw.write( "</td>\n" + + "</tr>\n" + + "<tr>\n" + + "<td></td>\n" + + "<td class="ic">server-versions "); i = 0; for (String version : downloadedConsensus.getRecommendedServerVersions()) { this.bw.write((i++ > 0 ? "," : "") + version); } - this.bw.write("</td>\n" - + " </tr>\n" - + " </table>\n"); + this.bw.write( "</td>\n" + + "</tr>\n" + + "</table>\n"); }
/* Write consensus parameters. */ private void writeConsensusParameters() throws IOException { - this.bw.write(" <br>\n" - + " <a name="consensusparams">\n" - + " <h3><a href="#consensusparams" class="anchor">" + this.bw.write("<br>\n" + + "<a name="consensusparams">\n" + + "<h3><a href="#consensusparams" class="anchor">" + "Consensus parameters</a></h3>\n" - + " <br>\n" - + " <table border="0" cellpadding="4" " + + "<br>\n" + + "<table border="0" cellpadding="4" " + "cellspacing="0" summary="">\n" - + " <colgroup>\n" - + " <col width="160">\n" - + " <col width="640">\n" - + " </colgroup>\n"); + + "<colgroup>\n" + + "<col width="160">\n" + + "<col width="640">\n" + + "</colgroup>\n"); if (this.downloadedVotes.size() < 1) { - this.bw.write(" <tr><td>(No votes.)</td><td></td></tr>\n"); + this.bw.write("<tr><td>(No votes.)</td><td></td></tr>\n"); } else { Set<String> validParameters = new HashSet<String>(Arrays.asList( ("circwindow,CircuitPriorityHalflifeMsec,refuseunknownexits," @@ -440,81 +440,81 @@ public class MetricsWebsiteReport { } } if (conflictOrInvalid) { - this.bw.write(" <tr>\n" - + " <td><span class="oiv">" + this.bw.write("<tr>\n" + + "<td><span class="oiv">" + vote.getNickname() + "</span></td>\n" - + " <td><span class="oiv">params"); + + "<td><span class="oiv">params"); for (Map.Entry<String, Integer> e : voteConsensusParams.entrySet()) { this.bw.write(" " + e.getKey() + "=" + e.getValue()); } - this.bw.write("</span></td>\n" - + " </tr>\n"); + this.bw.write( "</span></td>\n" + + "</tr>\n"); } else { - this.bw.write(" <tr>\n" - + " <td>" + vote.getNickname() + "</td>\n" - + " <td>params"); + this.bw.write("<tr>\n" + + "<td>" + vote.getNickname() + "</td>\n" + + "<td>params"); for (Map.Entry<String, Integer> e : voteConsensusParams.entrySet()) { this.bw.write(" " + e.getKey() + "=" + e.getValue()); } - this.bw.write("</td>\n" - + " </tr>\n"); + this.bw.write( "</td>\n" + + "</tr>\n"); } } } - this.bw.write(" <tr>\n" - + " <td class="ic">consensus</td>\n" - + " <td class="ic">params"); + this.bw.write( "<tr>\n" + + "<td class="ic">consensus</td>\n" + + "<td class="ic">params"); for (Map.Entry<String, Integer> e : this.downloadedConsensus.getConsensusParams().entrySet()) { this.bw.write(" " + e.getKey() + "=" + e.getValue()); } - this.bw.write("</td>\n" - + " </tr>\n" - + " </table>\n"); + this.bw.write( "</td>\n" + + "</tr>\n" + + "</table>\n"); }
/* Write authority keys and their expiration dates. */ private void writeAuthorityKeys() throws IOException { - this.bw.write(" <br>\n" - + " <a name="authoritykeys">\n" - + " <h3><a href="#authoritykeys" class="anchor">" + this.bw.write("<br>\n" + + "<a name="authoritykeys">\n" + + "<h3><a href="#authoritykeys" class="anchor">" + "Authority keys</a></h3>\n" - + " <br>\n" - + " <table border="0" cellpadding="4" " + + "<br>\n" + + "<table border="0" cellpadding="4" " + "cellspacing="0" summary="">\n" - + " <colgroup>\n" - + " <col width="160">\n" - + " <col width="640">\n" - + " </colgroup>\n"); + + "<colgroup>\n" + + "<col width="160">\n" + + "<col width="640">\n" + + "</colgroup>\n"); if (this.downloadedVotes.size() < 1) { - this.bw.write(" <tr><td>(No votes.)</td><td></td></tr>\n"); + this.bw.write("<tr><td>(No votes.)</td><td></td></tr>\n"); } else { for (RelayNetworkStatusVote vote : this.downloadedVotes.values()) { long voteDirKeyExpiresMillis = vote.getDirKeyExpiresMillis(); if (voteDirKeyExpiresMillis - 14L * 24L * 60L * 60L * 1000L < System.currentTimeMillis()) { - this.bw.write(" <tr>\n" - + " <td><span class="oiv">" + this.bw.write("<tr>\n" + + "<td><span class="oiv">" + vote.getNickname() + "</span></td>\n" - + " <td><span class="oiv">dir-key-expires " + + "<td><span class="oiv">dir-key-expires " + dateTimeFormat.format(voteDirKeyExpiresMillis) + "</span></td>\n" - + " </tr>\n"); + + "</tr>\n"); } else { - this.bw.write(" <tr>\n" - + " <td>" + vote.getNickname() + "</td>\n" - + " <td>dir-key-expires " + this.bw.write("<tr>\n" + + "<td>" + vote.getNickname() + "</td>\n" + + "<td>dir-key-expires " + dateTimeFormat.format(voteDirKeyExpiresMillis) + "</td>\n" - + " </tr>\n"); + + "</tr>\n"); } } } - this.bw.write(" </table>\n" - + " <br>\n" - + " <p><i>Note that expiration dates of legacy keys are " + this.bw.write("</table>\n" + + "<br>\n" + + "<p><i>Note that expiration dates of legacy keys are " + "not included in votes and therefore not listed here!</i>" + "</p>\n"); } @@ -522,19 +522,19 @@ public class MetricsWebsiteReport { /* Write the status of bandwidth scanners and results being contained * in votes. */ private void writeBandwidthScannerStatus() throws IOException { - this.bw.write(" <br>\n" - + " <a name="bwauthstatus">\n" - + " <h3><a href="#bwauthstatus" class="anchor">" + this.bw.write("<br>\n" + + "<a name="bwauthstatus">\n" + + "<h3><a href="#bwauthstatus" class="anchor">" + "Bandwidth scanner status</a></h3>\n" - + " <br>\n" - + " <table border="0" cellpadding="4" " + + "<br>\n" + + "<table border="0" cellpadding="4" " + "cellspacing="0" summary="">\n" - + " <colgroup>\n" - + " <col width="160">\n" - + " <col width="640">\n" - + " </colgroup>\n"); + + "<colgroup>\n" + + "<col width="160">\n" + + "<col width="640">\n" + + "</colgroup>\n"); if (this.downloadedVotes.size() < 1) { - this.bw.write(" <tr><td>(No votes.)</td><td></td></tr>\n"); + this.bw.write("<tr><td>(No votes.)</td><td></td></tr>\n"); } else { for (RelayNetworkStatusVote vote : this.downloadedVotes.values()) { int bandwidthWeights = 0; @@ -544,24 +544,24 @@ public class MetricsWebsiteReport { } } if (bandwidthWeights > 0) { - this.bw.write(" <tr>\n" - + " <td>" + vote.getNickname() + "</td>\n" - + " <td>" + bandwidthWeights + this.bw.write("<tr>\n" + + "<td>" + vote.getNickname() + "</td>\n" + + "<td>" + bandwidthWeights + " Measured values in w lines</td>\n" - + " </tr>\n"); + + "</tr>\n"); } } } - this.bw.write(" </table>\n"); + this.bw.write("</table>\n"); }
/* Write directory authority versions. */ private void writeAuthorityVersions() throws IOException { - this.bw.write(" <br>\n" - + " <a name="authorityversions">\n" - + " <h3><a href="#authorityversions" class="anchor">" - + "Authority versions</a></h3>\n" - + " <br>\n"); + this.bw.write("<br>\n" + + "<a name="authorityversions">\n" + + "<h3><a href="#authorityversions" class="anchor">" + + "Authority versions</a></h3>\n" + + "<br>\n"); SortedMap<String, String> authorityVersions = new TreeMap<String, String>(); for (NetworkStatusEntry entry : @@ -571,26 +571,26 @@ public class MetricsWebsiteReport { } } if (authorityVersions.size() < 1) { - this.bw.write(" <p>(No relays with Authority flag found.)" + this.bw.write("<p>(No relays with Authority flag found.)" + "</p>\n"); } else { - this.bw.write(" <table border="0" cellpadding="4" " + this.bw.write("<table border="0" cellpadding="4" " + "cellspacing="0" summary="">\n" - + " <colgroup>\n" - + " <col width="160">\n" - + " <col width="640">\n" - + " </colgroup>\n"); + + "<colgroup>\n" + + "<col width="160">\n" + + "<col width="640">\n" + + "</colgroup>\n"); for (Map.Entry<String, String> e : authorityVersions.entrySet()) { String nickname = e.getKey(); String versionString = e.getValue(); - this.bw.write(" <tr>\n" - + " <td>" + nickname + "</td>\n" - + " <td>" + versionString + "</td>\n" - + " </tr>\n"); + this.bw.write("<tr>\n" + + "<td>" + nickname + "</td>\n" + + "<td>" + versionString + "</td>\n" + + "</tr>\n"); } - this.bw.write(" </table>\n" - + " <br>\n" - + " <p><i>Note that this list of relays with the " + this.bw.write("</table>\n" + + "<br>\n" + + "<p><i>Note that this list of relays with the " + "Authority flag may be different from the list of v3 " + "directory authorities!</i></p>\n"); } @@ -604,26 +604,26 @@ public class MetricsWebsiteReport { if (knownAuthorities.isEmpty()) { return; } - this.bw.write(" <br>\n" - + " <a name="downloadstats">\n" - + " <h3><a href="#downloadstats" class="anchor">" - + "Consensus download statistics</a></h3>\n" - + " <br>\n" - + " <p>The following table contains statistics on " + this.bw.write("<br>\n" + + "<a name="downloadstats">\n" + + "<h3><a href="#downloadstats" class="anchor">" + + "Consensus download statistics</a></h3>\n" + + "<br>\n" + + "<p>The following table contains statistics on " + "consensus download times in milliseconds over the last 7 " + "days:</p>\n" - + " <table border="0" cellpadding="4" " - + "cellspacing="0" summary="">\n" - + " <colgroup>\n" - + " <col width="160">\n" - + " <col width="100">\n" - + " <col width="100">\n" - + " <col width="100">\n" - + " <col width="100">\n" - + " <col width="100">\n" - + " <col width="100">\n" - + " </colgroup>\n" - + " <tr><th>Authority</th>" + + "<table border="0" cellpadding="4" " + + "cellspacing="0" summary="">\n" + + "<colgroup>\n" + + "<col width="160">\n" + + "<col width="100">\n" + + "<col width="100">\n" + + "<col width="100">\n" + + "<col width="100">\n" + + "<col width="100">\n" + + "<col width="100">\n" + + "</colgroup>\n" + + "<tr><th>Authority</th>" + "<th>Minimum</th>" + "<th>1st Quartile</th>" + "<th>Median</th>" @@ -631,62 +631,62 @@ public class MetricsWebsiteReport { + "<th>Maximum</th>" + "<th>Timeouts</th></tr>\n"); for (String authority : knownAuthorities) { - this.bw.write(" <tr>\n" - + " <td>" + authority + "</td>\n" - + " <td>" + this.bw.write("<tr>\n" + + "<td>" + authority + "</td>\n" + + "<td>" + this.statistics.getPercentile(authority, 0) + "</td>" - + " <td>" + + "<td>" + this.statistics.getPercentile(authority, 25) + "</td>" - + " <td>" + + "<td>" + this.statistics.getPercentile(authority, 50) + "</td>" - + " <td>" + + "<td>" + this.statistics.getPercentile(authority, 75) + "</td>" - + " <td>" + + "<td>" + this.statistics.getPercentile(authority, 100) + "</td>" - + " <td>" + + "<td>" + this.statistics.getNAs(authority) + "</td></tr>\n"); } - this.bw.write(" </table>\n"); + this.bw.write("</table>\n"); }
/* Write the (huge) table containing relay flags contained in votes and * the consensus for each relay. */ private void writeRelayFlagsTable() throws IOException { - this.bw.write(" <br>\n" - + " <a name="relayflags">\n" - + " <h3><a href="#relayflags" class="anchor">Relay " + this.bw.write("<br>\n" + + "<a name="relayflags">\n" + + "<h3><a href="#relayflags" class="anchor">Relay " + "flags</a></h3>\n" - + " <br>\n" - + " <p>The semantics of flags written in the table is " + + "<br>\n" + + "<p>The semantics of flags written in the table is " + "similar to the table above:</p>\n" - + " <ul>\n" - + " <li><b>In vote and consensus:</b> Flag in vote " + + "<ul>\n" + + "<li><b>In vote and consensus:</b> Flag in vote " + "matches flag in consensus, or relay is not listed in " + "consensus (because it doesn't have the Running " + "flag)</li>\n" - + " <li><b><span class="oiv">Only in " + + "<li><b><span class="oiv">Only in " + "vote:</span></b> Flag in vote, but missing in the " + "consensus, because there was no majority for the flag or " + "the flag was invalidated (e.g., Named gets invalidated by " + "Unnamed)</li>\n" - + " <li><b><span class="oic">Only in " + + "<li><b><span class="oic">Only in " + "consensus:</span></b> Flag in consensus, but missing " + "in a vote of a directory authority voting on this " + "flag</li>\n" - + " <li><b><span class="ic">In " + + "<li><b><span class="ic">In " + "consensus:</span></b> Flag in consensus</li>\n" - + " </ul>\n" - + " <br>\n" - + " <table border="0" cellpadding="4" " + + "</ul>\n" + + "<br>\n" + + "<table border="0" cellpadding="4" " + "cellspacing="0" summary="">\n" - + " <colgroup>\n" - + " <col width="120">\n" - + " <col width="80">\n"); + + "<colgroup>\n" + + "<col width="120">\n" + + "<col width="80">\n"); for (int i = 0; i < this.downloadedVotes.size(); i++) { - this.bw.write(" <col width="" + this.bw.write( "<col width="" + (640 / this.downloadedVotes.size()) + "">\n"); } - this.bw.write(" </colgroup>\n"); + this.bw.write( "</colgroup>\n"); SortedMap<String, String> allRelays = new TreeMap<String, String>(); for (RelayNetworkStatusVote vote : this.downloadedVotes.values()) { for (NetworkStatusEntry statusEntry : @@ -709,37 +709,37 @@ public class MetricsWebsiteReport { String nickname = e.getValue(); this.writeRelayFlagsTableRow(fingerprint, nickname); } - this.bw.write(" </table>\n"); + this.bw.write("</table>\n"); }
/* Write the table header that is repeated every ten relays and that * contains the directory authority names. */ private void writeRelayFlagsTableHeader() throws IOException { - this.bw.write(" <tr class="tbl-hdr"><th>Fingerprint</th>" - + "<th>Nickname</th>\n"); + this.bw.write( "<tr class="tbl-hdr"><th>Fingerprint</th>" + + "<th>Nickname</th>\n"); for (RelayNetworkStatusVote vote : this.downloadedVotes.values()) { String shortDirName = vote.getNickname().length() > 6 ? vote.getNickname().substring(0, 5) + "." : vote.getNickname(); - this.bw.write("<th>" + shortDirName + "</th>"); + this.bw.write( "<th>" + shortDirName + "</th>"); } - this.bw.write("<th>consensus</th></tr>\n"); + this.bw.write( "<th>consensus</th></tr>\n"); }
/* Write a single row in the table of relay flags. */ private void writeRelayFlagsTableRow(String fingerprint, String nickname) throws IOException { - this.bw.write(" <tr>\n"); + this.bw.write( "<tr>\n"); if (this.downloadedConsensus.containsStatusEntry(fingerprint) && this.downloadedConsensus.getStatusEntry(fingerprint).getFlags(). contains("Named") && !Character.isDigit(nickname.charAt(0))) { - this.bw.write(" <td id="" + nickname + "">" + this.bw.write( "<td id="" + nickname + "">" + fingerprint.substring(0, 8) + "</td>\n"); } else { - this.bw.write(" <td>" + this.bw.write( "<td>" + fingerprint.substring(0, 8) + "</td>\n"); } - this.bw.write(" <td>" + nickname + "</td>\n"); + this.bw.write( "<td>" + nickname + "</td>\n"); SortedSet<String> relevantFlags = new TreeSet<String>(); for (RelayNetworkStatusVote vote : this.downloadedVotes.values()) { if (vote.containsStatusEntry(fingerprint)) { @@ -756,7 +756,7 @@ public class MetricsWebsiteReport { if (vote.containsStatusEntry(fingerprint)) { SortedSet<String> flags = vote.getStatusEntry(fingerprint). getFlags(); - this.bw.write(" <td>"); + this.bw.write("<td>"); int flagsWritten = 0; for (String flag : relevantFlags) { this.bw.write(flagsWritten++ > 0 ? "<br>" : ""); @@ -770,17 +770,17 @@ public class MetricsWebsiteReport { } else if (consensusFlags != null && vote.getKnownFlags().contains(flag) && consensusFlags.contains(flag)) { - this.bw.write("<span class="oic">" + flag + this.bw.write( "<span class="oic">" + flag + "</span>"); } } this.bw.write("</td>\n"); } else { - this.bw.write(" <td></td>\n"); + this.bw.write("<td></td>\n"); } } if (consensusFlags != null) { - this.bw.write(" <td class="ic">"); + this.bw.write( "<td class="ic">"); int flagsWritten = 0; for (String flag : relevantFlags) { this.bw.write(flagsWritten++ > 0 ? "<br>" : ""); @@ -788,46 +788,46 @@ public class MetricsWebsiteReport { this.bw.write(flag); } } - this.bw.write("</td>\n"); + this.bw.write( "</td>\n"); } else { - this.bw.write(" <td></td>\n"); + this.bw.write( "<td></td>\n"); } - this.bw.write(" </tr>\n"); + this.bw.write( "</tr>\n"); }
/* Write the relay flag summary. */ private void writeRelayFlagsSummary() throws IOException { - this.bw.write(" <br>\n" - + " <a name="overlap">\n" - + " <h3><a href="#overlap" class="anchor">Overlap " + this.bw.write("<br>\n" + + "<a name="overlap">\n" + + "<h3><a href="#overlap" class="anchor">Overlap " + "between votes and consensus</a></h3>\n" - + " <br>\n" - + " <p>The semantics of columns is as follows:</p>\n" - + " <ul>\n" - + " <li><b>In vote and consensus:</b> Flag in vote " + + "<br>\n" + + "<p>The semantics of columns is as follows:</p>\n" + + "<ul>\n" + + "<li><b>In vote and consensus:</b> Flag in vote " + "matches flag in consensus, or relay is not listed in " + "consensus (because it doesn't have the Running " + "flag)</li>\n" - + " <li><b><span class="oiv">Only in " + + "<li><b><span class="oiv">Only in " + "vote:</span></b> Flag in vote, but missing in the " + "consensus, because there was no majority for the flag or " + "the flag was invalidated (e.g., Named gets invalidated by " + "Unnamed)</li>\n" - + " <li><b><span class="oic">Only in " + + "<li><b><span class="oic">Only in " + "consensus:</span></b> Flag in consensus, but missing " + "in a vote of a directory authority voting on this " + "flag</li>\n" - + " </ul>\n" - + " <br>\n" - + " <table border="0" cellpadding="4" " - + "cellspacing="0" summary="">\n" - + " <colgroup>\n" - + " <col width="160">\n" - + " <col width="210">\n" - + " <col width="210">\n" - + " <col width="210">\n" - + " </colgroup>\n" - + " <tr><td></td><td><b>Only in vote</b></td>" + + "</ul>\n" + + "<br>\n" + + "<table border="0" cellpadding="4" " + + "cellspacing="0" summary="">\n" + + "<colgroup>\n" + + "<col width="160">\n" + + "<col width="210">\n" + + "<col width="210">\n" + + "<col width="210">\n" + + "</colgroup>\n" + + "<tr><td></td><td><b>Only in vote</b></td>" + "<td><b>In vote and consensus</b></td>" + "<td><b>Only in consensus</b></td>\n"); Set<String> allFingerprints = new HashSet<String>(); @@ -885,51 +885,51 @@ public class MetricsWebsiteReport { String dir = vote.getNickname(); int i = 0; for (String flag : vote.getKnownFlags()) { - this.bw.write(" <tr>\n" - + " <td>" + (i++ == 0 ? dir : "") + this.bw.write("<tr>\n" + + "<td>" + (i++ == 0 ? dir : "") + "</td>\n"); if (flagsLost.containsKey(dir) && flagsLost.get(dir).containsKey(flag)) { - this.bw.write(" <td><span class="oiv"> " + this.bw.write("<td><span class="oiv"> " + flagsLost.get(dir).get(flag) + " " + flag + "</span></td>\n"); } else { - this.bw.write(" <td></td>\n"); + this.bw.write("<td></td>\n"); } if (flagsAgree.containsKey(dir) && flagsAgree.get(dir).containsKey(flag)) { - this.bw.write(" <td>" + flagsAgree.get(dir).get(flag) + this.bw.write("<td>" + flagsAgree.get(dir).get(flag) + " " + flag + "</td>\n"); } else { - this.bw.write(" <td></td>\n"); + this.bw.write("<td></td>\n"); } if (flagsMissing.containsKey(dir) && flagsMissing.get(dir).containsKey(flag)) { - this.bw.write(" <td><span class="oic">" + this.bw.write("<td><span class="oic">" + flagsMissing.get(dir).get(flag) + " " + flag + "</span></td>\n"); } else { - this.bw.write(" <td></td>\n"); + this.bw.write("<td></td>\n"); } - this.bw.write(" </tr>\n"); + this.bw.write("</tr>\n"); } } - this.bw.write(" </table>\n"); + this.bw.write("</table>\n"); }
/* Write the footer of the HTML page containing the blurb that is on * every page of the metrics website. */ private void writePageFooter() throws IOException { - this.bw.write(" </div>\n" - + " </div>\n" - + " <div class="bottom" id="bottom">\n" - + " <p>"Tor" and the "Onion Logo" are <a " + this.bw.write("</div>\n" + + "</div>\n" + + "<div class="bottom" id="bottom">\n" + + "<p>"Tor" and the "Onion Logo" are <a " + "href="https://www.torproject.org/docs/trademark-faq.html" + ".en">" - + "registered trademarks</a> of The Tor Project, " + + "registered trademarks</a> of The Tor Project, " + "Inc.</p>\n" - + " </div>\n" - + " </body>\n" + + "</div>\n" + + "</body>\n" + "</html>"); } }
tor-commits@lists.torproject.org