tor-commits
Threads by month
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
August 2017
- 17 participants
- 1133 discussions
[onionoo/release] Add version parameter to filter for Tor version.
by karsten@torproject.org 31 Aug '17
by karsten@torproject.org 31 Aug '17
31 Aug '17
commit 249c8549c0536e7c8e71b5f7f500f81b2f203e6d
Author: Karsten Loesing <karsten.loesing(a)gmx.net>
Date: Mon Aug 7 23:06:36 2017 +0200
Add version parameter to filter for Tor version.
Implements #21427.
Requires minor protocol update.
---
.../org/torproject/onionoo/docs/DocumentStore.java | 3 +-
.../org/torproject/onionoo/docs/NodeStatus.java | 14 +++++
.../torproject/onionoo/docs/SummaryDocument.java | 13 +++-
.../org/torproject/onionoo/server/NodeIndex.java | 10 +++
.../org/torproject/onionoo/server/NodeIndexer.java | 8 +++
.../torproject/onionoo/server/RequestHandler.java | 26 ++++++++
.../torproject/onionoo/server/ResourceServlet.java | 24 +++++++-
.../onionoo/updater/NodeDetailsStatusUpdater.java | 2 +
.../onionoo/writer/SummaryDocumentWriter.java | 3 +-
.../onionoo/docs/SummaryDocumentTest.java | 2 +-
.../onionoo/server/ResourceServletTest.java | 72 +++++++++++++++++++---
.../server/SummaryDocumentComparatorTest.java | 2 +-
12 files changed, 166 insertions(+), 13 deletions(-)
diff --git a/src/main/java/org/torproject/onionoo/docs/DocumentStore.java b/src/main/java/org/torproject/onionoo/docs/DocumentStore.java
index 56ca406..7819d0f 100644
--- a/src/main/java/org/torproject/onionoo/docs/DocumentStore.java
+++ b/src/main/java/org/torproject/onionoo/docs/DocumentStore.java
@@ -435,13 +435,14 @@ public class DocumentStore {
}
SortedSet<String> relayFlags = new TreeSet<>();
SortedSet<String> family = null;
+ String version = null;
long lastSeenMillis = -1L;
long consensusWeight = -1L;
long firstSeenMillis = -1L;
SummaryDocument summaryDocument = new SummaryDocument(isRelay,
nickname, fingerprint, addresses, lastSeenMillis, running,
relayFlags, consensusWeight, countryCode, firstSeenMillis,
- asNumber, contact, family, family);
+ asNumber, contact, family, family, version);
return summaryDocument;
}
diff --git a/src/main/java/org/torproject/onionoo/docs/NodeStatus.java b/src/main/java/org/torproject/onionoo/docs/NodeStatus.java
index 6a71fb6..759d83e 100644
--- a/src/main/java/org/torproject/onionoo/docs/NodeStatus.java
+++ b/src/main/java/org/torproject/onionoo/docs/NodeStatus.java
@@ -321,6 +321,16 @@ public class NodeStatus extends Document {
return this.recommendedVersion;
}
+ private String version;
+
+ public void setVersion(String version) {
+ this.version = version.substring(version.lastIndexOf(" ") + 1);
+ }
+
+ public String getVersion() {
+ return this.version;
+ }
+
/* From exit lists: */
private SortedSet<String> exitAddresses;
@@ -547,6 +557,9 @@ public class NodeStatus extends Document {
extendedFamily.addAll(indirectFamily);
nodeStatus.setExtendedFamily(extendedFamily);
}
+ if (parts.length >= 24 && !parts[23].isEmpty()) {
+ nodeStatus.setVersion(parts[23]);
+ }
return nodeStatus;
} catch (NumberFormatException e) {
log.error("Number format exception while parsing node "
@@ -610,6 +623,7 @@ public class NodeStatus extends Document {
sb.append("\t" + StringUtils.join(this.getAllegedFamily(), ";") + ":"
+ StringUtils.join(this.getEffectiveFamily(), ";") + ":"
+ StringUtils.join(this.getIndirectFamily(), ";"));
+ sb.append("\t" + (this.getVersion() != null ? this.getVersion() : ""));
return sb.toString();
}
}
diff --git a/src/main/java/org/torproject/onionoo/docs/SummaryDocument.java b/src/main/java/org/torproject/onionoo/docs/SummaryDocument.java
index 3ca4960..527f91d 100644
--- a/src/main/java/org/torproject/onionoo/docs/SummaryDocument.java
+++ b/src/main/java/org/torproject/onionoo/docs/SummaryDocument.java
@@ -269,6 +269,16 @@ public class SummaryDocument extends Document {
return this.stringArrayToSortedSet(this.ef);
}
+ private String v;
+
+ public void setVersion(String version) {
+ this.v = version;
+ }
+
+ public String getVersion() {
+ return this.v;
+ }
+
/* The familyFingerprints parameter can go away after September 8, 2015.
* See above. */
/** Instantiates a summary document with all given properties. */
@@ -277,7 +287,7 @@ public class SummaryDocument extends Document {
boolean running, SortedSet<String> relayFlags, long consensusWeight,
String countryCode, long firstSeenMillis, String asNumber,
String contact, SortedSet<String> familyFingerprints,
- SortedSet<String> effectiveFamily) {
+ SortedSet<String> effectiveFamily, String version) {
this.setRelay(isRelay);
this.setNickname(nickname);
this.setFingerprint(fingerprint);
@@ -292,6 +302,7 @@ public class SummaryDocument extends Document {
this.setContact(contact);
this.setFamilyFingerprints(familyFingerprints);
this.setEffectiveFamily(effectiveFamily);
+ this.setVersion(version);
}
}
diff --git a/src/main/java/org/torproject/onionoo/server/NodeIndex.java b/src/main/java/org/torproject/onionoo/server/NodeIndex.java
index 439d302..dd4bd4d 100644
--- a/src/main/java/org/torproject/onionoo/server/NodeIndex.java
+++ b/src/main/java/org/torproject/onionoo/server/NodeIndex.java
@@ -169,5 +169,15 @@ class NodeIndex {
public SortedMap<Integer, Set<String>> getBridgesByLastSeenDays() {
return bridgesByLastSeenDays;
}
+
+ private Map<String, Set<String>> relaysByVersion;
+
+ public void setRelaysByVersion(Map<String, Set<String>> relaysByVersion) {
+ this.relaysByVersion = relaysByVersion;
+ }
+
+ public Map<String, Set<String>> getRelaysByVersion() {
+ return this.relaysByVersion;
+ }
}
diff --git a/src/main/java/org/torproject/onionoo/server/NodeIndexer.java b/src/main/java/org/torproject/onionoo/server/NodeIndexer.java
index f6b9510..7ed9ea6 100644
--- a/src/main/java/org/torproject/onionoo/server/NodeIndexer.java
+++ b/src/main/java/org/torproject/onionoo/server/NodeIndexer.java
@@ -150,6 +150,7 @@ public class NodeIndexer implements ServletContextListener, Runnable {
Map<String, Set<String>> newBridgesByFlag = new HashMap<>();
Map<String, Set<String>> newRelaysByContact = new HashMap<>();
Map<String, Set<String>> newRelaysByFamily = new HashMap<>();
+ Map<String, Set<String>> newRelaysByVersion = new HashMap<>();
SortedMap<Integer, Set<String>> newRelaysByFirstSeenDays = new TreeMap<>();
SortedMap<Integer, Set<String>> newBridgesByFirstSeenDays = new TreeMap<>();
SortedMap<Integer, Set<String>> newRelaysByLastSeenDays = new TreeMap<>();
@@ -246,6 +247,12 @@ public class NodeIndexer implements ServletContextListener, Runnable {
}
newRelaysByContact.get(contact).add(fingerprint);
newRelaysByContact.get(contact).add(hashedFingerprint);
+ String version = entry.getVersion();
+ if (!newRelaysByVersion.containsKey(version)) {
+ newRelaysByVersion.put(version, new HashSet<String>());
+ }
+ newRelaysByVersion.get(version).add(fingerprint);
+ newRelaysByVersion.get(version).add(hashedFingerprint);
}
/* This loop can go away once all Onionoo services had their hourly
* updater write effective families to summary documents at least
@@ -319,6 +326,7 @@ public class NodeIndexer implements ServletContextListener, Runnable {
newNodeIndex.setBridgesByLastSeenDays(newBridgesByLastSeenDays);
newNodeIndex.setRelaysPublishedMillis(relaysLastValidAfterMillis);
newNodeIndex.setBridgesPublishedMillis(bridgesLastPublishedMillis);
+ newNodeIndex.setRelaysByVersion(newRelaysByVersion);
synchronized (this) {
this.lastIndexed = updateStatusMillis;
this.latestNodeIndex = newNodeIndex;
diff --git a/src/main/java/org/torproject/onionoo/server/RequestHandler.java b/src/main/java/org/torproject/onionoo/server/RequestHandler.java
index 98ece58..1e08c24 100644
--- a/src/main/java/org/torproject/onionoo/server/RequestHandler.java
+++ b/src/main/java/org/torproject/onionoo/server/RequestHandler.java
@@ -7,6 +7,9 @@ import org.torproject.onionoo.docs.DocumentStore;
import org.torproject.onionoo.docs.DocumentStoreFactory;
import org.torproject.onionoo.docs.SummaryDocument;
+import java.io.BufferedWriter;
+import java.io.FileWriter;
+import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
@@ -91,6 +94,12 @@ public class RequestHandler {
System.arraycopy(contact, 0, this.contact, 0, contact.length);
}
+ private String version;
+
+ public void setVersion(String version) {
+ this.version = version;
+ }
+
private String[] order;
public void setOrder(String[] order) {
@@ -158,6 +167,7 @@ public class RequestHandler {
this.filterNodesByLastSeenDays();
this.filterByContact();
this.filterByFamily();
+ this.filterByVersion();
this.order();
this.offset();
this.limit();
@@ -514,6 +524,22 @@ public class RequestHandler {
this.filteredBridges.clear();
}
+ private void filterByVersion() {
+ if (null == this.version) {
+ /* Not filtering by version. */
+ return;
+ }
+ Set<String> keepRelays = new HashSet<>();
+ for (Map.Entry<String, Set<String>> e
+ : this.nodeIndex.getRelaysByVersion().entrySet()) {
+ if (e.getKey().startsWith(this.version)) {
+ keepRelays.addAll(e.getValue());
+ }
+ }
+ this.filteredRelays.keySet().retainAll(keepRelays);
+ this.filteredBridges.clear();
+ }
+
private void order() {
List<SummaryDocument> uniqueRelays = new ArrayList<>();
List<SummaryDocument> uniqueBridges = new ArrayList<>();
diff --git a/src/main/java/org/torproject/onionoo/server/ResourceServlet.java b/src/main/java/org/torproject/onionoo/server/ResourceServlet.java
index 869574c..164b770 100644
--- a/src/main/java/org/torproject/onionoo/server/ResourceServlet.java
+++ b/src/main/java/org/torproject/onionoo/server/ResourceServlet.java
@@ -3,6 +3,8 @@
package org.torproject.onionoo.server;
+import java.io.BufferedWriter;
+import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
@@ -66,7 +68,7 @@ public class ResourceServlet extends HttpServlet {
private static Set<String> knownParameters = new HashSet<>(
Arrays.asList(("type,running,search,lookup,fingerprint,country,as,"
+ "flag,first_seen_days,last_seen_days,contact,order,limit,"
- + "offset,fields,family").split(",")));
+ + "offset,fields,family,version").split(",")));
private static Set<String> illegalSearchQualifiers =
new HashSet<>(Arrays.asList(("search,fingerprint,order,limit,"
@@ -275,6 +277,15 @@ public class ResourceServlet extends HttpServlet {
}
rh.setContact(contactParts);
}
+ if (parameterMap.containsKey("version")) {
+ String versionParameter = this.parseVersionParameter(
+ parameterMap.get("version"));
+ if (null == versionParameter) {
+ response.sendError(HttpServletResponse.SC_BAD_REQUEST);
+ return;
+ }
+ rh.setVersion(versionParameter);
+ }
if (parameterMap.containsKey("order")) {
String[] order = this.parseOrderParameter(parameterMap.get("order"));
if (order == null) {
@@ -532,5 +543,16 @@ public class ResourceServlet extends HttpServlet {
}
return parameter.toLowerCase().split(",");
}
+
+ private static Pattern versionParameterPattern =
+ Pattern.compile("^[0-9a-zA-Z\\.-]+$");
+
+ private String parseVersionParameter(String parameter) {
+ if (!versionParameterPattern.matcher(parameter).matches()) {
+ /* Version contains illegal character(s). */
+ return null;
+ }
+ return parameter;
+ }
}
diff --git a/src/main/java/org/torproject/onionoo/updater/NodeDetailsStatusUpdater.java b/src/main/java/org/torproject/onionoo/updater/NodeDetailsStatusUpdater.java
index cc50f4b..9fcff35 100644
--- a/src/main/java/org/torproject/onionoo/updater/NodeDetailsStatusUpdater.java
+++ b/src/main/java/org/torproject/onionoo/updater/NodeDetailsStatusUpdater.java
@@ -283,6 +283,7 @@ public class NodeDetailsStatusUpdater implements DescriptorListener,
nodeStatus.setRecommendedVersion((recommendedVersions == null
|| entry.getVersion() == null) ? null :
recommendedVersions.contains(entry.getVersion()));
+ nodeStatus.setVersion(entry.getVersion());
}
if (entry.getUnmeasured()) {
if (!this.lastSeenUnmeasured.containsKey(fingerprint)
@@ -484,6 +485,7 @@ public class NodeDetailsStatusUpdater implements DescriptorListener,
updatedNodeStatus.setAsNumber(nodeStatus.getAsNumber());
updatedNodeStatus.setRecommendedVersion(
nodeStatus.getRecommendedVersion());
+ updatedNodeStatus.setVersion(nodeStatus.getVersion());
}
if (nodeStatus.getFirstSeenMillis()
< updatedNodeStatus.getFirstSeenMillis()
diff --git a/src/main/java/org/torproject/onionoo/writer/SummaryDocumentWriter.java b/src/main/java/org/torproject/onionoo/writer/SummaryDocumentWriter.java
index b2f678d..4364aad 100644
--- a/src/main/java/org/torproject/onionoo/writer/SummaryDocumentWriter.java
+++ b/src/main/java/org/torproject/onionoo/writer/SummaryDocumentWriter.java
@@ -91,10 +91,11 @@ public class SummaryDocumentWriter implements DocumentWriter {
SortedSet<String> declaredFamily = nodeStatus.getDeclaredFamily();
SortedSet<String> effectiveFamily = nodeStatus.getEffectiveFamily();
String nickname = nodeStatus.getNickname();
+ String version = nodeStatus.getVersion();
SummaryDocument summaryDocument = new SummaryDocument(isRelay,
nickname, fingerprint, addresses, lastSeenMillis, running,
relayFlags, consensusWeight, countryCode, firstSeenMillis,
- asNumber, contact, declaredFamily, effectiveFamily);
+ asNumber, contact, declaredFamily, effectiveFamily, version);
if (this.documentStore.store(summaryDocument, fingerprint)) {
this.writtenDocuments++;
}
diff --git a/src/test/java/org/torproject/onionoo/docs/SummaryDocumentTest.java b/src/test/java/org/torproject/onionoo/docs/SummaryDocumentTest.java
index 413ca83..9d7625a 100644
--- a/src/test/java/org/torproject/onionoo/docs/SummaryDocumentTest.java
+++ b/src/test/java/org/torproject/onionoo/docs/SummaryDocumentTest.java
@@ -26,7 +26,7 @@ public class SummaryDocumentTest {
new String[] { "001C13B3A55A71B977CA65EC85539D79C653A3FC",
"0025C136C1F3A9EEFE2AE3F918F03BFA21B5070B" })),
new TreeSet<>(Arrays.asList(
- new String[] { "001C13B3A55A71B977CA65EC85539D79C653A3FC" })));
+ new String[] { "001C13B3A55A71B977CA65EC85539D79C653A3FC" })), null);
}
@Test()
diff --git a/src/test/java/org/torproject/onionoo/server/ResourceServletTest.java b/src/test/java/org/torproject/onionoo/server/ResourceServletTest.java
index 04c5d7d..4ebf0d2 100644
--- a/src/test/java/org/torproject/onionoo/server/ResourceServletTest.java
+++ b/src/test/java/org/torproject/onionoo/server/ResourceServletTest.java
@@ -142,7 +142,8 @@ public class ResourceServletTest {
new String[] { "001C13B3A55A71B977CA65EC85539D79C653A3FC",
"0025C136C1F3A9EEFE2AE3F918F03BFA21B5070B" })),
new TreeSet<>(Arrays.asList(
- new String[] { "001C13B3A55A71B977CA65EC85539D79C653A3FC" })));
+ new String[] { "001C13B3A55A71B977CA65EC85539D79C653A3FC" })),
+ "0.2.3.25");
org.torproject.onionoo.docs.SummaryDocument relayFerrari458 =
new org.torproject.onionoo.docs.SummaryDocument(true, "Ferrari458",
"001C13B3A55A71B977CA65EC85539D79C653A3FC", Arrays.asList(
@@ -154,7 +155,7 @@ public class ResourceServletTest {
new TreeSet<String>(Arrays.asList(new String[] {
"000C5F55BD4814B917CC474BD537F1A3B33CCE2A" })),
new TreeSet<>(Arrays.asList(new String[] {
- "000C5F55BD4814B917CC474BD537F1A3B33CCE2A" })));
+ "000C5F55BD4814B917CC474BD537F1A3B33CCE2A" })), "0.2.3.24-rc-dev");
this.relays = new TreeMap<>();
this.relays.put("000C5F55BD4814B917CC474BD537F1A3B33CCE2A",
relayTorkaZ);
@@ -170,7 +171,7 @@ public class ResourceServletTest {
DateTimeHelper.parse("2013-04-16 18:00:00"), "AS6830",
"1024D/51E2A1C7 steven j. murdoch "
+ "<tor+steven.murdoch(a)cl.cam.ac.uk> <fb-token:5sr_k_zs2wm=>",
- new TreeSet<String>(), new TreeSet<String>());
+ new TreeSet<String>(), new TreeSet<String>(), "0.2.3.25");
this.relays.put("0025C136C1F3A9EEFE2AE3F918F03BFA21B5070B",
relayTimMayTribute);
this.bridges = new TreeMap<>();
@@ -181,7 +182,7 @@ public class ResourceServletTest {
DateTimeHelper.parse("2013-04-21 18:07:03"), false,
new TreeSet<>(Arrays.asList(new String[] { "Valid" })), -1L,
null, DateTimeHelper.parse("2013-04-20 15:37:04"), null, null,
- null, null);
+ null, null, null);
this.bridges.put("0000831B236DFF73D409AD17B40E2A728A53994F",
bridgeec2bridgercc7f31fe);
org.torproject.onionoo.docs.SummaryDocument bridgeUnnamed =
@@ -191,7 +192,7 @@ public class ResourceServletTest {
DateTimeHelper.parse("2013-04-20 17:37:04"), false,
new TreeSet<>(Arrays.asList(new String[] { "Valid" })), -1L,
null, DateTimeHelper.parse("2013-04-14 07:07:05"), null, null,
- null, null);
+ null, null, null);
this.bridges.put("0002D9BDBBC230BD9C78FF502A16E0033EF87E0C",
bridgeUnnamed);
org.torproject.onionoo.docs.SummaryDocument bridgegummy =
@@ -202,7 +203,7 @@ public class ResourceServletTest {
new TreeSet<>(Arrays.asList(new String[] { "Running",
"Valid" })), -1L, null,
DateTimeHelper.parse("2013-01-16 21:07:04"), null, null, null,
- null);
+ null, null);
this.bridges.put("1FEDE50ED8DBA1DD9F9165F78C8131E4A44AB756",
bridgegummy);
}
@@ -279,7 +280,8 @@ public class ResourceServletTest {
int expectedRelaysNumber, String[] expectedRelaysNicknames,
int expectedBridgesNumber, String[] expectedBridgesNicknames) {
this.runTest(request);
- assertNotNull(this.summaryDocument);
+ assertNotNull("Summary document is null, status code is "
+ + this.response.errorStatusCode, this.summaryDocument);
assertEquals(expectedRelaysNumber,
this.summaryDocument.relays.length);
if (expectedRelaysNicknames != null) {
@@ -1531,5 +1533,61 @@ public class ResourceServletTest {
this.assertErrorStatusCode(
"/summary?family=00000000000000000000000000000000000000", 400);
}
+
+ @Test
+ public void testVersion02325() {
+ this.assertSummaryDocument("/summary?version=0.2.3.25", 2,
+ new String[] { "TorkaZ", "TimMayTribute" }, 0, null);
+ }
+
+ @Test
+ public void testVersion02324() {
+ this.assertSummaryDocument("/summary?version=0.2.3.24-rc-dev", 1,
+ new String[] { "Ferrari458" }, 0, null);
+ }
+
+ @Test
+ public void testVersion12345() {
+ this.assertSummaryDocument("/summary?version=1.2.3.4.5", 0, null, 0, null);
+ }
+
+ @Test
+ public void testVersionBlaBlaBla() {
+ this.assertSummaryDocument("/summary?version=bla-bla-bla", 0, null, 0,
+ null);
+ }
+
+ @Test
+ public void testVersion0() {
+ this.assertSummaryDocument("/summary?version=0", 3, null, 0, null);
+ }
+
+ @Test
+ public void testVersion02() {
+ this.assertSummaryDocument("/summary?version=0.2", 3, null, 0, null);
+ }
+
+ @Test
+ public void testVersion023() {
+ this.assertSummaryDocument("/summary?version=0.2.3", 3, null, 0, null);
+ }
+
+ @Test
+ public void testVersion0232() {
+ /* This is correct when comparing strings. */
+ this.assertSummaryDocument("/summary?version=0.2.3.2", 3, null, 0, null);
+ }
+
+ @Test
+ public void testVersion023Dot() {
+ /* This is also correct when comparing strings. */
+ this.assertSummaryDocument("/summary?version=0.2.3.", 3, null, 0, null);
+ }
+
+ @Test
+ public void testVersionStart() {
+ /* This is also correct when comparing strings. */
+ this.assertErrorStatusCode("/summary?version=*", 400);
+ }
}
diff --git a/src/test/java/org/torproject/onionoo/server/SummaryDocumentComparatorTest.java b/src/test/java/org/torproject/onionoo/server/SummaryDocumentComparatorTest.java
index c1d909f..fb3f5b3 100644
--- a/src/test/java/org/torproject/onionoo/server/SummaryDocumentComparatorTest.java
+++ b/src/test/java/org/torproject/onionoo/server/SummaryDocumentComparatorTest.java
@@ -40,7 +40,7 @@ public class SummaryDocumentComparatorTest {
new String[] { "001C13B3A55A71B977CA65EC85539D79C653A3FC",
"0025C136C1F3A9EEFE2AE3F918F03BFA21B5070B" })),
new TreeSet<>(Arrays.asList(
- new String[] { "001C13B3A55A71B977CA65EC85539D79C653A3FC" })));
+ new String[] { "001C13B3A55A71B977CA65EC85539D79C653A3FC" })), null);
}
/** Some values for running all comparison types. */
1
0
commit b3bb600f3495603ea4f13e94d9b99556c0be9dc0
Author: Karsten Loesing <karsten.loesing(a)gmx.net>
Date: Wed Aug 30 22:35:48 2017 +0200
Prepare for 4.1-1.4.0 release.
---
CERT | 18 +++++++++---------
CHANGELOG.md | 6 +++---
build.xml | 2 +-
.../org/torproject/onionoo/server/ResponseBuilder.java | 2 +-
4 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/CERT b/CERT
index 6cc5a93..d94c0c3 100644
--- a/CERT
+++ b/CERT
@@ -1,8 +1,8 @@
-----BEGIN CERTIFICATE-----
-MIIDaTCCAlGgAwIBAgIEYQnM/zANBgkqhkiG9w0BAQsFADBlMQswCQYDVQQGEwJV
+MIIDaTCCAlGgAwIBAgIEZTniETANBgkqhkiG9w0BAQsFADBlMQswCQYDVQQGEwJV
UzELMAkGA1UECBMCV0ExEDAOBgNVBAcTB1NlYXR0bGUxHTAbBgNVBAoTFFRoZSBU
b3IgUHJvamVjdCwgSW5jMRgwFgYDVQQDEw9LYXJzdGVuIExvZXNpbmcwHhcNMTcw
-MTAyMTYzNTQ2WhcNMTcwNDAyMTYzNTQ2WjBlMQswCQYDVQQGEwJVUzELMAkGA1UE
+ODE3MTg1MDQ0WhcNMTcxMTE1MTg1MDQ0WjBlMQswCQYDVQQGEwJVUzELMAkGA1UE
CBMCV0ExEDAOBgNVBAcTB1NlYXR0bGUxHTAbBgNVBAoTFFRoZSBUb3IgUHJvamVj
dCwgSW5jMRgwFgYDVQQDEw9LYXJzdGVuIExvZXNpbmcwggEiMA0GCSqGSIb3DQEB
AQUAA4IBDwAwggEKAoIBAQChXn+IUp+o6G+k4ffxk3TkxZb3iXfiG7byNsG63olU
@@ -11,11 +11,11 @@ Qw+VAhKTcEIv4yiR0BWapQyR07pgmKirYVjN6s6ef8NJzUptpxLlaYJ3ZfQfc4aE
MXzScgaccwDFIWQ661lzLGCfeSxxa3Xy4wWsGwzNzLITYrrABcbg7yogLo2btNvD
oEwGL3/baQdhl0dra6biVCZr9ydn3Hg57S55pUU0rBY25id78zUO8xrfNHw54wwX
lOblGt75OOkahP/ZZSBxxoiknJ6y5VQV8y+noA4vigXFAgMBAAGjITAfMB0GA1Ud
-DgQWBBSeh60M+/wMYyYhlxtuff2Hk9n7bzANBgkqhkiG9w0BAQsFAAOCAQEAi2K5
-o3UnRBLdk9zkBEDbqPWxq8eiiIacbSoorspVlv4vqNO2UsTLc2sA4zZpY1L7Mkc6
-y7pcd1jFc6e9Wzt0agoIU9i3pyqkUx11ktE8a8CiVjDOns05GHe1DsLYcSLG8aJR
-2pNEFjZEndHTXGRKwxtTmHimsIIWiy8tYFkC7SkBQj+BnXBqzCbJPhRDpMdhyJmQ
-CLUhTTgU30G32x3vOhddWHAH8UDsXNlBASQOFs+A/1Mx5DI5AXLtwjp/rweTWoBk
-11SfkVS/mfMZNRGOA9DEfoRYHPT0Rn4URAQrBr73CKQaVVYyeuDOoEs69KRH2JSO
-IRcgAfpjtg8cry/eiw==
+DgQWBBSeh60M+/wMYyYhlxtuff2Hk9n7bzANBgkqhkiG9w0BAQsFAAOCAQEAbsAc
+gwl5KJH3pVKw4b+ACCOMgW+27MisCFbT1Izq2Wx+JcLMt3N//MoIpYOZWhsIeazW
+/NE0fNbkLi0IYA0F1nUC9pHl44Hd8Gjfqa/YQUi9ALtgsY7l6W0sceW8WnZ8bu8J
+DfrqnmB0bD2xc9ZjOn58al8dVjVWs95M87D9WCRU6LiaKFj5c45wciABQsTmC0qD
+pyHYOaSGtXxXKDw5pAntdtHkCbowV5tDi/QQ8Tg7i5O7xwSh71Q7TZiNFMpLomBL
+QllHfTZryFmoHyGn5MfngBUVCVHig5nXmk0dUMGuLiK4789dkgiPRz0vpB5Yf8Yy
+CCE2jB6VBi2g5fMx0w==
-----END CERTIFICATE-----
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 9538287..20ddb1c 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,4 +1,4 @@
-# Changes in version 4.1-1.?.? - 2017-0?-??
+# Changes in version 4.1-1.4.0 - 2017-08-30
* Medium changes
- Reset IPv6 exit-policy summary in details status if a newer
@@ -6,10 +6,10 @@
- Remove optional fields "countries", "transports", and "versions"
from clients objects which were still labeled as beta.
- Add new "version" parameter to filter for Tor version.
- - Switch from our own CollecTor downloader to metrics-lib's
- DescriptorCollector.
* Minor changes
+ - Switch from our own CollecTor downloader to metrics-lib's
+ DescriptorCollector.
- Add a new Java property "onionoo.basedir" to re-configure the
base directory used by the web server component.
diff --git a/build.xml b/build.xml
index 24010dd..41f11c0 100644
--- a/build.xml
+++ b/build.xml
@@ -10,7 +10,7 @@
<property name="implementation-title" value="Onionoo" />
<property name="onionoo.protocol.version" value="4.1"/>
<property name="release.version"
- value="${onionoo.protocol.version}-1.3.0-dev"/>
+ value="${onionoo.protocol.version}-1.4.0"/>
<property name="metricslibversion" value="2.0.0"/>
<property name="jetty.version" value="-9.2.21.v20170120" />
<property name="warfile"
diff --git a/src/main/java/org/torproject/onionoo/server/ResponseBuilder.java b/src/main/java/org/torproject/onionoo/server/ResponseBuilder.java
index c9cec32..efa02c3 100644
--- a/src/main/java/org/torproject/onionoo/server/ResponseBuilder.java
+++ b/src/main/java/org/torproject/onionoo/server/ResponseBuilder.java
@@ -102,7 +102,7 @@ public class ResponseBuilder {
return this.charsWritten;
}
- private static final String PROTOCOL_VERSION = "4.0";
+ private static final String PROTOCOL_VERSION = "4.1";
private static final String NEXT_MAJOR_VERSION_SCHEDULED = null;
1
0
31 Aug '17
commit 32992eea202770065b4cb61d4dc39bbee1b87628
Author: Karsten Loesing <karsten.loesing(a)gmx.net>
Date: Wed May 17 15:58:22 2017 +0200
Switch to metrics-lib's DescriptorCollector.
Implements #22287.
---
CHANGELOG.md | 2 +
.../onionoo/updater/DescriptorDownloader.java | 184 ---------------------
.../onionoo/updater/DescriptorSource.java | 41 ++---
3 files changed, 13 insertions(+), 214 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index bb38dd0..e028dd1 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -6,6 +6,8 @@
- Remove optional fields "countries", "transports", and "versions"
from clients objects which were still labeled as beta.
- Add new "version" parameter to filter for Tor version.
+ - Switch from our own CollecTor downloader to metrics-lib's
+ DescriptorCollector.
# Changes in version 4.0-1.3.0 - 2017-08-04
diff --git a/src/main/java/org/torproject/onionoo/updater/DescriptorDownloader.java b/src/main/java/org/torproject/onionoo/updater/DescriptorDownloader.java
deleted file mode 100644
index 1e41f25..0000000
--- a/src/main/java/org/torproject/onionoo/updater/DescriptorDownloader.java
+++ /dev/null
@@ -1,184 +0,0 @@
-/* Copyright 2016--2017 The Tor Project
- * See LICENSE for licensing information */
-
-package org.torproject.onionoo.updater;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.BufferedInputStream;
-import java.io.BufferedOutputStream;
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.net.HttpURLConnection;
-import java.net.URL;
-import java.util.SortedSet;
-import java.util.TreeSet;
-import java.util.zip.GZIPInputStream;
-
-class DescriptorDownloader {
-
- private static Logger log = LoggerFactory.getLogger(
- DescriptorDownloader.class);
-
- private final String protocolHostNameResourcePrefix =
- "https://collector.torproject.org/recent/";
-
- private String directory;
-
- private final File inDir = new File("in/recent");
-
- public DescriptorDownloader(DescriptorType descriptorType) {
- switch (descriptorType) {
- case RELAY_CONSENSUSES:
- this.directory = "relay-descriptors/consensuses/";
- break;
- case RELAY_SERVER_DESCRIPTORS:
- this.directory = "relay-descriptors/server-descriptors/";
- break;
- case RELAY_EXTRA_INFOS:
- this.directory = "relay-descriptors/extra-infos/";
- break;
- case EXIT_LISTS:
- this.directory = "exit-lists/";
- break;
- case BRIDGE_STATUSES:
- this.directory = "bridge-descriptors/statuses/";
- break;
- case BRIDGE_SERVER_DESCRIPTORS:
- this.directory = "bridge-descriptors/server-descriptors/";
- break;
- case BRIDGE_EXTRA_INFOS:
- this.directory = "bridge-descriptors/extra-infos/";
- break;
- default:
- log.error("Unknown descriptor type.");
- return;
- }
- }
-
- private SortedSet<String> localFiles = new TreeSet<>();
-
- public int statLocalFiles() {
- File localDirectory = new File(this.inDir, this.directory);
- if (localDirectory.exists()) {
- for (File file : localDirectory.listFiles()) {
- this.localFiles.add(file.getName());
- }
- }
- return this.localFiles.size();
- }
-
- private SortedSet<String> remoteFiles = new TreeSet<>();
-
- public int fetchRemoteDirectory() {
- String directoryUrl = this.protocolHostNameResourcePrefix
- + this.directory;
- try {
- URL url = new URL(directoryUrl);
- HttpURLConnection huc = (HttpURLConnection) url.openConnection();
- huc.setRequestMethod("GET");
- huc.connect();
- if (huc.getResponseCode() != 200) {
- log.error("Could not fetch " + directoryUrl
- + ": " + huc.getResponseCode() + " "
- + huc.getResponseMessage() + ". Skipping.");
- return 0;
- }
- try (BufferedReader br = new BufferedReader(new InputStreamReader(
- huc.getInputStream()))) {
- String line;
- while ((line = br.readLine()) != null) {
- if (!line.trim().startsWith("<tr>")
- || !line.contains("<a href=\"")) {
- continue;
- }
- String linePart = line.substring(
- line.indexOf("<a href=\"") + "<a href=\"".length());
- if (!linePart.contains("\"")) {
- continue;
- }
- linePart = linePart.substring(0, linePart.indexOf("\""));
- if (linePart.endsWith("/")) {
- continue;
- }
- this.remoteFiles.add(linePart);
- }
- }
- } catch (IOException e) {
- log.error("Could not fetch or parse " + directoryUrl
- + ". Skipping. Reason: " + e.getMessage());
- }
- return this.remoteFiles.size();
- }
-
- public int fetchRemoteFiles() {
- int fetchedFiles = 0;
- for (String remoteFile : this.remoteFiles) {
- if (this.localFiles.contains(remoteFile)) {
- continue;
- }
- String fileUrl = this.protocolHostNameResourcePrefix
- + this.directory + remoteFile;
- File localTempFile = new File(this.inDir, this.directory
- + remoteFile + ".tmp");
- File localFile = new File(this.inDir, this.directory + remoteFile);
- try {
- localFile.getParentFile().mkdirs();
- URL url = new URL(fileUrl);
- HttpURLConnection huc = (HttpURLConnection) url.openConnection();
- huc.setRequestMethod("GET");
- huc.addRequestProperty("Accept-Encoding", "gzip");
- huc.connect();
- if (huc.getResponseCode() != 200) {
- log.error("Could not fetch \n\t" + fileUrl
- + ": " + huc.getResponseCode() + " "
- + huc.getResponseMessage() + ". Skipping.");
- continue;
- }
- InputStream is;
- if (huc.getContentEncoding() != null
- && huc.getContentEncoding().equalsIgnoreCase("gzip")) {
- is = new GZIPInputStream(huc.getInputStream());
- } else {
- is = huc.getInputStream();
- }
- try (BufferedInputStream bis = new BufferedInputStream(is);
- BufferedOutputStream bos = new BufferedOutputStream(
- new FileOutputStream(localTempFile))) {
- int len;
- byte[] data = new byte[1024];
- while ((len = bis.read(data, 0, 1024)) >= 0) {
- bos.write(data, 0, len);
- }
- }
- localTempFile.renameTo(localFile);
- long lastModified = huc.getHeaderFieldDate("Last-Modified", -1L);
- if (lastModified >= 0) {
- localFile.setLastModified(lastModified);
- }
- fetchedFiles++;
- } catch (IOException e) {
- log.error("Could not fetch or store \n\t" + fileUrl
- + ". Skipping.\n\tReason: " + e.getMessage());
- }
- }
- return fetchedFiles;
- }
-
- public int deleteOldLocalFiles() {
- int deletedFiles = 0;
- for (String localFile : this.localFiles) {
- if (!this.remoteFiles.contains(localFile)) {
- new File(this.inDir, this.directory + localFile).delete();
- deletedFiles++;
- }
- }
- return deletedFiles;
- }
-}
-
diff --git a/src/main/java/org/torproject/onionoo/updater/DescriptorSource.java b/src/main/java/org/torproject/onionoo/updater/DescriptorSource.java
index 45b40ee..d32727f 100644
--- a/src/main/java/org/torproject/onionoo/updater/DescriptorSource.java
+++ b/src/main/java/org/torproject/onionoo/updater/DescriptorSource.java
@@ -4,6 +4,7 @@
package org.torproject.onionoo.updater;
import org.torproject.descriptor.Descriptor;
+import org.torproject.descriptor.DescriptorCollector;
import org.torproject.onionoo.util.FormattingUtils;
import org.slf4j.Logger;
@@ -22,9 +23,11 @@ public class DescriptorSource {
private static final Logger log = LoggerFactory.getLogger(
DescriptorSource.class);
- private final File inRecentDir = new File("in/recent");
+ private final File inDir = new File("in");
- private final File inArchiveDir = new File("in/archive");
+ private final File inRecentDir = new File(inDir, "recent");
+
+ private final File inArchiveDir = new File(inDir, "archive");
private final File statusDir = new File("status");
@@ -65,28 +68,14 @@ public class DescriptorSource {
/** Downloads descriptors from CollecTor. */
public void downloadDescriptors() {
+ List<String> remoteDirectories = new ArrayList<>();
for (DescriptorType descriptorType : DescriptorType.values()) {
- log.info("Loading: " + descriptorType);
- this.downloadDescriptors(descriptorType);
+ remoteDirectories.add("/recent/" + descriptorType.getDir());
}
- }
-
- private int localFilesBefore = 0;
-
- private int foundRemoteFiles = 0;
-
- private int downloadedFiles = 0;
-
- private int deletedLocalFiles = 0;
-
- private void downloadDescriptors(DescriptorType descriptorType) {
- DescriptorDownloader descriptorDownloader =
- new DescriptorDownloader(descriptorType);
- this.localFilesBefore += descriptorDownloader.statLocalFiles();
- this.foundRemoteFiles +=
- descriptorDownloader.fetchRemoteDirectory();
- this.downloadedFiles += descriptorDownloader.fetchRemoteFiles();
- this.deletedLocalFiles += descriptorDownloader.deleteOldLocalFiles();
+ DescriptorCollector dc = org.torproject.descriptor.DescriptorSourceFactory
+ .createDescriptorCollector();
+ dc.collectDescriptors("https://collector.torproject.org",
+ remoteDirectories.toArray(new String[0]), 0L, inDir, true);
}
/** Reads archived and recent descriptors from disk and feeds them into
@@ -206,14 +195,6 @@ public class DescriptorSource {
* descriptors during the current execution. */
public String getStatsString() {
StringBuilder sb = new StringBuilder();
- sb.append(" ").append(this.localFilesBefore)
- .append(" recent descriptor files ").append("found locally\n");
- sb.append(" ").append(this.foundRemoteFiles)
- .append(" recent descriptor files ").append("found remotely\n");
- sb.append(" ").append(this.downloadedFiles)
- .append(" recent descriptor files ").append("downloaded from remote\n");
- sb.append(" ").append(this.deletedLocalFiles)
- .append(" recent descriptor ").append("files deleted locally\n");
sb.append(" ").append(this.descriptorQueues.size())
.append(" descriptor ").append("queues created for recent descriptors\n");
int historySizeBefore = 0;
1
0
[onionoo/release] Remove extraneous (BETA) fields from clients objects.
by karsten@torproject.org 31 Aug '17
by karsten@torproject.org 31 Aug '17
31 Aug '17
commit 23bf1292718eac23c4c09daf0c2d10dcda333ca5
Author: Karsten Loesing <karsten.loesing(a)gmx.net>
Date: Tue Aug 22 09:39:34 2017 +0200
Remove extraneous (BETA) fields from clients objects.
This change deserves a minor protocol version update to 4.1.
Implements #22033.
---
CHANGELOG.md | 4 +-
.../torproject/onionoo/docs/ClientsDocument.java | 4 +-
.../onionoo/docs/ClientsGraphHistory.java | 102 ---------------------
.../onionoo/writer/ClientsDocumentWriter.java | 74 +--------------
4 files changed, 10 insertions(+), 174 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 8412f87..acfe8df 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,8 +1,10 @@
-# Changes in version 4.0-1.?.? - 2017-0?-??
+# Changes in version 4.1-1.?.? - 2017-0?-??
* Medium changes
- Reset IPv6 exit-policy summary in details status if a newer
server descriptor doesn't contain such a summary anymore.
+ - Remove optional fields "countries", "transports", and "versions"
+ from clients objects which were still labeled as beta.
# Changes in version 4.0-1.3.0 - 2017-08-04
diff --git a/src/main/java/org/torproject/onionoo/docs/ClientsDocument.java b/src/main/java/org/torproject/onionoo/docs/ClientsDocument.java
index 2cc69c0..0b625b0 100644
--- a/src/main/java/org/torproject/onionoo/docs/ClientsDocument.java
+++ b/src/main/java/org/torproject/onionoo/docs/ClientsDocument.java
@@ -16,10 +16,10 @@ public class ClientsDocument extends Document {
}
@SuppressWarnings("unused")
- private Map<String, ClientsGraphHistory> average_clients;
+ private Map<String, GraphHistory> average_clients;
public void setAverageClients(
- Map<String, ClientsGraphHistory> averageClients) {
+ Map<String, GraphHistory> averageClients) {
this.average_clients = averageClients;
}
}
diff --git a/src/main/java/org/torproject/onionoo/docs/ClientsGraphHistory.java b/src/main/java/org/torproject/onionoo/docs/ClientsGraphHistory.java
deleted file mode 100644
index 6b2bd3d..0000000
--- a/src/main/java/org/torproject/onionoo/docs/ClientsGraphHistory.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/* Copyright 2014--2017 The Tor Project
- * See LICENSE for licensing information */
-
-package org.torproject.onionoo.docs;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.SortedMap;
-
-public class ClientsGraphHistory {
-
- private String first;
-
- public void setFirst(long first) {
- this.first = DateTimeHelper.format(first);
- }
-
- public long getFirst() {
- return DateTimeHelper.parse(this.first);
- }
-
- private String last;
-
- public void setLast(long last) {
- this.last = DateTimeHelper.format(last);
- }
-
- public long getLast() {
- return DateTimeHelper.parse(this.last);
- }
-
- private Integer interval;
-
- public void setInterval(Integer interval) {
- this.interval = interval;
- }
-
- public Integer getInterval() {
- return this.interval;
- }
-
- private Double factor;
-
- public void setFactor(Double factor) {
- this.factor = factor;
- }
-
- public Double getFactor() {
- return this.factor;
- }
-
- private Integer count;
-
- public void setCount(Integer count) {
- this.count = count;
- }
-
- public Integer getCount() {
- return this.count;
- }
-
- private List<Integer> values = new ArrayList<>();
-
- public void setValues(List<Integer> values) {
- this.values = values;
- }
-
- public List<Integer> getValues() {
- return this.values;
- }
-
- private SortedMap<String, Float> countries;
-
- public void setCountries(SortedMap<String, Float> countries) {
- this.countries = countries;
- }
-
- public SortedMap<String, Float> getCountries() {
- return this.countries;
- }
-
- private SortedMap<String, Float> transports;
-
- public void setTransports(SortedMap<String, Float> transports) {
- this.transports = transports;
- }
-
- public SortedMap<String, Float> getTransports() {
- return this.transports;
- }
-
- private SortedMap<String, Float> versions;
-
- public void setVersions(SortedMap<String, Float> versions) {
- this.versions = versions;
- }
-
- public SortedMap<String, Float> getVersions() {
- return this.versions;
- }
-}
-
diff --git a/src/main/java/org/torproject/onionoo/writer/ClientsDocumentWriter.java b/src/main/java/org/torproject/onionoo/writer/ClientsDocumentWriter.java
index 599ecff..f65a53a 100644
--- a/src/main/java/org/torproject/onionoo/writer/ClientsDocumentWriter.java
+++ b/src/main/java/org/torproject/onionoo/writer/ClientsDocumentWriter.java
@@ -4,12 +4,12 @@
package org.torproject.onionoo.writer;
import org.torproject.onionoo.docs.ClientsDocument;
-import org.torproject.onionoo.docs.ClientsGraphHistory;
import org.torproject.onionoo.docs.ClientsHistory;
import org.torproject.onionoo.docs.ClientsStatus;
import org.torproject.onionoo.docs.DateTimeHelper;
import org.torproject.onionoo.docs.DocumentStore;
import org.torproject.onionoo.docs.DocumentStoreFactory;
+import org.torproject.onionoo.docs.GraphHistory;
import org.torproject.onionoo.docs.UpdateStatus;
import org.torproject.onionoo.util.FormattingUtils;
@@ -20,9 +20,7 @@ import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
-import java.util.SortedMap;
import java.util.SortedSet;
-import java.util.TreeMap;
/*
* Clients status file produced as intermediate output:
@@ -111,11 +109,11 @@ public class ClientsDocumentWriter implements DocumentWriter {
SortedSet<ClientsHistory> history) {
ClientsDocument clientsDocument = new ClientsDocument();
clientsDocument.setFingerprint(hashedFingerprint);
- Map<String, ClientsGraphHistory> averageClients = new LinkedHashMap<>();
+ Map<String, GraphHistory> averageClients = new LinkedHashMap<>();
for (int graphIntervalIndex = 0; graphIntervalIndex
< this.graphIntervals.length; graphIntervalIndex++) {
String graphName = this.graphNames[graphIntervalIndex];
- ClientsGraphHistory graphHistory = this.compileClientsHistory(
+ GraphHistory graphHistory = this.compileClientsHistory(
graphIntervalIndex, history);
if (graphHistory != null) {
averageClients.put(graphName, graphHistory);
@@ -125,7 +123,7 @@ public class ClientsDocumentWriter implements DocumentWriter {
return clientsDocument;
}
- private ClientsGraphHistory compileClientsHistory(
+ private GraphHistory compileClientsHistory(
int graphIntervalIndex, SortedSet<ClientsHistory> history) {
long graphInterval = this.graphIntervals[graphIntervalIndex];
long dataPointInterval =
@@ -135,10 +133,6 @@ public class ClientsDocumentWriter implements DocumentWriter {
/ dataPointInterval) * dataPointInterval;
long millis = 0L;
double responses = 0.0;
- double totalResponses = 0.0;
- SortedMap<String, Double> totalResponsesByCountry = new TreeMap<>();
- SortedMap<String, Double> totalResponsesByTransport = new TreeMap<>();
- SortedMap<String, Double> totalResponsesByVersion = new TreeMap<>();
for (ClientsHistory hist : history) {
if (hist.getEndMillis() < intervalStartMillis) {
continue;
@@ -153,31 +147,6 @@ public class ClientsDocumentWriter implements DocumentWriter {
intervalStartMillis += dataPointInterval;
}
responses += hist.getTotalResponses();
- totalResponses += hist.getTotalResponses();
- for (Map.Entry<String, Double> e :
- hist.getResponsesByCountry().entrySet()) {
- if (!totalResponsesByCountry.containsKey(e.getKey())) {
- totalResponsesByCountry.put(e.getKey(), 0.0);
- }
- totalResponsesByCountry.put(e.getKey(), e.getValue()
- + totalResponsesByCountry.get(e.getKey()));
- }
- for (Map.Entry<String, Double> e :
- hist.getResponsesByTransport().entrySet()) {
- if (!totalResponsesByTransport.containsKey(e.getKey())) {
- totalResponsesByTransport.put(e.getKey(), 0.0);
- }
- totalResponsesByTransport.put(e.getKey(), e.getValue()
- + totalResponsesByTransport.get(e.getKey()));
- }
- for (Map.Entry<String, Double> e :
- hist.getResponsesByVersion().entrySet()) {
- if (!totalResponsesByVersion.containsKey(e.getKey())) {
- totalResponsesByVersion.put(e.getKey(), 0.0);
- }
- totalResponsesByVersion.put(e.getKey(), e.getValue()
- + totalResponsesByVersion.get(e.getKey()));
- }
millis += (hist.getEndMillis() - hist.getStartMillis());
}
dataPoints.add(millis * 2L < dataPointInterval
@@ -217,7 +186,7 @@ public class ClientsDocumentWriter implements DocumentWriter {
+ (lastNonNullIndex - firstNonNullIndex) * dataPointInterval;
double factor = ((double) maxValue) / 999.0;
int count = lastNonNullIndex - firstNonNullIndex + 1;
- ClientsGraphHistory graphHistory = new ClientsGraphHistory();
+ GraphHistory graphHistory = new GraphHistory();
graphHistory.setFirst(firstDataPointMillis);
graphHistory.setLast(lastDataPointMillis);
graphHistory.setInterval((int) (dataPointInterval
@@ -240,39 +209,6 @@ public class ClientsDocumentWriter implements DocumentWriter {
(int) ((dataPoint * 999.0) / maxValue));
}
graphHistory.setValues(values);
- if (!totalResponsesByCountry.isEmpty()) {
- SortedMap<String, Float> countries = new TreeMap<>();
- for (Map.Entry<String, Double> e :
- totalResponsesByCountry.entrySet()) {
- if (e.getValue() > totalResponses / 100.0) {
- countries.put(e.getKey(),
- (float) (e.getValue() / totalResponses));
- }
- }
- graphHistory.setCountries(countries);
- }
- if (!totalResponsesByTransport.isEmpty()) {
- SortedMap<String, Float> transports = new TreeMap<>();
- for (Map.Entry<String, Double> e :
- totalResponsesByTransport.entrySet()) {
- if (e.getValue() > totalResponses / 100.0) {
- transports.put(e.getKey(),
- (float) (e.getValue() / totalResponses));
- }
- }
- graphHistory.setTransports(transports);
- }
- if (!totalResponsesByVersion.isEmpty()) {
- SortedMap<String, Float> versions = new TreeMap<>();
- for (Map.Entry<String, Double> e :
- totalResponsesByVersion.entrySet()) {
- if (e.getValue() > totalResponses / 100.0) {
- versions.put(e.getKey(),
- (float) (e.getValue() / totalResponses));
- }
- }
- graphHistory.setVersions(versions);
- }
if (foundTwoAdjacentDataPoints) {
return graphHistory;
} else {
1
0
31 Aug '17
commit 14f6192ec88971dbd42ad1cc59e271c029a5646e
Author: iwakeh <iwakeh(a)torproject.org>
Date: Tue Aug 22 07:41:02 2017 +0000
Add system property for all paths.
The system property is 'onionoo.basedir'. If not set, backwards compatible
defaults apply. Implements task-14201.
---
CHANGELOG.md | 4 ++++
src/main/java/org/torproject/onionoo/cron/Main.java | 3 +--
src/main/java/org/torproject/onionoo/server/NodeIndexer.java | 7 +++----
src/main/resources/web.xml | 5 -----
4 files changed, 8 insertions(+), 11 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index e028dd1..9538287 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -9,6 +9,10 @@
- Switch from our own CollecTor downloader to metrics-lib's
DescriptorCollector.
+ * Minor changes
+ - Add a new Java property "onionoo.basedir" to re-configure the
+ base directory used by the web server component.
+
# Changes in version 4.0-1.3.0 - 2017-08-04
diff --git a/src/main/java/org/torproject/onionoo/cron/Main.java b/src/main/java/org/torproject/onionoo/cron/Main.java
index 685da35..f6f7099 100644
--- a/src/main/java/org/torproject/onionoo/cron/Main.java
+++ b/src/main/java/org/torproject/onionoo/cron/Main.java
@@ -22,8 +22,7 @@ import java.util.concurrent.TimeUnit;
/* Update search data and status data files. */
public class Main implements Runnable {
- private Main() {
- }
+ private Main() {}
private Logger log = LoggerFactory.getLogger(Main.class);
diff --git a/src/main/java/org/torproject/onionoo/server/NodeIndexer.java b/src/main/java/org/torproject/onionoo/server/NodeIndexer.java
index 7ed9ea6..db13ed9 100644
--- a/src/main/java/org/torproject/onionoo/server/NodeIndexer.java
+++ b/src/main/java/org/torproject/onionoo/server/NodeIndexer.java
@@ -20,7 +20,6 @@ import java.util.SortedMap;
import java.util.SortedSet;
import java.util.TreeMap;
-import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
@@ -31,11 +30,11 @@ public class NodeIndexer implements ServletContextListener, Runnable {
@Override
public void contextInitialized(ServletContextEvent contextEvent) {
- ServletContext servletContext = contextEvent.getServletContext();
- File outDir = new File(servletContext.getInitParameter("outDir"));
+ File outDir = new File(System.getProperty("onionoo.basedir",
+ "/srv/onionoo.torproject.org/onionoo"), "out");
if (!outDir.exists() || !outDir.isDirectory()) {
log.error("\n\n\tOut-dir not found! Expected directory: " + outDir
- + "\n\tVerify the configuration in ./etc/web.xml.template");
+ + "\n\tSet system property 'onionoo.basedir'.");
System.exit(1);
}
DocumentStore documentStore = DocumentStoreFactory.getDocumentStore();
diff --git a/src/main/resources/web.xml b/src/main/resources/web.xml
index cefdfae..da1431b 100644
--- a/src/main/resources/web.xml
+++ b/src/main/resources/web.xml
@@ -41,11 +41,6 @@
<url-pattern>/uptime</url-pattern>
</servlet-mapping>
- <context-param>
- <param-name>outDir</param-name>
- <param-value>/srv/onionoo.torproject.org/onionoo/out/</param-value>
- </context-param>
-
<listener>
<listener-class>
org.torproject.onionoo.server.NodeIndexer
1
0
commit 19acb651a4b51746e068c5ba403a746b7706bf3e
Author: iwakeh <iwakeh(a)torproject.org>
Date: Tue Aug 8 08:01:32 2017 +0000
Removed unused imports.
---
src/main/java/org/torproject/onionoo/server/RequestHandler.java | 3 ---
src/main/java/org/torproject/onionoo/server/ResourceServlet.java | 2 --
2 files changed, 5 deletions(-)
diff --git a/src/main/java/org/torproject/onionoo/server/RequestHandler.java b/src/main/java/org/torproject/onionoo/server/RequestHandler.java
index 1e08c24..46c2f54 100644
--- a/src/main/java/org/torproject/onionoo/server/RequestHandler.java
+++ b/src/main/java/org/torproject/onionoo/server/RequestHandler.java
@@ -7,9 +7,6 @@ import org.torproject.onionoo.docs.DocumentStore;
import org.torproject.onionoo.docs.DocumentStoreFactory;
import org.torproject.onionoo.docs.SummaryDocument;
-import java.io.BufferedWriter;
-import java.io.FileWriter;
-import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
diff --git a/src/main/java/org/torproject/onionoo/server/ResourceServlet.java b/src/main/java/org/torproject/onionoo/server/ResourceServlet.java
index 164b770..31244c2 100644
--- a/src/main/java/org/torproject/onionoo/server/ResourceServlet.java
+++ b/src/main/java/org/torproject/onionoo/server/ResourceServlet.java
@@ -3,8 +3,6 @@
package org.torproject.onionoo.server;
-import java.io.BufferedWriter;
-import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
1
0
commit 5d9ee5033a423747ce816d6f791489b8548aaec9
Author: iwakeh <iwakeh(a)torproject.org>
Date: Tue Aug 8 08:01:33 2017 +0000
Use StringBuilder consistently.
---
.../org/torproject/onionoo/docs/NodeStatus.java | 46 +++++++++++-----------
1 file changed, 24 insertions(+), 22 deletions(-)
diff --git a/src/main/java/org/torproject/onionoo/docs/NodeStatus.java b/src/main/java/org/torproject/onionoo/docs/NodeStatus.java
index 759d83e..2943601 100644
--- a/src/main/java/org/torproject/onionoo/docs/NodeStatus.java
+++ b/src/main/java/org/torproject/onionoo/docs/NodeStatus.java
@@ -580,9 +580,9 @@ public class NodeStatus extends Document {
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(this.isRelay ? "r" : "b");
- sb.append("\t" + this.nickname);
- sb.append("\t" + this.fingerprint);
- sb.append("\t" + this.address + ";");
+ sb.append("\t").append(this.nickname);
+ sb.append("\t").append(this.fingerprint);
+ sb.append("\t").append(this.address).append(";");
if (this.orAddressesAndPorts != null) {
sb.append(StringUtils.join(this.orAddressesAndPorts, "+"));
}
@@ -590,40 +590,42 @@ public class NodeStatus extends Document {
if (this.isRelay) {
sb.append(StringUtils.join(this.exitAddresses, "+"));
}
- sb.append("\t" + DateTimeHelper.format(this.lastSeenMillis,
+ sb.append("\t").append(DateTimeHelper.format(this.lastSeenMillis,
DateTimeHelper.ISO_DATETIME_TAB_FORMAT));
- sb.append("\t" + this.orPort);
- sb.append("\t" + this.dirPort + "\t");
+ sb.append("\t").append(this.orPort);
+ sb.append("\t").append(this.dirPort).append("\t");
sb.append(StringUtils.join(this.getRelayFlags(), ","));
if (this.isRelay) {
- sb.append("\t" + String.valueOf(this.consensusWeight));
- sb.append("\t"
- + (this.countryCode != null ? this.countryCode : "??"));
+ sb.append("\t").append(String.valueOf(this.consensusWeight));
+ sb.append("\t")
+ .append((this.countryCode != null ? this.countryCode : "??"));
sb.append("\t"); /* formerly used for storing host names */
- sb.append("\t" + String.valueOf(this.lastRdnsLookup));
- sb.append("\t" + (this.defaultPolicy != null ? this.defaultPolicy
- : "null"));
- sb.append("\t" + (this.portList != null ? this.portList : "null"));
+ sb.append("\t").append(String.valueOf(this.lastRdnsLookup));
+ sb.append("\t").append((this.defaultPolicy != null
+ ? this.defaultPolicy : "null"));
+ sb.append("\t").append((this.portList != null ? this.portList : "null"));
} else {
sb.append("\t-1\t??\t\t-1\tnull\tnull");
}
- sb.append("\t" + DateTimeHelper.format(this.firstSeenMillis,
+ sb.append("\t").append(DateTimeHelper.format(this.firstSeenMillis,
DateTimeHelper.ISO_DATETIME_TAB_FORMAT));
if (this.isRelay) {
- sb.append("\t" + DateTimeHelper.format(
+ sb.append("\t").append(DateTimeHelper.format(
this.getLastChangedOrAddressOrPort(),
DateTimeHelper.ISO_DATETIME_TAB_FORMAT));
- sb.append("\t" + (this.asNumber != null ? this.asNumber : "null"));
+ sb.append("\t").append((this.asNumber != null ? this.asNumber : "null"));
} else {
sb.append("\tnull\tnull\tnull");
}
- sb.append("\t" + (this.contact != null ? this.contact : ""));
- sb.append("\t" + (this.recommendedVersion == null ? "null" :
+ sb.append("\t").append((this.contact != null ? this.contact : ""));
+ sb.append("\t").append((this.recommendedVersion == null ? "null" :
this.recommendedVersion ? "true" : "false"));
- sb.append("\t" + StringUtils.join(this.getAllegedFamily(), ";") + ":"
- + StringUtils.join(this.getEffectiveFamily(), ";") + ":"
- + StringUtils.join(this.getIndirectFamily(), ";"));
- sb.append("\t" + (this.getVersion() != null ? this.getVersion() : ""));
+ sb.append("\t").append(StringUtils.join(this.getAllegedFamily(), ";"))
+ .append(":")
+ .append(StringUtils.join(this.getEffectiveFamily(), ";")).append(":")
+ .append(StringUtils.join(this.getIndirectFamily(), ";"));
+ sb.append("\t")
+ .append((this.getVersion() != null ? this.getVersion() : ""));
return sb.toString();
}
}
1
0
commit 2eead2a12ff350d66e5713d105d50e8d8cd287b3
Author: iwakeh <iwakeh(a)torproject.org>
Date: Wed Aug 30 20:37:35 2017 +0000
Add test that reproduces NPE.
The timeouts are ncessary, when something unforseen makes the
NodeIndexer.getLatestNodeIndex wait forever.
---
.../onionoo/server/ResourceServletTest.java | 370 ++++++++++-----------
1 file changed, 185 insertions(+), 185 deletions(-)
diff --git a/src/test/java/org/torproject/onionoo/server/ResourceServletTest.java b/src/test/java/org/torproject/onionoo/server/ResourceServletTest.java
index 4ebf0d2..303cf21 100644
--- a/src/test/java/org/torproject/onionoo/server/ResourceServletTest.java
+++ b/src/test/java/org/torproject/onionoo/server/ResourceServletTest.java
@@ -155,7 +155,7 @@ public class ResourceServletTest {
new TreeSet<String>(Arrays.asList(new String[] {
"000C5F55BD4814B917CC474BD537F1A3B33CCE2A" })),
new TreeSet<>(Arrays.asList(new String[] {
- "000C5F55BD4814B917CC474BD537F1A3B33CCE2A" })), "0.2.3.24-rc-dev");
+ "000C5F55BD4814B917CC474BD537F1A3B33CCE2A" })), null);
this.relays = new TreeMap<>();
this.relays.put("000C5F55BD4814B917CC474BD537F1A3B33CCE2A",
relayTorkaZ);
@@ -367,7 +367,7 @@ public class ResourceServletTest {
private boolean r;
}
- @Test()
+ @Test(timeout = 100)
public void testValidSummaryRelay() throws IOException {
this.runTest("/summary");
assertEquals("2013-04-24 12:00:00",
@@ -387,7 +387,7 @@ public class ResourceServletTest {
assertFalse(relay.r);
}
- @Test()
+ @Test(timeout = 100)
public void testValidSummaryBridge() {
this.runTest("/summary");
assertEquals("2013-04-24 01:07:04",
@@ -405,519 +405,519 @@ public class ResourceServletTest {
assertFalse(bridge.r);
}
- @Test()
+ @Test(timeout = 100)
public void testNonExistantDocumentType() {
this.assertErrorStatusCode(
"/doesnotexist", 400);
}
- @Test()
+ @Test(timeout = 100)
public void testSummaryUpperCaseDocument() {
this.assertErrorStatusCode(
"/SUMMARY", 400);
}
- @Test()
+ @Test(timeout = 100)
public void testTypeRelay() {
this.assertSummaryDocument(
"/summary?type=relay", 3, null, 0, null);
}
- @Test()
+ @Test(timeout = 100)
public void testTypeBridge() {
this.assertSummaryDocument(
"/summary?type=bridge", 0, null, 3, null);
}
- @Test()
+ @Test(timeout = 100)
public void testTypeBridgerelay() {
this.assertErrorStatusCode(
"/summary?type=bridgerelay", 400);
}
- @Test()
+ @Test(timeout = 100)
public void testTypeRelayBridge() {
this.assertSummaryDocument(
"/summary?type=relay&type=bridge", 3, null, 0, null);
}
- @Test()
+ @Test(timeout = 100)
public void testTypeBridgeRelay() {
this.assertSummaryDocument(
"/summary?type=bridge&type=relay", 0, null, 3, null);
}
- @Test()
+ @Test(timeout = 100)
public void testTypeRelayRelay() {
this.assertSummaryDocument(
"/summary?type=relay&type=relay", 3, null, 0, null);
}
- @Test()
+ @Test(timeout = 100)
public void testTypeUpperCaseRelay() {
this.assertErrorStatusCode(
"/summary?TYPE=relay", 400);
}
- @Test()
+ @Test(timeout = 100)
public void testTypeRelayUpperCase() {
this.assertSummaryDocument(
"/summary?type=RELAY", 3, null, 0, null);
}
- @Test()
+ @Test(timeout = 100)
public void testRunningTrue() {
this.assertSummaryDocument(
"/summary?running=true", 1, new String[] { "Ferrari458" }, 1,
new String[] { "gummy" });
}
- @Test()
+ @Test(timeout = 100)
public void testRunningFalse() {
this.assertSummaryDocument(
"/summary?running=false", 2, null, 2, null);
}
- @Test()
+ @Test(timeout = 100)
public void testRunningTruefalse() {
this.assertErrorStatusCode(
"/summary?running=truefalse", 400);
}
- @Test()
+ @Test(timeout = 100)
public void testRunningTrueFalse() {
this.assertSummaryDocument(
"/summary?running=true&running=false", 1,
new String[] { "Ferrari458" }, 1, new String[] { "gummy" });
}
- @Test()
+ @Test(timeout = 100)
public void testRunningFalseTrue() {
this.assertSummaryDocument(
"/summary?running=false&running=true", 2, null, 2, null);
}
- @Test()
+ @Test(timeout = 100)
public void testRunningTrueTrue() {
this.assertSummaryDocument(
"/summary?running=true&running=true", 1,
new String[] { "Ferrari458" }, 1, new String[] { "gummy" });
}
- @Test()
+ @Test(timeout = 100)
public void testRunningUpperCaseTrue() {
this.assertErrorStatusCode(
"/summary?RUNNING=true", 400);
}
- @Test()
+ @Test(timeout = 100)
public void testRunningTrueUpperCase() {
this.assertSummaryDocument(
"/summary?running=TRUE", 1, null, 1, null);
}
- @Test()
+ @Test(timeout = 100)
public void testSearchTorkaZ() {
this.assertSummaryDocument(
"/summary?search=TorkaZ", 1, new String[] { "TorkaZ" }, 0, null);
}
- @Test()
+ @Test(timeout = 100)
public void testSearchTorkaX() {
this.assertSummaryDocument(
"/summary?search=TorkaX", 0, null, 0, null);
}
- @Test()
+ @Test(timeout = 100)
public void testSearchOrkaZ() {
this.assertSummaryDocument(
"/summary?search=orkaZ", 1, new String[] { "TorkaZ" }, 0, null);
}
- @Test()
+ @Test(timeout = 100)
public void testSearchTorka() {
this.assertSummaryDocument(
"/summary?search=Torka", 1, new String[] { "TorkaZ" }, 0, null);
}
- @Test()
+ @Test(timeout = 100)
public void testSearchTorkazUpperCase() {
this.assertSummaryDocument(
"/summary?search=TORKAZ", 1, new String[] { "TorkaZ" }, 0, null);
}
- @Test()
+ @Test(timeout = 100)
public void testSearchDollarFingerprint() {
this.assertSummaryDocument(
"/summary?search=$000C5F55BD4814B917CC474BD537F1A3B33CCE2A", 1,
new String[] { "TorkaZ" }, 0, null);
}
- @Test()
+ @Test(timeout = 100)
public void testSearchFingerprint() {
this.assertSummaryDocument(
"/summary?search=000C5F55BD4814B917CC474BD537F1A3B33CCE2A", 1,
new String[] { "TorkaZ" }, 0, null);
}
- @Test()
+ @Test(timeout = 100)
public void testSearchDollarFingerprint39() {
this.assertSummaryDocument(
"/summary?search=$000C5F55BD4814B917CC474BD537F1A3B33CCE2", 1,
new String[] { "TorkaZ" }, 0, null);
}
- @Test()
+ @Test(timeout = 100)
public void testSearchDollarFingerprintLowerCase39() {
this.assertSummaryDocument(
"/summary?search=$000c5f55bd4814b917cc474bd537f1a3b33cce2", 1,
new String[] { "TorkaZ" }, 0, null);
}
- @Test()
+ @Test(timeout = 100)
public void testSearchFingerprintLowerCase39() {
this.assertSummaryDocument(
"/summary?search=000c5f55bd4814b917cc474bd537f1a3b33cce2", 1,
new String[] { "TorkaZ" }, 0, null);
}
- @Test()
+ @Test(timeout = 100)
public void testSearchDollarHashedFingerprint() {
this.assertSummaryDocument(
"/summary?search=$5aa14c08d62913e0057a9ad5863b458c0ce94cee", 1,
new String[] { "TorkaZ" }, 0, null);
}
- @Test()
+ @Test(timeout = 100)
public void testSearchDollarHashedFingerprint39() {
this.assertSummaryDocument(
"/summary?search=$5aa14c08d62913e0057a9ad5863b458c0ce94ce", 1,
new String[] { "TorkaZ" }, 0, null);
}
- @Test()
+ @Test(timeout = 100)
public void testSearchDollarHashedFingerprint41() {
this.assertErrorStatusCode(
"/summary?search=$5aa14c08d62913e0057a9ad5863b458c0ce94ceee",
400);
}
- @Test()
+ @Test(timeout = 100)
public void testSearchBase64FingerprintAlphaNum() {
this.assertSummaryDocument(
"/summary?search=AAxfVb1IFLkXzEdL1Tfxo7M8zio", 1,
new String[] { "TorkaZ" }, 0, null);
}
- @Test()
+ @Test(timeout = 100)
public void testSearchBase64FingerprintSlash() {
this.assertSummaryDocument(
"/summary?search=ABwTs6Vacbl3ymXshVOdecZTo/w", 1,
new String[] { "Ferrari458" }, 0, null);
}
- @Test()
+ @Test(timeout = 100)
public void testSearchBase64FingerprintPlus() {
this.assertSummaryDocument(
"/summary?search=ACXBNsHzqe7+KuP5GPA7+iG1Bws", 1,
new String[] { "TimMayTribute" }, 0, null);
}
- @Test()
+ @Test(timeout = 100)
public void testSearchBase64FingerprintBridge() {
this.assertSummaryDocument(
"/summary?search=AACDGyNt/3PUCa0XtA4qcopTmU8", 0, null, 0, null);
}
- @Test()
+ @Test(timeout = 100)
public void testSearchBase64FingerprintPartial() {
this.assertSummaryDocument(
"/summary?search=AAx", 1, new String[] { "TorkaZ" }, 0, null);
}
- @Test()
+ @Test(timeout = 100)
public void testSearchBase64HashedFingerprintTorkaZ() {
this.assertSummaryDocument(
"/summary?search=WqFMCNYpE+AFeprVhjtFjAzpTO4", 0, null, 0, null);
}
- @Test()
+ @Test(timeout = 100)
public void testSearchBase64Fingerprint28() {
this.assertErrorStatusCode(
"/summary?search=AAAAAAAAAAAA//AAAAAAAAAAAAAA", 400);
}
- @Test()
+ @Test(timeout = 100)
public void testSearchSpaceSeparatedFingerprintFourty() {
this.assertSummaryDocument(
"/summary?search=000C 5F55 BD48 14B9 17CC 474B D537 F1A3 B33C "
+ "CE2A", 1, new String[] { "TorkaZ" }, 0, null);
}
- @Test()
+ @Test(timeout = 100)
public void testSearchSpaceSeparatedFingerprintLastEight() {
this.assertSummaryDocument(
"/summary?search=F1A3 B33C", 1, new String[] { "TorkaZ" }, 0,
null);
}
- @Test()
+ @Test(timeout = 100)
public void testSearchSpaceSeparatedFingerprintLastThree() {
this.assertSummaryDocument(
"/summary?search=33C", 0, null, 0, null);
}
- @Test()
+ @Test(timeout = 100)
public void testSearchIp() {
this.assertSummaryDocument(
"/summary?search=62.216.201.221", 1, new String[] { "TorkaZ" }, 0,
null);
}
- @Test()
+ @Test(timeout = 100)
public void testSearchIp24Network() {
this.assertSummaryDocument(
"/summary?search=62.216.201", 1, new String[] { "TorkaZ" }, 0,
null);
}
- @Test()
+ @Test(timeout = 100)
public void testSearchIpExit() {
this.assertSummaryDocument(
"/summary?search=62.216.201.222", 1, new String[] { "TorkaZ" }, 0,
null);
}
- @Test()
+ @Test(timeout = 100)
public void testSearchIpv6() {
this.assertSummaryDocument(
"/summary?search=[2001:4f8:3:2e::51]", 1,
new String[] { "Ferrari458" }, 0, null);
}
- @Test()
+ @Test(timeout = 100)
public void testSearchIpv6Slash64NoTrailingBracket() {
this.assertSummaryDocument(
"/summary?search=[2001:4f8:3:2e::", 1,
new String[] { "Ferrari458" }, 0, null);
}
- @Test()
+ @Test(timeout = 100)
public void testSearchIpv6Slash64TrailingBracket() {
this.assertSummaryDocument(
"/summary?search=[2001:4f8:3:2e::]", 0, null, 0, null);
}
- @Test()
+ @Test(timeout = 100)
public void testSearchIpv6Slash64NoBrackets() {
this.assertSummaryDocument(
"/summary?search=2001:4f8:3:2e::", 1,
new String[] { "Ferrari458" }, 0, null);
}
- @Test()
+ @Test(timeout = 100)
public void testSearchIpv6Slash8Colon() {
this.assertSummaryDocument(
"/summary?search=[2001:", 1,
new String[] { "Ferrari458" }, 0, null);
}
- @Test()
+ @Test(timeout = 100)
public void testSearchIpv6Slash8NoColon() {
this.assertSummaryDocument(
"/summary?search=[2001", 1,
new String[] { "Ferrari458" }, 0, null);
}
- @Test()
+ @Test(timeout = 100)
public void testSearchIpv6Slash8NoColonNoBrackets() {
this.assertSummaryDocument(
"/summary?search=2001", 1,
new String[] { "Ferrari458" }, 0, null);
}
- @Test()
+ @Test(timeout = 100)
public void testSearchIpv6Uncompressed() {
this.assertSummaryDocument(
"/summary?search=[2001:04f8:0003:002e:0000:0000:0000:0051]", 0,
null, 0, null);
}
- @Test()
+ @Test(timeout = 100)
public void testSearchIpv6UpperCase() {
this.assertSummaryDocument(
"/summary?search=[2001:4F8:3:2E::51]", 1,
new String[] { "Ferrari458" }, 0, null);
}
- @Test()
+ @Test(timeout = 100)
public void testSearchIpv6ThreeColons() {
this.assertSummaryDocument(
"/summary?search=[2001:4f8:3:2e:::51]", 0, null, 0, null);
}
- @Test()
+ @Test(timeout = 100)
public void testSearchIpv6FiveHex() {
this.assertSummaryDocument(
"/summary?search=[20014:f80:3:2e::51]", 0, null, 0, null);
}
- @Test()
+ @Test(timeout = 100)
public void testSearchIpv6NineGroups() {
this.assertSummaryDocument(
"/summary?search=[1:2:3:4:5:6:7:8:9]", 0, null, 0, null);
}
- @Test()
+ @Test(timeout = 100)
public void testSearchIpv6TcpPort() {
this.assertErrorStatusCode(
"/summary?search=[2001:4f8:3:2e::51]:9001", 400);
}
- @Test()
+ @Test(timeout = 100)
public void testSearchGummy() {
this.assertSummaryDocument(
"/summary?search=gummy", 0, null, 1, new String[] { "gummy" });
}
- @Test()
+ @Test(timeout = 100)
public void testSearchGummi() {
this.assertSummaryDocument(
"/summary?search=gummi", 0, null, 0, null);
}
- @Test()
+ @Test(timeout = 100)
public void testSearchUmmy() {
this.assertSummaryDocument(
"/summary?search=ummy", 0, null, 1, new String[] { "gummy" });
}
- @Test()
+ @Test(timeout = 100)
public void testSearchGumm() {
this.assertSummaryDocument(
"/summary?search=gumm", 0, null, 1, new String[] { "gummy" });
}
- @Test()
+ @Test(timeout = 100)
public void testSearchGummyUpperCase() {
this.assertSummaryDocument(
"/summary?search=GUMMY", 0, null, 1, new String[] { "gummy" });
}
- @Test()
+ @Test(timeout = 100)
public void testSearchBridgeDollarHashedFingerprint() {
this.assertSummaryDocument(
"/summary?search=$1FEDE50ED8DBA1DD9F9165F78C8131E4A44AB756", 0,
null, 1, new String[] { "gummy" });
}
- @Test()
+ @Test(timeout = 100)
public void testSearchBridgeHashedFingerprint() {
this.assertSummaryDocument(
"/summary?search=1FEDE50ED8DBA1DD9F9165F78C8131E4A44AB756", 0,
null, 1, new String[] { "gummy" });
}
- @Test()
+ @Test(timeout = 100)
public void testSearchBridgeDollarHashedFingerprint39() {
this.assertSummaryDocument(
"/summary?search=$1FEDE50ED8DBA1DD9F9165F78C8131E4A44AB75", 0,
null, 1, new String[] { "gummy" });
}
- @Test()
+ @Test(timeout = 100)
public void testSearchBridgeDollarHashedFingerprintLowerCase39() {
this.assertSummaryDocument(
"/summary?search=$1fede50ed8dba1dd9f9165f78c8131e4a44ab75", 0,
null, 1, new String[] { "gummy" });
}
- @Test()
+ @Test(timeout = 100)
public void testSearchBridgeHashedFingerprintLowerCase39() {
this.assertSummaryDocument(
"/summary?search=1fede50ed8dba1dd9f9165f78c8131e4a44ab75", 0,
null, 1, new String[] { "gummy" });
}
- @Test()
+ @Test(timeout = 100)
public void testSearchBridgeDollarHashedHashedFingerprint() {
this.assertSummaryDocument(
"/summary?search=$CE52F898DB3678BCE33FAC28C92774DE90D618B5", 0,
null, 1, new String[] { "gummy" });
}
- @Test()
+ @Test(timeout = 100)
public void testSearchBridgeDollarHashedHashedFingerprint39() {
this.assertSummaryDocument(
"/summary?search=$CE52F898DB3678BCE33FAC28C92774DE90D618B", 0,
null, 1, new String[] { "gummy" });
}
- @Test()
+ @Test(timeout = 100)
public void testSearchBridgeDollarOriginalFingerprint() {
this.assertSummaryDocument(
"/summary?search=$0010D49C6DA1E46A316563099F41BFE40B6C7183", 0,
null, 0, null);
}
- @Test()
+ @Test(timeout = 100)
public void testSearchUnderscore() {
this.assertErrorStatusCode(
"/summary?search=_", 400);
}
- @Test()
+ @Test(timeout = 100)
public void testSearchTypeRelay() {
this.assertSummaryDocument("/summary?search=type:relay", 3, null, 0,
null);
}
- @Test()
+ @Test(timeout = 100)
public void testSearchTypeRelayTorkaZ() {
this.assertSummaryDocument("/summary?search=type:relay TorkaZ", 1,
new String[] { "TorkaZ" }, 0, null);
}
- @Test()
+ @Test(timeout = 100)
public void testSearchTorkaZTypeRelay() {
this.assertSummaryDocument("/summary?search=TorkaZ type:relay", 1,
new String[] { "TorkaZ" }, 0, null);
}
- @Test()
+ @Test(timeout = 100)
public void testSearchTorkaZEscapedSpaceTypeRelay() {
this.assertSummaryDocument("/summary?search=TorkaZ%20type:relay", 1,
new String[] { "TorkaZ" }, 0, null);
}
- @Test()
+ @Test(timeout = 100)
public void testSearchTypeRelayTypeDirectory() {
this.assertSummaryDocument(
"/summary?search=type:relay type:directory", 3, null, 0, null);
}
- @Test()
+ @Test(timeout = 100)
public void testSearchTypeDirectoryTypeRelay() {
this.assertErrorStatusCode(
"/summary?search=type:directory type:relay", 400);
}
- @Test()
+ @Test(timeout = 100)
public void testSearchFooBar() {
this.assertErrorStatusCode("/summary?search=foo:bar", 400);
}
- @Test()
+ @Test(timeout = 100)
public void testSearchSearchTorkaZ() {
this.assertErrorStatusCode("/summary?search=search:TorkaZ", 400);
}
- @Test()
+ @Test(timeout = 100)
public void testSearchLimitOne() {
this.assertErrorStatusCode("/summary?search=limit:1", 400);
}
- @Test()
+ @Test(timeout = 100)
public void testSearchDeadBeef() {
/* This does not return 400 Bad Request, even though "dead" is not a valid
* search term qualifier, because this could be the start of an IPv6 address
@@ -925,389 +925,389 @@ public class ResourceServletTest {
this.assertSummaryDocument("/summary?search=dead:beef", 0, null, 0, null);
}
- @Test()
+ @Test(timeout = 100)
public void testSearchEmailAddress() {
this.assertSummaryDocument(
"/summary?search=contact:<tor+steven.murdoch(a)cl.cam.ac.uk>", 1,
new String[] { "TimMayTribute" }, 0, null);
}
- @Test()
+ @Test(timeout = 100)
public void testLookupFingerprint() {
this.assertSummaryDocument(
"/summary?lookup=000C5F55BD4814B917CC474BD537F1A3B33CCE2A", 1,
new String[] { "TorkaZ" }, 0, null);
}
- @Test()
+ @Test(timeout = 100)
public void testLookupDollarFingerprint() {
this.assertErrorStatusCode(
"/summary?lookup=$000C5F55BD4814B917CC474BD537F1A3B33CCE2A", 400);
}
- @Test()
+ @Test(timeout = 100)
public void testLookupDollarFingerprint39() {
this.assertErrorStatusCode(
"/summary?lookup=$000C5F55BD4814B917CC474BD537F1A3B33CCE2", 400);
}
- @Test()
+ @Test(timeout = 100)
public void testLookupFingerprintLowerCase39() {
this.assertErrorStatusCode(
"/summary?lookup=000c5f55bd4814b917cc474bd537f1a3b33cce2", 400);
}
- @Test()
+ @Test(timeout = 100)
public void testLookupHashedFingerprint() {
this.assertSummaryDocument(
"/summary?lookup=5aa14c08d62913e0057a9ad5863b458c0ce94cee", 1,
new String[] { "TorkaZ" }, 0, null);
}
- @Test()
+ @Test(timeout = 100)
public void testLookupBridgeHashedFingerprint() {
this.assertSummaryDocument(
"/summary?lookup=1FEDE50ED8DBA1DD9F9165F78C8131E4A44AB756", 0,
null, 1, new String[] { "gummy" });
}
- @Test()
+ @Test(timeout = 100)
public void testLookupBridgeHashedHashedFingerprint() {
this.assertSummaryDocument(
"/summary?lookup=CE52F898DB3678BCE33FAC28C92774DE90D618B5", 0,
null, 1, new String[] { "gummy" });
}
- @Test()
+ @Test(timeout = 100)
public void testLookupBridgeOriginalFingerprint() {
this.assertSummaryDocument(
"/summary?lookup=0010D49C6DA1E46A316563099F41BFE40B6C7183", 0,
null, 0, null);
}
- @Test()
+ @Test(timeout = 100)
public void testLookupNonExistantFingerprint() {
this.assertSummaryDocument(
"/summary?lookup=0000000000000000000000000000000000000000", 0,
null, 0, null);
}
- @Test()
+ @Test(timeout = 100)
public void testFingerprintRelayFingerprint() {
this.assertSummaryDocument(
"/summary?fingerprint=000C5F55BD4814B917CC474BD537F1A3B33CCE2A",
1, new String[] { "TorkaZ" }, 0, null);
}
- @Test()
+ @Test(timeout = 100)
public void testFingerprintRelayHashedFingerprint() {
this.assertSummaryDocument(
- "/summary?fingerprint=5aa14c08d62913e0057a9ad5863b458c0ce94cee",
+ "/summary?fingerprint=4aa14c08d62913e0057a9ad5863b458c0ce94cee",
0, null, 0, null);
}
- @Test()
+ @Test(timeout = 100)
public void testFingerprintBridgeHashedFingerprint() {
this.assertSummaryDocument(
"/summary?fingerprint=1FEDE50ED8DBA1DD9F9165F78C8131E4A44AB756",
0, null, 1, new String[] { "gummy" });
}
- @Test()
+ @Test(timeout = 100)
public void testFingerprintBridgeHashedHashedFingerprint() {
this.assertSummaryDocument(
"/summary?fingerprint=CE52F898DB3678BCE33FAC28C92774DE90D618B5",
0, null, 0, null);
}
- @Test()
+ @Test(timeout = 100)
public void testFingerprintBridgeOriginalFingerprint() {
this.assertSummaryDocument(
"/summary?fingerprint=0010D49C6DA1E46A316563099F41BFE40B6C7183",
0, null, 0, null);
}
- @Test()
+ @Test(timeout = 100)
public void testCountryDe() {
this.assertSummaryDocument(
"/summary?country=de", 1, new String[] { "TorkaZ" }, 0, null);
}
- @Test()
+ @Test(timeout = 100)
public void testCountryFr() {
this.assertSummaryDocument(
"/summary?country=fr", 0, null, 0, null);
}
- @Test()
+ @Test(timeout = 100)
public void testCountryZz() {
this.assertSummaryDocument(
"/summary?country=zz", 0, null, 0, null);
}
- @Test()
+ @Test(timeout = 100)
public void testCountryDeUpperCase() {
this.assertSummaryDocument(
"/summary?country=DE", 1, new String[] { "TorkaZ" }, 0, null);
}
- @Test()
+ @Test(timeout = 100)
public void testCountryDeu() {
this.assertErrorStatusCode(
"/summary?country=deu", 400);
}
- @Test()
+ @Test(timeout = 100)
public void testCountryD() {
this.assertErrorStatusCode(
"/summary?country=d", 400);
}
- @Test()
+ @Test(timeout = 100)
public void testCountryA1() {
this.assertSummaryDocument(
"/summary?country=a1", 1, new String[] { "TimMayTribute" }, 0,
null);
}
- @Test()
+ @Test(timeout = 100)
public void testCountryDeDe() {
this.assertSummaryDocument(
"/summary?country=de&country=de", 1, new String[] { "TorkaZ" }, 0,
null);
}
- @Test()
+ @Test(timeout = 100)
public void testAsAS8767() {
this.assertSummaryDocument(
"/summary?as=AS8767", 1, new String[] { "TorkaZ" }, 0, null);
}
- @Test()
+ @Test(timeout = 100)
public void testAs8767() {
this.assertSummaryDocument(
"/summary?as=8767", 1, new String[] { "TorkaZ" }, 0, null);
}
- @Test()
+ @Test(timeout = 100)
public void testAsAs() {
this.assertErrorStatusCode(
"/summary?as=AS", 400);
}
- @Test()
+ @Test(timeout = 100)
public void testAsas8767() {
this.assertSummaryDocument(
"/summary?as=as8767", 1, new String[] { "TorkaZ" }, 0, null);
}
- @Test()
+ @Test(timeout = 100)
public void testAsAsSpace8767() {
this.assertErrorStatusCode(
"/summary?as=AS 8767", 400);
}
- @Test()
+ @Test(timeout = 100)
public void testFlagRunning() {
this.assertSummaryDocument(
"/summary?flag=Running", 3, null, 1, null);
}
- @Test()
+ @Test(timeout = 100)
public void testFlagValid() {
this.assertSummaryDocument(
"/summary?flag=Valid", 3, null, 3, null);
}
- @Test()
+ @Test(timeout = 100)
public void testFlagFast() {
this.assertSummaryDocument(
"/summary?flag=Fast", 2, null, 0, null);
}
- @Test()
+ @Test(timeout = 100)
public void testFlagNamed() {
this.assertSummaryDocument(
"/summary?flag=Named", 1, null, 0, null);
}
- @Test()
+ @Test(timeout = 100)
public void testFlagUnnamed() {
this.assertSummaryDocument(
"/summary?flag=Unnamed", 1, null, 0, null);
}
- @Test()
+ @Test(timeout = 100)
public void testFlagV2Dir() {
this.assertSummaryDocument(
"/summary?flag=V2Dir", 2, null, 0, null);
}
- @Test()
+ @Test(timeout = 100)
public void testFlagGuard() {
this.assertSummaryDocument(
"/summary?flag=Guard", 0, null, 0, null);
}
- @Test()
+ @Test(timeout = 100)
public void testFlagCool() {
this.assertSummaryDocument(
"/summary?flag=Cool", 0, null, 0, null);
}
- @Test()
+ @Test(timeout = 100)
public void testFirstSeenDaysZeroToTwo() {
this.assertSummaryDocument(
"/summary?first_seen_days=0-2", 0, null, 0, null);
}
- @Test()
+ @Test(timeout = 100)
public void testFirstSeenDaysUpToThree() {
this.assertSummaryDocument(
"/summary?first_seen_days=-3", 0, null, 1, null);
}
- @Test()
+ @Test(timeout = 100)
public void testFirstSeenDaysThree() {
this.assertSummaryDocument(
"/summary?first_seen_days=3", 0, null, 1, null);
}
- @Test()
+ @Test(timeout = 100)
public void testFirstSeenDaysTwoToFive() {
this.assertSummaryDocument(
"/summary?first_seen_days=2-5", 0, null, 1, null);
}
- @Test()
+ @Test(timeout = 100)
public void testFirstSeenDaysSevenToSixteen() {
this.assertSummaryDocument(
"/summary?first_seen_days=7-16", 2, null, 1, null);
}
- @Test()
+ @Test(timeout = 100)
public void testFirstSeenDaysNinetysevenOrMore() {
this.assertSummaryDocument(
"/summary?first_seen_days=97-", 0, null, 1, null);
}
- @Test()
+ @Test(timeout = 100)
public void testFirstSeenDaysNinetyeightOrMore() {
this.assertSummaryDocument(
"/summary?first_seen_days=98-", 0, null, 0, null);
}
- @Test()
+ @Test(timeout = 100)
public void testFirstSeenDaysDashDash() {
this.assertErrorStatusCode(
"/summary?first_seen_days=--", 400);
}
- @Test()
+ @Test(timeout = 100)
public void testFirstSeenDaysDashOneDash() {
this.assertErrorStatusCode(
"/summary?first_seen_days=-1-", 400);
}
- @Test()
+ @Test(timeout = 100)
public void testFirstSeenDaysZeroDotDotOne() {
this.assertErrorStatusCode(
"/summary?first_seen_days=0..1", 400);
}
- @Test()
+ @Test(timeout = 100)
public void testFirstSeenDaysElevenDigits() {
this.assertErrorStatusCode(
"/summary?first_seen_days=12345678901", 400);
}
- @Test()
+ @Test(timeout = 100)
public void testFirstSeenDaysLargeTenDigitNumber() {
this.assertErrorStatusCode(
"/summary?first_seen_days=9999999999", 400);
}
- @Test()
+ @Test(timeout = 100)
public void testFirstSeenDaysMaxInt() {
this.assertSummaryDocument(
"/summary?last_seen_days=" + String.valueOf(Integer.MAX_VALUE), 0,
null, 0, null);
}
- @Test()
+ @Test(timeout = 100)
public void testFirstSeenDaysMaxIntPlusOne() {
this.assertErrorStatusCode(
"/summary?first_seen_days="
+ String.valueOf(Integer.MAX_VALUE + 1), 400);
}
- @Test()
+ @Test(timeout = 100)
public void testLastSeenDaysZero() {
this.assertSummaryDocument(
"/summary?last_seen_days=0", 1, null, 1, null);
}
- @Test()
+ @Test(timeout = 100)
public void testLastSeenDaysUpToZero() {
this.assertSummaryDocument(
"/summary?last_seen_days=-0", 1, null, 1, null);
}
- @Test()
+ @Test(timeout = 100)
public void testLastSeenDaysOneToThree() {
this.assertSummaryDocument(
"/summary?last_seen_days=1-3", 1, null, 2, null);
}
- @Test()
+ @Test(timeout = 100)
public void testLastSeenDaysSixOrMore() {
this.assertSummaryDocument(
"/summary?last_seen_days=6-", 0, null, 0, null);
}
- @Test()
+ @Test(timeout = 100)
public void testContactSteven() {
this.assertSummaryDocument(
"/summary?contact=Steven", 1, null, 0, null);
}
- @Test()
+ @Test(timeout = 100)
public void testContactStevenMurdoch() {
this.assertSummaryDocument(
"/summary?contact=Steven Murdoch", 1, null, 0, null);
}
- @Test()
+ @Test(timeout = 100)
public void testContactMurdochSteven() {
this.assertSummaryDocument(
"/summary?contact=Murdoch Steven", 1, null, 0, null);
}
- @Test()
+ @Test(timeout = 100)
public void testContactStevenDotMurdoch() {
this.assertSummaryDocument(
"/summary?contact=Steven.Murdoch", 1, null, 0, null);
}
- @Test()
+ @Test(timeout = 100)
public void testContactFbTokenFive() {
this.assertSummaryDocument(
"/summary?contact=<fb-token:5sR_K_zs2wM=>", 1, null, 0, null);
}
- @Test()
+ @Test(timeout = 100)
public void testContactFbToken() {
this.assertSummaryDocument(
"/summary?contact=<fb-token:", 2, null, 0, null);
}
- @Test()
+ @Test(timeout = 100)
public void testContactDash() {
this.assertSummaryDocument(
"/summary?contact=-", 2, null, 0, null);
}
- @Test()
+ @Test(timeout = 100)
public void testOrderConsensusWeightAscending() {
this.assertSummaryDocument(
"/summary?order=" + OrderParameterValues.CONSENSUS_WEIGHT_ASC, 3,
@@ -1315,7 +1315,7 @@ public class ResourceServletTest {
null);
}
- @Test()
+ @Test(timeout = 100)
public void testOrderConsensusWeightDescending() {
this.assertSummaryDocument(
"/summary?order=" + OrderParameterValues.CONSENSUS_WEIGHT_DES, 3,
@@ -1323,27 +1323,27 @@ public class ResourceServletTest {
null);
}
- @Test()
+ @Test(timeout = 100)
public void testOrderConsensusWeightAscendingTwice() {
this.assertErrorStatusCode(
"/summary?order=" + OrderParameterValues.CONSENSUS_WEIGHT_ASC
+ "," + OrderParameterValues.CONSENSUS_WEIGHT_ASC, 400);
}
- @Test()
+ @Test(timeout = 100)
public void testOrderConsensusWeightAscendingThenDescending() {
this.assertErrorStatusCode(
"/summary?order=" + OrderParameterValues.CONSENSUS_WEIGHT_ASC + ","
+ OrderParameterValues.CONSENSUS_WEIGHT_DES + "", 400);
}
- @Test()
+ @Test(timeout = 100)
public void testOrderConsensusWeightThenNickname() {
this.assertErrorStatusCode(
"/summary?order=consensus_weight,nickname", 400);
}
- @Test()
+ @Test(timeout = 100)
public void testOrderConsensusWeight() {
this.assertSummaryDocument(
"/summary?order=CONSENSUS_WEIGHT", 3,
@@ -1351,7 +1351,7 @@ public class ResourceServletTest {
null);
}
- @Test()
+ @Test(timeout = 100)
public void testOrderConsensusWeightAscendingLimit1() {
this.assertSummaryDocument(
"/summary?order=" + OrderParameterValues.CONSENSUS_WEIGHT_ASC
@@ -1359,7 +1359,7 @@ public class ResourceServletTest {
new String[] { "TorkaZ" }, 0, null);
}
- @Test()
+ @Test(timeout = 100)
public void testOrderConsensusWeightDescendingLimit1() {
this.assertSummaryDocument(
"/summary?order=" + OrderParameterValues.CONSENSUS_WEIGHT_DES
@@ -1367,7 +1367,7 @@ public class ResourceServletTest {
new String[] { "Ferrari458" }, 0, null);
}
- @Test()
+ @Test(timeout = 100)
public void testOrderConsensusWeightFiveTimes() {
this.assertErrorStatusCode(
"/summary?order=" + OrderParameterValues.CONSENSUS_WEIGHT_ASC + ","
@@ -1377,7 +1377,7 @@ public class ResourceServletTest {
+ OrderParameterValues.CONSENSUS_WEIGHT_ASC, 400);
}
- @Test()
+ @Test(timeout = 100)
public void testOrderFirstSeenThenConsensusWeight() {
this.assertSummaryDocument(
"/summary?order=" + OrderParameterValues.FIRST_SEEN_ASC + ","
@@ -1386,7 +1386,7 @@ public class ResourceServletTest {
new String[] { "gummy", null, "ec2bridgercc7f31fe" });
}
- @Test()
+ @Test(timeout = 100)
public void testOrderFirstSeenDescendingThenConsensusWeight() {
this.assertSummaryDocument("/summary?order="
+ OrderParameterValues.FIRST_SEEN_DES + ","
@@ -1395,7 +1395,7 @@ public class ResourceServletTest {
new String[] { "ec2bridgercc7f31fe", null, "gummy" });
}
- @Test()
+ @Test(timeout = 100)
public void testOrderConsensusWeightThenFirstSeenDescending() {
this.assertSummaryDocument(
"/summary?order=" + OrderParameterValues.CONSENSUS_WEIGHT_ASC + ","
@@ -1404,131 +1404,131 @@ public class ResourceServletTest {
null);
}
- @Test()
+ @Test(timeout = 100)
public void testOffsetOne() {
this.assertSkippedReturnedTruncated(
"/summary?offset=1", 1, 2, 0, 0, 3, 0);
}
- @Test()
+ @Test(timeout = 100)
public void testOffsetAllRelays() {
this.assertSkippedReturnedTruncated(
"/summary?offset=3", 3, 0, 0, 0, 3, 0);
}
- @Test()
+ @Test(timeout = 100)
public void testOffsetAllRelaysAndOneBridge() {
this.assertSkippedReturnedTruncated(
"/summary?offset=4", 3, 0, 0, 1, 2, 0);
}
- @Test()
+ @Test(timeout = 100)
public void testOffsetAllRelaysAndAllBridges() {
this.assertSkippedReturnedTruncated(
"/summary?offset=6", 3, 0, 0, 3, 0, 0);
}
- @Test()
+ @Test(timeout = 100)
public void testOffsetMoreThanAllRelaysAndAllBridges() {
this.assertSkippedReturnedTruncated(
"/summary?offset=7", 3, 0, 0, 3, 0, 0);
}
- @Test()
+ @Test(timeout = 100)
public void testOffsetZero() {
this.assertSkippedReturnedTruncated(
"/summary?offset=0", 0, 3, 0, 0, 3, 0);
}
- @Test()
+ @Test(timeout = 100)
public void testOffsetMinusOne() {
this.assertSkippedReturnedTruncated(
"/summary?offset=-1", 0, 3, 0, 0, 3, 0);
}
- @Test()
+ @Test(timeout = 100)
public void testOffsetOneWord() {
this.assertErrorStatusCode(
"/summary?offset=one", 400);
}
- @Test()
+ @Test(timeout = 100)
public void testLimitOne() {
this.assertSkippedReturnedTruncated(
"/summary?limit=1", 0, 1, 2, 0, 0, 3);
}
- @Test()
+ @Test(timeout = 100)
public void testLimitAllRelays() {
this.assertSkippedReturnedTruncated(
"/summary?limit=3", 0, 3, 0, 0, 0, 3);
}
- @Test()
+ @Test(timeout = 100)
public void testLimitAllRelaysAndOneBridge() {
this.assertSkippedReturnedTruncated(
"/summary?limit=4", 0, 3, 0, 0, 1, 2);
}
- @Test()
+ @Test(timeout = 100)
public void testLimitAllRelaysAndAllBridges() {
this.assertSkippedReturnedTruncated(
"/summary?limit=6", 0, 3, 0, 0, 3, 0);
}
- @Test()
+ @Test(timeout = 100)
public void testLimitMoreThanAllRelaysAndAllBridges() {
this.assertSkippedReturnedTruncated(
"/summary?limit=7", 0, 3, 0, 0, 3, 0);
}
- @Test()
+ @Test(timeout = 100)
public void testLimitZero() {
this.assertSkippedReturnedTruncated(
"/summary?limit=0", 0, 0, 3, 0, 0, 3);
}
- @Test()
+ @Test(timeout = 100)
public void testLimitMinusOne() {
this.assertSkippedReturnedTruncated(
"/summary?limit=-1", 0, 0, 3, 0, 0, 3);
}
- @Test()
+ @Test(timeout = 100)
public void testLimitOneWord() {
this.assertErrorStatusCode(
"/summary?limit=one", 400);
}
- @Test()
+ @Test(timeout = 100)
public void testFamilyTorkaZ() {
this.assertSummaryDocument(
"/summary?family=000C5F55BD4814B917CC474BD537F1A3B33CCE2A", 2,
null, 0, null);
}
- @Test()
+ @Test(timeout = 100)
public void testFamilyFerrari458() {
this.assertSummaryDocument(
"/summary?family=001C13B3A55A71B977CA65EC85539D79C653A3FC", 2,
null, 0, null);
}
- @Test()
+ @Test(timeout = 100)
public void testFamilyTimMayTribute() {
this.assertSummaryDocument(
"/summary?family=0025C136C1F3A9EEFE2AE3F918F03BFA21B5070B", 1,
null, 0, null);
}
- @Test()
+ @Test(timeout = 100)
public void testFamilyBridgegummy() {
this.assertSummaryDocument(
"/summary?family=0000831B236DFF73D409AD17B40E2A728A53994F", 0,
null, 0, null);
}
- @Test()
+ @Test(timeout = 100)
public void testFamily39Characters() {
this.assertErrorStatusCode(
"/summary?family=00000000000000000000000000000000000000", 400);
@@ -1542,7 +1542,7 @@ public class ResourceServletTest {
@Test
public void testVersion02324() {
- this.assertSummaryDocument("/summary?version=0.2.3.24-rc-dev", 1,
+ this.assertSummaryDocument("/summary?version=0.2.3.24-rc-dev", 0,
new String[] { "Ferrari458" }, 0, null);
}
@@ -1559,29 +1559,29 @@ public class ResourceServletTest {
@Test
public void testVersion0() {
- this.assertSummaryDocument("/summary?version=0", 3, null, 0, null);
+ this.assertSummaryDocument("/summary?version=0", 2, null, 0, null);
}
@Test
public void testVersion02() {
- this.assertSummaryDocument("/summary?version=0.2", 3, null, 0, null);
+ this.assertSummaryDocument("/summary?version=0.2", 2, null, 0, null);
}
@Test
public void testVersion023() {
- this.assertSummaryDocument("/summary?version=0.2.3", 3, null, 0, null);
+ this.assertSummaryDocument("/summary?version=0.2.3", 2, null, 0, null);
}
@Test
public void testVersion0232() {
/* This is correct when comparing strings. */
- this.assertSummaryDocument("/summary?version=0.2.3.2", 3, null, 0, null);
+ this.assertSummaryDocument("/summary?version=0.2.3.2", 2, null, 0, null);
}
@Test
public void testVersion023Dot() {
/* This is also correct when comparing strings. */
- this.assertSummaryDocument("/summary?version=0.2.3.", 3, null, 0, null);
+ this.assertSummaryDocument("/summary?version=0.2.3.", 2, null, 0, null);
}
@Test
1
0
commit bfc7e2e33dd9f371c8cd801bb7df099c3fca15dd
Author: Karsten Loesing <karsten.loesing(a)gmx.net>
Date: Thu Aug 31 15:39:02 2017 +0200
Prepare for 4.1-1.4.1 release.
---
CHANGELOG.md | 7 +++++++
build.xml | 2 +-
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 20ddb1c..cf75ee8 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,10 @@
+# Changes in version 4.1-1.4.1 - 2017-08-31
+
+ * Medium changes
+ - Fix a NullPointerException in the recently added "version"
+ parameter.
+
+
# Changes in version 4.1-1.4.0 - 2017-08-30
* Medium changes
diff --git a/build.xml b/build.xml
index 41f11c0..921768f 100644
--- a/build.xml
+++ b/build.xml
@@ -10,7 +10,7 @@
<property name="implementation-title" value="Onionoo" />
<property name="onionoo.protocol.version" value="4.1"/>
<property name="release.version"
- value="${onionoo.protocol.version}-1.4.0"/>
+ value="${onionoo.protocol.version}-1.4.1"/>
<property name="metricslibversion" value="2.0.0"/>
<property name="jetty.version" value="-9.2.21.v20170120" />
<property name="warfile"
1
0
31 Aug '17
commit bd86130b0608ee9fb3cb17e8dd180af752a80465
Author: iwakeh <iwakeh(a)torproject.org>
Date: Tue Aug 22 07:41:02 2017 +0000
Limit Onionoo's listening to localhost.
Implements task-23211.
---
INSTALL.md | 5 +++++
src/main/resources/jetty.xml | 1 +
2 files changed, 6 insertions(+)
diff --git a/INSTALL.md b/INSTALL.md
index 4c650bb..6980a06 100644
--- a/INSTALL.md
+++ b/INSTALL.md
@@ -117,6 +117,11 @@ By default, Onionoo is configured to run the updater hourly and provide the
web pages on http://localhost:8080/. The exact timing for the hourly update
runs is logged at start-up.
+Onionoo's Jetty configuration is done in 'jetty.xml', which can be replaced
+in the war-file.
+All configuration options can be found at
+```http://www.eclipse.org/jetty/documentation/```
+The build.xml file contains Onionoo's current jetty version.
### Performing the initial run
diff --git a/src/main/resources/jetty.xml b/src/main/resources/jetty.xml
index f2dce3d..3e53131 100644
--- a/src/main/resources/jetty.xml
+++ b/src/main/resources/jetty.xml
@@ -27,6 +27,7 @@
<Ref id="server"/>
</Arg>
<Set name="port">8080</Set>
+ <Set name="host">127.0.0.1</Set>
</New>
</Arg>
</Call>
1
0