Commit 957d57be authored by Karsten Loesing's avatar Karsten Loesing
Browse files

Allow to distinguish between relay and bridge descriptors.

So far, we did not distinguish between relay and bridge descriptors in
the case of server descriptors and extra-info descriptors.  This works
just fine, because we tried hard to re-use existing keywords in relay
descriptors for sanitized contents in bridge descriptors to facilitate
parsing.

However, some applications process both relay and bridge descriptors
and need to add workarounds for distinguishing between the two.  For
example, they couldn't just read the contents of CollecTor's recent/
directory, because they wouldn't be able to know whether a
ServerDescriptor instance was published by a relay or bridge.  Or even
worse, if an application expects a given directory to contain relay
descriptors and that directory suddenly contains bridge descriptors,
that application wouldn't notice.

This change adds new interfaces to distinguish between relay and
bridge descriptors.  It still supports the existing two interfaces
that don't make this distinction.  Those two interfaces are not
deprecated, because it's okay if an application does not care whether
a descriptor was published by a relay or bridge.

This change is in parts based on a discussion with atagar.  Thanks!

Implements #17000.
parent b50e961a
......@@ -12,6 +12,12 @@
difference between the two is that ExitList.Entry can hold more
than one exit address and scan time which were previously parsed
as multiple ExitListEntry instances.
- Introduce four new types to distinguish between relay and bridge
descriptors: RelayServerDescriptor, RelayExtraInfoDescriptor,
BridgeServerDescriptor, and BridgeExtraInfoDescriptor. The
existing types, ServerDescriptor and ExtraInfoDescriptor, are
still usable and will not be deprecated, because applications may
not care whether a relay or a bridge published a descriptor.
# Changes in version 1.0.0 - 2015-12-05
......
/* Copyright 2015 The Tor Project
* See LICENSE for licensing information */
package org.torproject.descriptor;
/* Contains a bridge extra-info descriptor. */
public interface BridgeExtraInfoDescriptor extends ExtraInfoDescriptor {
}
/* Copyright 2015 The Tor Project
* See LICENSE for licensing information */
package org.torproject.descriptor;
/* Contains a bridge server descriptor. */
public interface BridgeServerDescriptor extends ServerDescriptor {
}
......@@ -5,6 +5,7 @@ package org.torproject.descriptor;
import java.util.List;
import java.util.SortedMap;
/* Contains a relay or bridge extra-info descriptor. */
public interface ExtraInfoDescriptor extends Descriptor {
/* Return the descriptor digest that is used to reference this
......
/* Copyright 2015 The Tor Project
* See LICENSE for licensing information */
package org.torproject.descriptor;
/* Contains a relay extra-info descriptor. */
public interface RelayExtraInfoDescriptor extends ExtraInfoDescriptor {
}
/* Copyright 2015 The Tor Project
* See LICENSE for licensing information */
package org.torproject.descriptor;
/* Contains a relay server descriptor. */
public interface RelayServerDescriptor extends ServerDescriptor {
}
......@@ -4,7 +4,7 @@ package org.torproject.descriptor;
import java.util.List;
/* Contains a relay server descriptor. */
/* Contains a relay or bridge server descriptor. */
public interface ServerDescriptor extends Descriptor {
/* Return the descriptor digest that is used to reference this server
......
/* Copyright 2015 The Tor Project
* See LICENSE for licensing information */
package org.torproject.descriptor.impl;
import java.util.ArrayList;
import java.util.List;
import org.torproject.descriptor.BridgeExtraInfoDescriptor;
import org.torproject.descriptor.DescriptorParseException;
import org.torproject.descriptor.ExtraInfoDescriptor;
public class BridgeExtraInfoDescriptorImpl
extends ExtraInfoDescriptorImpl implements BridgeExtraInfoDescriptor {
protected static List<ExtraInfoDescriptor> parseDescriptors(
byte[] descriptorsBytes, boolean failUnrecognizedDescriptorLines)
throws DescriptorParseException {
List<ExtraInfoDescriptor> parsedDescriptors =
new ArrayList<ExtraInfoDescriptor>();
List<byte[]> splitDescriptorsBytes =
DescriptorImpl.splitRawDescriptorBytes(descriptorsBytes,
"extra-info ");
for (byte[] descriptorBytes : splitDescriptorsBytes) {
ExtraInfoDescriptor parsedDescriptor =
new BridgeExtraInfoDescriptorImpl(descriptorBytes,
failUnrecognizedDescriptorLines);
parsedDescriptors.add(parsedDescriptor);
}
return parsedDescriptors;
}
protected BridgeExtraInfoDescriptorImpl(byte[] descriptorBytes,
boolean failUnrecognizedDescriptorLines)
throws DescriptorParseException {
super(descriptorBytes, failUnrecognizedDescriptorLines);
}
}
/* Copyright 2015 The Tor Project
* See LICENSE for licensing information */
package org.torproject.descriptor.impl;
import java.util.ArrayList;
import java.util.List;
import org.torproject.descriptor.BridgeServerDescriptor;
import org.torproject.descriptor.DescriptorParseException;
import org.torproject.descriptor.ServerDescriptor;
public class BridgeServerDescriptorImpl extends ServerDescriptorImpl
implements BridgeServerDescriptor {
protected static List<ServerDescriptor> parseDescriptors(
byte[] descriptorsBytes, boolean failUnrecognizedDescriptorLines)
throws DescriptorParseException {
List<ServerDescriptor> parsedDescriptors =
new ArrayList<ServerDescriptor>();
List<byte[]> splitDescriptorsBytes =
DescriptorImpl.splitRawDescriptorBytes(descriptorsBytes,
"router ");
for (byte[] descriptorBytes : splitDescriptorsBytes) {
ServerDescriptor parsedDescriptor =
new BridgeServerDescriptorImpl(descriptorBytes,
failUnrecognizedDescriptorLines);
parsedDescriptors.add(parsedDescriptor);
}
return parsedDescriptors;
}
protected BridgeServerDescriptorImpl(byte[] descriptorBytes,
boolean failUnrecognizedDescriptorLines)
throws DescriptorParseException {
super(descriptorBytes, failUnrecognizedDescriptorLines);
}
}
......@@ -48,18 +48,25 @@ public abstract class DescriptorImpl implements Descriptor {
|| firstLines.startsWith("r ")) {
parsedDescriptors.add(new BridgeNetworkStatusImpl(
rawDescriptorBytes, fileName, failUnrecognizedDescriptorLines));
} else if (firstLines.startsWith(
"@type bridge-server-descriptor 1.")) {
parsedDescriptors.addAll(BridgeServerDescriptorImpl.
parseDescriptors(rawDescriptorBytes,
failUnrecognizedDescriptorLines));
} else if (firstLines.startsWith("@type server-descriptor 1.") ||
firstLines.startsWith("@type bridge-server-descriptor 1.") ||
firstLines.startsWith("router ") ||
firstLines.contains("\nrouter ")) {
parsedDescriptors.addAll(ServerDescriptorImpl.
parsedDescriptors.addAll(RelayServerDescriptorImpl.
parseDescriptors(rawDescriptorBytes,
failUnrecognizedDescriptorLines));
} else if (firstLines.startsWith("@type bridge-extra-info 1.")) {
parsedDescriptors.addAll(BridgeExtraInfoDescriptorImpl.
parseDescriptors(rawDescriptorBytes,
failUnrecognizedDescriptorLines));
} else if (firstLines.startsWith("@type extra-info 1.") ||
firstLines.startsWith("@type bridge-extra-info 1.") ||
firstLines.startsWith("extra-info ") ||
firstLines.contains("\nextra-info ")) {
parsedDescriptors.addAll(ExtraInfoDescriptorImpl.
parsedDescriptors.addAll(RelayExtraInfoDescriptorImpl.
parseDescriptors(rawDescriptorBytes,
failUnrecognizedDescriptorLines));
} else if (firstLines.startsWith("@type microdescriptor 1.") ||
......
......@@ -22,26 +22,9 @@ import org.torproject.descriptor.BandwidthHistory;
import org.torproject.descriptor.DescriptorParseException;
import org.torproject.descriptor.ExtraInfoDescriptor;
public class ExtraInfoDescriptorImpl extends DescriptorImpl
public abstract class ExtraInfoDescriptorImpl extends DescriptorImpl
implements ExtraInfoDescriptor {
protected static List<ExtraInfoDescriptor> parseDescriptors(
byte[] descriptorsBytes, boolean failUnrecognizedDescriptorLines)
throws DescriptorParseException {
List<ExtraInfoDescriptor> parsedDescriptors =
new ArrayList<ExtraInfoDescriptor>();
List<byte[]> splitDescriptorsBytes =
DescriptorImpl.splitRawDescriptorBytes(descriptorsBytes,
"extra-info ");
for (byte[] descriptorBytes : splitDescriptorsBytes) {
ExtraInfoDescriptor parsedDescriptor =
new ExtraInfoDescriptorImpl(descriptorBytes,
failUnrecognizedDescriptorLines);
parsedDescriptors.add(parsedDescriptor);
}
return parsedDescriptors;
}
protected ExtraInfoDescriptorImpl(byte[] descriptorBytes,
boolean failUnrecognizedDescriptorLines)
throws DescriptorParseException {
......@@ -70,8 +53,8 @@ public class ExtraInfoDescriptorImpl extends DescriptorImpl
"bridge-stats-end,bridge-stats-ips".split(",")));
Set<String> atMostOnceKeywords = new HashSet<String>(Arrays.asList((
"read-history,write-history,dirreq-read-history,"
+ "dirreq-write-history,geoip-db-digest,router-signature").
split(",")));
+ "dirreq-write-history,geoip-db-digest,router-signature,"
+ "router-digest").split(",")));
atMostOnceKeywords.addAll(dirreqStatsKeywords);
atMostOnceKeywords.addAll(entryStatsKeywords);
atMostOnceKeywords.addAll(cellStatsKeywords);
......
......@@ -284,8 +284,9 @@ public class RelayDirectoryImpl extends DescriptorImpl
protected void parseServerDescriptor(byte[] serverDescriptorBytes) {
try {
ServerDescriptorImpl serverDescriptor = new ServerDescriptorImpl(
serverDescriptorBytes, this.failUnrecognizedDescriptorLines);
ServerDescriptorImpl serverDescriptor =
new RelayServerDescriptorImpl(serverDescriptorBytes,
this.failUnrecognizedDescriptorLines);
this.serverDescriptors.add(serverDescriptor);
} catch (DescriptorParseException e) {
this.serverDescriptorParseExceptions.add(e);
......
/* Copyright 2015 The Tor Project
* See LICENSE for licensing information */
package org.torproject.descriptor.impl;
import java.util.ArrayList;
import java.util.List;
import org.torproject.descriptor.DescriptorParseException;
import org.torproject.descriptor.ExtraInfoDescriptor;
import org.torproject.descriptor.RelayExtraInfoDescriptor;
public class RelayExtraInfoDescriptorImpl
extends ExtraInfoDescriptorImpl implements RelayExtraInfoDescriptor {
protected static List<ExtraInfoDescriptor> parseDescriptors(
byte[] descriptorsBytes, boolean failUnrecognizedDescriptorLines)
throws DescriptorParseException {
List<ExtraInfoDescriptor> parsedDescriptors =
new ArrayList<ExtraInfoDescriptor>();
List<byte[]> splitDescriptorsBytes =
DescriptorImpl.splitRawDescriptorBytes(descriptorsBytes,
"extra-info ");
for (byte[] descriptorBytes : splitDescriptorsBytes) {
ExtraInfoDescriptor parsedDescriptor =
new RelayExtraInfoDescriptorImpl(descriptorBytes,
failUnrecognizedDescriptorLines);
parsedDescriptors.add(parsedDescriptor);
}
return parsedDescriptors;
}
protected RelayExtraInfoDescriptorImpl(byte[] descriptorBytes,
boolean failUnrecognizedDescriptorLines)
throws DescriptorParseException {
super(descriptorBytes, failUnrecognizedDescriptorLines);
}
}
/* Copyright 2015 The Tor Project
* See LICENSE for licensing information */
package org.torproject.descriptor.impl;
import java.util.ArrayList;
import java.util.List;
import org.torproject.descriptor.DescriptorParseException;
import org.torproject.descriptor.RelayServerDescriptor;
import org.torproject.descriptor.ServerDescriptor;
public class RelayServerDescriptorImpl extends ServerDescriptorImpl
implements RelayServerDescriptor {
protected static List<ServerDescriptor> parseDescriptors(
byte[] descriptorsBytes, boolean failUnrecognizedDescriptorLines)
throws DescriptorParseException {
List<ServerDescriptor> parsedDescriptors =
new ArrayList<ServerDescriptor>();
List<byte[]> splitDescriptorsBytes =
DescriptorImpl.splitRawDescriptorBytes(descriptorsBytes,
"router ");
for (byte[] descriptorBytes : splitDescriptorsBytes) {
ServerDescriptor parsedDescriptor =
new RelayServerDescriptorImpl(descriptorBytes,
failUnrecognizedDescriptorLines);
parsedDescriptors.add(parsedDescriptor);
}
return parsedDescriptors;
}
protected RelayServerDescriptorImpl(byte[] descriptorBytes,
boolean failUnrecognizedDescriptorLines)
throws DescriptorParseException {
super(descriptorBytes, failUnrecognizedDescriptorLines);
}
}
......@@ -18,27 +18,10 @@ import org.torproject.descriptor.BandwidthHistory;
import org.torproject.descriptor.DescriptorParseException;
import org.torproject.descriptor.ServerDescriptor;
/* Contains a relay server descriptor. */
public class ServerDescriptorImpl extends DescriptorImpl
/* Contains a server descriptor. */
public abstract class ServerDescriptorImpl extends DescriptorImpl
implements ServerDescriptor {
protected static List<ServerDescriptor> parseDescriptors(
byte[] descriptorsBytes, boolean failUnrecognizedDescriptorLines)
throws DescriptorParseException {
List<ServerDescriptor> parsedDescriptors =
new ArrayList<ServerDescriptor>();
List<byte[]> splitDescriptorsBytes =
DescriptorImpl.splitRawDescriptorBytes(descriptorsBytes,
"router ");
for (byte[] descriptorBytes : splitDescriptorsBytes) {
ServerDescriptor parsedDescriptor =
new ServerDescriptorImpl(descriptorBytes,
failUnrecognizedDescriptorLines);
parsedDescriptors.add(parsedDescriptor);
}
return parsedDescriptors;
}
protected ServerDescriptorImpl(byte[] descriptorBytes,
boolean failUnrecognizedDescriptorLines)
throws DescriptorParseException {
......@@ -53,7 +36,7 @@ public class ServerDescriptorImpl extends DescriptorImpl
+ "read-history,write-history,eventdns,caches-extra-info,"
+ "extra-info-digest,hidden-service-dir,protocols,"
+ "allow-single-hop-exits,onion-key,signing-key,ipv6-policy,"
+ "ntor-onion-key,router-signature").split(",")));
+ "ntor-onion-key,router-signature,router-digest").split(",")));
this.checkAtMostOnceKeywords(atMostOnceKeywords);
this.checkFirstKeyword("router");
if (this.getKeywordCount("accept") == 0 &&
......
......@@ -30,14 +30,14 @@ public class ExtraInfoDescriptorImplTest {
String line) throws DescriptorParseException {
DescriptorBuilder db = new DescriptorBuilder();
db.extraInfoLine = line;
return new ExtraInfoDescriptorImpl(db.buildDescriptor(), true);
return new RelayExtraInfoDescriptorImpl(db.buildDescriptor(), true);
}
private String publishedLine = "published 2012-02-11 09:08:36";
private static ExtraInfoDescriptor createWithPublishedLine(
String line) throws DescriptorParseException {
DescriptorBuilder db = new DescriptorBuilder();
db.publishedLine = line;
return new ExtraInfoDescriptorImpl(db.buildDescriptor(), true);
return new RelayExtraInfoDescriptorImpl(db.buildDescriptor(), true);
}
private String writeHistoryLine = "write-history 2012-02-11 09:03:39 "
+ "(900 s) 4713350144,4723824640,4710717440,4572675072";
......@@ -45,7 +45,7 @@ public class ExtraInfoDescriptorImplTest {
String line) throws DescriptorParseException {
DescriptorBuilder db = new DescriptorBuilder();
db.writeHistoryLine = line;
return new ExtraInfoDescriptorImpl(db.buildDescriptor(), true);
return new RelayExtraInfoDescriptorImpl(db.buildDescriptor(), true);
}
private String readHistoryLine = "read-history 2012-02-11 09:03:39 "
+ "(900 s) 4707695616,4699666432,4650004480,4489718784";
......@@ -53,7 +53,7 @@ public class ExtraInfoDescriptorImplTest {
String line) throws DescriptorParseException {
DescriptorBuilder db = new DescriptorBuilder();
db.readHistoryLine = line;
return new ExtraInfoDescriptorImpl(db.buildDescriptor(), true);
return new RelayExtraInfoDescriptorImpl(db.buildDescriptor(), true);
}
private String dirreqWriteHistoryLine = "dirreq-write-history "
+ "2012-02-11 09:03:39 (900 s) 81281024,64996352,60625920,"
......@@ -62,7 +62,7 @@ public class ExtraInfoDescriptorImplTest {
String line) throws DescriptorParseException {
DescriptorBuilder db = new DescriptorBuilder();
db.dirreqWriteHistoryLine = line;
return new ExtraInfoDescriptorImpl(db.buildDescriptor(), true);
return new RelayExtraInfoDescriptorImpl(db.buildDescriptor(), true);
}
private String dirreqReadHistoryLine = "dirreq-read-history "
+ "2012-02-11 09:03:39 (900 s) 17074176,16235520,16005120,"
......@@ -71,70 +71,70 @@ public class ExtraInfoDescriptorImplTest {
String line) throws DescriptorParseException {
DescriptorBuilder db = new DescriptorBuilder();
db.dirreqReadHistoryLine = line;
return new ExtraInfoDescriptorImpl(db.buildDescriptor(), true);
return new RelayExtraInfoDescriptorImpl(db.buildDescriptor(), true);
}
private String geoipDbDigestLine = null;
private static ExtraInfoDescriptor createWithGeoipDbDigestLine(
String line) throws DescriptorParseException {
DescriptorBuilder db = new DescriptorBuilder();
db.geoipDbDigestLine = line;
return new ExtraInfoDescriptorImpl(db.buildDescriptor(), true);
return new RelayExtraInfoDescriptorImpl(db.buildDescriptor(), true);
}
private String geoip6DbDigestLine = null;
private static ExtraInfoDescriptor createWithGeoip6DbDigestLine(
String line) throws DescriptorParseException {
DescriptorBuilder db = new DescriptorBuilder();
db.geoip6DbDigestLine = line;
return new ExtraInfoDescriptorImpl(db.buildDescriptor(), true);
return new RelayExtraInfoDescriptorImpl(db.buildDescriptor(), true);
}
private String geoipStatsLines = null;
private static ExtraInfoDescriptor createWithGeoipStatsLines(
String lines) throws DescriptorParseException {
DescriptorBuilder db = new DescriptorBuilder();
db.geoipStatsLines = lines;
return new ExtraInfoDescriptorImpl(db.buildDescriptor(), true);
return new RelayExtraInfoDescriptorImpl(db.buildDescriptor(), true);
}
private String dirreqStatsLines = null;
private static ExtraInfoDescriptor createWithDirreqStatsLines(
String lines) throws DescriptorParseException {
DescriptorBuilder db = new DescriptorBuilder();
db.dirreqStatsLines = lines;
return new ExtraInfoDescriptorImpl(db.buildDescriptor(), true);
return new RelayExtraInfoDescriptorImpl(db.buildDescriptor(), true);
}
private String entryStatsLines = null;
private static ExtraInfoDescriptor createWithEntryStatsLines(
String lines) throws DescriptorParseException {
DescriptorBuilder db = new DescriptorBuilder();
db.entryStatsLines = lines;
return new ExtraInfoDescriptorImpl(db.buildDescriptor(), true);
return new RelayExtraInfoDescriptorImpl(db.buildDescriptor(), true);
}
private String cellStatsLines = null;
private static ExtraInfoDescriptor createWithCellStatsLines(
String lines) throws DescriptorParseException {
DescriptorBuilder db = new DescriptorBuilder();
db.cellStatsLines = lines;
return new ExtraInfoDescriptorImpl(db.buildDescriptor(), true);
return new RelayExtraInfoDescriptorImpl(db.buildDescriptor(), true);
}
private String connBiDirectLine = null;
private static ExtraInfoDescriptor createWithConnBiDirectLine(
String line) throws DescriptorParseException {
DescriptorBuilder db = new DescriptorBuilder();
db.connBiDirectLine = line;
return new ExtraInfoDescriptorImpl(db.buildDescriptor(), true);
return new RelayExtraInfoDescriptorImpl(db.buildDescriptor(), true);
}
private String exitStatsLines = null;
private static ExtraInfoDescriptor createWithExitStatsLines(
String lines) throws DescriptorParseException {
DescriptorBuilder db = new DescriptorBuilder();
db.exitStatsLines = lines;
return new ExtraInfoDescriptorImpl(db.buildDescriptor(), true);
return new RelayExtraInfoDescriptorImpl(db.buildDescriptor(), true);
}
private String bridgeStatsLines = null;
private static ExtraInfoDescriptor createWithBridgeStatsLines(
String lines) throws DescriptorParseException {
DescriptorBuilder db = new DescriptorBuilder();
db.bridgeStatsLines = lines;
return new ExtraInfoDescriptorImpl(db.buildDescriptor(), true);
return new RelayExtraInfoDescriptorImpl(db.buildDescriptor(), true);
}
private String unrecognizedLine = null;
private static ExtraInfoDescriptor createWithUnrecognizedLine(
......@@ -142,7 +142,7 @@ public class ExtraInfoDescriptorImplTest {
throws DescriptorParseException {
DescriptorBuilder db = new DescriptorBuilder();
db.unrecognizedLine = line;
return new ExtraInfoDescriptorImpl(db.buildDescriptor(),
return new RelayExtraInfoDescriptorImpl(db.buildDescriptor(),
failUnrecognizedDescriptorLines);
}
private byte[] nonAsciiLineBytes = null;
......@@ -151,7 +151,7 @@ public class ExtraInfoDescriptorImplTest {
throws DescriptorParseException {
DescriptorBuilder db = new DescriptorBuilder();
db.nonAsciiLineBytes = lineBytes;
return new ExtraInfoDescriptorImpl(db.buildDescriptor(),
return new RelayExtraInfoDescriptorImpl(db.buildDescriptor(),
failUnrecognizedDescriptorLines);
}
private String routerSignatureLines = "router-signature\n"
......@@ -164,7 +164,7 @@ public class ExtraInfoDescriptorImplTest {
String line) throws DescriptorParseException {
DescriptorBuilder db = new DescriptorBuilder();
db.routerSignatureLines = line;
return new ExtraInfoDescriptorImpl(db.buildDescriptor(), true);
return new RelayExtraInfoDescriptorImpl(db.buildDescriptor(), true);
}
private byte[] buildDescriptor() {
StringBuilder sb = new StringBuilder();
......@@ -715,7 +715,7 @@ public class ExtraInfoDescriptorImplTest {
public void testSampleDescriptor() throws DescriptorParseException {
DescriptorBuilder db = new DescriptorBuilder();
ExtraInfoDescriptor descriptor =
new ExtraInfoDescriptorImpl(db.buildDescriptor(), true);
new RelayExtraInfoDescriptorImpl(db.buildDescriptor(), true);
assertEquals("chaoscomputerclub5", descriptor.getNickname());
assertEquals("A9C039A5FD02FCA06303DCFAABE25C5912C63B26",
descriptor.getFingerprint());
......
......@@ -32,14 +32,14 @@ public class ServerDescriptorImplTest {
String line) throws DescriptorParseException {
DescriptorBuilder db = new DescriptorBuilder();
db.routerLine = line;
return new ServerDescriptorImpl(db.buildDescriptor(), true);
return new RelayServerDescriptorImpl(db.buildDescriptor(), true);
}
private String bandwidthLine = "bandwidth 51200 51200 53470";
private static ServerDescriptor createWithBandwidthLine(
String line) throws DescriptorParseException {
DescriptorBuilder db = new DescriptorBuilder();
db.bandwidthLine = line;
return new ServerDescriptorImpl(db.buildDescriptor(), true);
return new RelayServerDescriptorImpl(db.buildDescriptor(), true);
}
private String platformLine = "platform Tor 0.2.2.35 "
+ "(git-b04388f9e7546a9f) on Linux i686";
......@@ -47,14 +47,14 @@ public class ServerDescriptorImplTest {
String line) throws DescriptorParseException {
DescriptorBuilder db = new DescriptorBuilder();
db.platformLine = line;
return new ServerDescriptorImpl(db.buildDescriptor(), true);
return new RelayServerDescriptorImpl(db.buildDescriptor(), true);
}
private String publishedLine = "published 2012-01-01 04:03:19";
private static ServerDescriptor createWithPublishedLine(
String line) throws DescriptorParseException {
DescriptorBuilder db = new DescriptorBuilder();
db.publishedLine = line;
return new ServerDescriptorImpl(db.buildDescriptor(), true);
return new RelayServerDescriptorImpl(db.buildDescriptor(), true);
}
private String fingerprintLine = "opt fingerprint D873 3048 FC8E "
+ "C910 2466 AD8F 3098 622B F1BF 71FD";
......@@ -62,21 +62,21 @@ public class ServerDescriptorImplTest {
String line) throws DescriptorParseException {
DescriptorBuilder db = new DescriptorBuilder();
db.fingerprintLine = line;
return new ServerDescriptorImpl(db.buildDescriptor(), true);
return new RelayServerDescriptorImpl(db.buildDescriptor(), true);
}
private String hibernatingLine = null;
private static ServerDescriptor createWithHibernatingLine(
String line) throws DescriptorParseException {
DescriptorBuilder db = new DescriptorBuilder();
db.hibernatingLine = line;
return new ServerDescriptorImpl(db.buildDescriptor(), true);
return new RelayServerDescriptorImpl(db.buildDescriptor(), true);
}
private String uptimeLine = "uptime 48";
private static ServerDescriptor createWithUptimeLine(
String line) throws DescriptorParseException {
DescriptorBuilder db = new DescriptorBuilder();
db.uptimeLine = line;
return new ServerDescriptorImpl(db.buildDescriptor(), true);
return new RelayServerDescriptorImpl(db.buildDescriptor(), true);
}
private String onionKeyLines = "onion-key\n"
+ "-----BEGIN RSA PUBLIC KEY-----\n"
......@@ -89,7 +89,7 @@ public class ServerDescriptorImplTest {
String lines) throws DescriptorParseException {
DescriptorBuilder db = new DescriptorBuilder();
db.onionKeyLines = lines;
return new ServerDescriptorImpl(db.buildDescriptor(), true);
return new RelayServerDescriptorImpl(db.buildDescriptor(), true);
}
private String signingKeyLines = "signing-key\n"
+ "-----BEGIN RSA PUBLIC KEY-----\n"
......@@ -102,14 +102,14 @@ public class ServerDescriptorImplTest {
String lines) throws DescriptorParseException {