P2PRtt Metric has configurable Tor proxy port

This commit is contained in:
Florian Reimair 2019-01-21 18:21:04 +01:00
parent ad2de68140
commit 3c6566b65f
3 changed files with 9 additions and 2 deletions

View file

@ -51,6 +51,7 @@ public class P2PRoundTripTime extends Metric implements MessageListener, SetupLi
private static final String SAMPLE_SIZE = "run.sampleSize"; private static final String SAMPLE_SIZE = "run.sampleSize";
private static final String HOSTS = "run.hosts"; private static final String HOSTS = "run.hosts";
private static final String TOR_PROXY_PORT = "run.torProxyPort";
private NetworkNode networkNode; private NetworkNode networkNode;
private final File torWorkingDirectory = new File("metric_p2pRoundTripTime"); private final File torWorkingDirectory = new File("metric_p2pRoundTripTime");
private int nonce; private int nonce;
@ -86,8 +87,7 @@ public class P2PRoundTripTime extends Metric implements MessageListener, SetupLi
@Override @Override
public void configure(Properties properties) { public void configure(Properties properties) {
super.configure(properties); super.configure(properties);
networkNode = new TorNetworkNode(Integer.parseInt(configuration.getProperty(TOR_PROXY_PORT, "9052")), new CoreNetworkProtoResolver(), false,
networkNode = new TorNetworkNode(9052, new CoreNetworkProtoResolver(), false,
new NewTor(torWorkingDirectory, "", "", null)); new NewTor(torWorkingDirectory, "", "", null));
networkNode.start(this); networkNode.start(this);
} }

View file

@ -24,6 +24,12 @@ TorHiddenServiceStartupTime.run.interval=100
TorHiddenServiceStartupTime.run.localPort=90501 TorHiddenServiceStartupTime.run.localPort=90501
TorHiddenServiceStartupTime.run.servicePort=90511 TorHiddenServiceStartupTime.run.servicePort=90511
#P2PRoundTripTime Metric
P2PRoundTripTime.enabled=true
P2PRoundTripTime.run.interval=100
P2PRoundTripTime.run.sampleSize=5
P2PRoundTripTime.run.hosts=http://723ljisnynbtdohi.onion:8000, fl3mmribyxgrv63c.onion:8000
#Another Metric #Another Metric
Another.run.interval=5 Another.run.interval=5

View file

@ -81,6 +81,7 @@ public class P2PRoundTripTimeTests {
configuration.put("P2PRoundTripTime.run.sampleSize", sampleSize); configuration.put("P2PRoundTripTime.run.sampleSize", sampleSize);
// torproject.org hidden service // torproject.org hidden service
configuration.put("P2PRoundTripTime.run.hosts", "http://expyuzz4wqqyqhjn.onion:80"); configuration.put("P2PRoundTripTime.run.hosts", "http://expyuzz4wqqyqhjn.onion:80");
configuration.put("P2PRoundTripTime.run.torProxyPort", "9052");
Metric DUT = new P2PRoundTripTime(reporter); Metric DUT = new P2PRoundTripTime(reporter);
// start // start