[or-cvs] r11311: minor usability changes to dist storage tests (puppetor/trunk/src/de/uniba/wiai/lspi/puppetor/diststorage)
kloesing at seul.org
kloesing at seul.org
Wed Aug 29 21:36:34 UTC 2007
Author: kloesing
Date: 2007-08-29 17:36:34 -0400 (Wed, 29 Aug 2007)
New Revision: 11311
Modified:
puppetor/trunk/src/de/uniba/wiai/lspi/puppetor/diststorage/AdvertisingAndAccessingV2HiddenServiceOverPrivateTorNetwork.java
puppetor/trunk/src/de/uniba/wiai/lspi/puppetor/diststorage/HidServDirectoryTest.java
Log:
minor usability changes to dist storage tests
Modified: puppetor/trunk/src/de/uniba/wiai/lspi/puppetor/diststorage/AdvertisingAndAccessingV2HiddenServiceOverPrivateTorNetwork.java
===================================================================
--- puppetor/trunk/src/de/uniba/wiai/lspi/puppetor/diststorage/AdvertisingAndAccessingV2HiddenServiceOverPrivateTorNetwork.java 2007-08-29 21:05:06 UTC (rev 11310)
+++ puppetor/trunk/src/de/uniba/wiai/lspi/puppetor/diststorage/AdvertisingAndAccessingV2HiddenServiceOverPrivateTorNetwork.java 2007-08-29 21:36:34 UTC (rev 11311)
@@ -1,5 +1,6 @@
package de.uniba.wiai.lspi.puppetor.diststorage;
+import java.util.Date;
import java.util.Random;
import de.uniba.wiai.lspi.puppetor.ClientApplication;
@@ -33,51 +34,74 @@
*/
public static void main(String[] args) throws TorProcessException {
+ int portStart = 7000;
+
+ if (args.length == 1) {
+ try {
+ portStart = Integer.parseInt(args[0]);
+ } catch (NumberFormatException e) {
+ System.out
+ .println("Usage: java "
+ + AdvertisingAndAccessingV2HiddenServiceOverPrivateTorNetwork.class
+ .getCanonicalName() + " [basePort]");
+ System.exit(1);
+ }
+ }
+
// create a network to initialize a test case
Network network = NetworkFactory.createNetwork("example4");
+ System.out.println(new Date() + ": Starting test run "
+ + network.getWorkingDirectory().getName());
+
// create two directory nodes with parameters (router name, control
// port, SOCKS port, OR port, dir port)
- DirectoryNode dir1 = network.createDirectory("dir1", 7001, 7002, 7003,
- 7004);
- DirectoryNode dir2 = network.createDirectory("dir2", 7011, 7012, 7013,
- 7014);
+ DirectoryNode dir1 = network.createDirectory("dir1", portStart + 1,
+ portStart + 2, portStart + 3, portStart + 4);
+ DirectoryNode dir2 = network.createDirectory("dir2", portStart + 11,
+ portStart + 12, portStart + 13, portStart + 14);
// create three router nodes with parameters (router name, control port,
// SOCKS port, OR port, dir mirror port)
- RouterNode router1 = network.createRouter("router1", 7021, 7022, 7023,
- 7024);
- RouterNode router2 = network.createRouter("router2", 7031, 7032, 7033,
- 7034);
- RouterNode router3 = network.createRouter("router3", 7041, 7042, 7043,
- 7044);
- RouterNode router4 = network.createRouter("router4", 7051, 7052, 7053,
- 7054);
+ RouterNode router1 = network.createRouter("router1", portStart + 21,
+ portStart + 22, portStart + 23, portStart + 24);
+ RouterNode router2 = network.createRouter("router2", portStart + 31,
+ portStart + 32, portStart + 33, portStart + 34);
+ RouterNode router3 = network.createRouter("router3", portStart + 41,
+ portStart + 42, portStart + 43, portStart + 44);
+ RouterNode router4 = network.createRouter("router4", portStart + 51,
+ portStart + 52, portStart + 53, portStart + 54);
// configure all nodes hidden service directories
dir1.addConfiguration("HidServDirectoryV2 1");
+ dir1.addConfiguration("MinUptimeHidServDirectoryV2 0 minutes");
+ dir1.addConfiguration("ConsiderAllRoutersAsHidServDirectories 1");
dir2.addConfiguration("HidServDirectoryV2 1");
- dir1.addConfiguration("MinUptimeHidServDirectoryV2 0 minutes");
dir2.addConfiguration("MinUptimeHidServDirectoryV2 0 minutes");
+ dir2.addConfiguration("ConsiderAllRoutersAsHidServDirectories 1");
router1.addConfiguration("HidServDirectoryV2 1");
router2.addConfiguration("HidServDirectoryV2 1");
router3.addConfiguration("HidServDirectoryV2 1");
router4.addConfiguration("HidServDirectoryV2 1");
// add hidden service
- router1.addHiddenService("hidServ", 7025, 80);
+ router1.addHiddenService("hidServ", portStart + 25, 80);
// re-configure routers 1 and 3 for V2 compatibility
router1.addConfiguration("PublishHidServDescriptors 0");
router1.addConfiguration("PublishV2HidServDescriptors 1");
router1.addConfiguration("FetchHidServDescriptors 0");
router1.addConfiguration("FetchV2HidServDescriptors 1");
+ router1.addConfiguration("ConsiderAllRoutersAsHidServDirectories 1");
router2.addConfiguration("FetchHidServDescriptors 0");
router2.addConfiguration("FetchV2HidServDescriptors 1");
+ router2.addConfiguration("ConsiderAllRoutersAsHidServDirectories 1");
router3.addConfiguration("FetchHidServDescriptors 0");
router3.addConfiguration("FetchV2HidServDescriptors 1");
+ router3.addConfiguration("ConsiderAllRoutersAsHidServDirectories 1");
router4.addConfiguration("FetchHidServDescriptors 0");
router4.addConfiguration("FetchV2HidServDescriptors 1");
+ router4.addConfiguration("ConsiderAllRoutersAsHidServDirectories 1");
// configure nodes of this network to be part of a private network
network.configureAsPrivateNetwork();
@@ -148,7 +172,8 @@
String onionAddress = router1.getOnionAddress("hidServ", 2);
// create server application
- ServerApplication server = network.createServer("server", 7025);
+ ServerApplication server = network.createServer("server",
+ portStart + 25);
// start server
server.listen();
@@ -159,7 +184,7 @@
for (int i = 0; i < 10; i++) {
- int socksPort = 7022 + rnd.nextInt(4) * 10;
+ int socksPort = portStart + 22 + rnd.nextInt(4) * 10;
System.out.println("Socks Port = " + socksPort);
// create client application
Modified: puppetor/trunk/src/de/uniba/wiai/lspi/puppetor/diststorage/HidServDirectoryTest.java
===================================================================
--- puppetor/trunk/src/de/uniba/wiai/lspi/puppetor/diststorage/HidServDirectoryTest.java 2007-08-29 21:05:06 UTC (rev 11310)
+++ puppetor/trunk/src/de/uniba/wiai/lspi/puppetor/diststorage/HidServDirectoryTest.java 2007-08-29 21:36:34 UTC (rev 11311)
@@ -7,6 +7,7 @@
import java.net.Socket;
import java.security.Security;
import java.util.ArrayList;
+import java.util.Date;
import java.util.HashSet;
import java.util.List;
import java.util.Random;
@@ -175,24 +176,20 @@
*/
public static void main(String[] args) throws TorProcessException {
- int numberOfDescs = 10;
+ int portStart = 7000;
if (args.length == 1) {
try {
- numberOfDescs = Integer.parseInt(args[0]);
+ portStart = Integer.parseInt(args[0]);
} catch (NumberFormatException e) {
System.out.println("Usage: java "
+ HidServDirectoryTest.class.getCanonicalName()
- + " [numberOfDescs]");
+ + " [basePort]");
System.exit(1);
}
}
- if (numberOfDescs < 0 || numberOfDescs > 1000) {
- System.out.println("Bad value for numberOfDescs: " + numberOfDescs
- + "! Setting to 10.");
- numberOfDescs = 10;
- }
+ int numberOfDescs = 10;
Security.addProvider(new BouncyCastleProvider());
@@ -200,23 +197,26 @@
// create a network to initialize a test case
Network network = NetworkFactory.createNetwork("example4");
+ System.out.println(new Date() + ": Starting test run "
+ + network.getWorkingDirectory().getName());
+
// create two directory nodes with parameters (router name, control
// port, SOCKS port, OR port, dir port)
- DirectoryNode dir1 = network.createDirectory("dir1", 7001, 7002, 7003,
- 7004);
- DirectoryNode dir2 = network.createDirectory("dir2", 7011, 7012, 7013,
- 7014);
+ DirectoryNode dir1 = network.createDirectory("dir1", portStart + 1,
+ portStart + 2, portStart + 3, portStart + 4);
+ DirectoryNode dir2 = network.createDirectory("dir2", portStart + 11,
+ portStart + 12, portStart + 13, portStart + 14);
// create three router nodes with parameters (router name, control port,
// SOCKS port, OR port, dir mirror port)
- RouterNode router1 = network.createRouter("router1", 7021, 7022, 7023,
- 7024);
- RouterNode router2 = network.createRouter("router2", 7031, 7032, 7033,
- 7034);
- RouterNode router3 = network.createRouter("router3", 7041, 7042, 7043,
- 7044);
- RouterNode router4 = network.createRouter("router4", 7051, 7052, 7053,
- 7054);
+ RouterNode router1 = network.createRouter("router1", portStart + 21,
+ portStart + 22, portStart + 23, portStart + 24);
+ RouterNode router2 = network.createRouter("router2", portStart + 31,
+ portStart + 32, portStart + 33, portStart + 34);
+ RouterNode router3 = network.createRouter("router3", portStart + 41,
+ portStart + 42, portStart + 43, portStart + 44);
+ RouterNode router4 = network.createRouter("router4", portStart + 51,
+ portStart + 52, portStart + 53, portStart + 54);
Set<RouterNode> allRouters = new HashSet<RouterNode>();
allRouters.add(dir1);
@@ -262,9 +262,9 @@
}
System.out.println("Successfully built circuits!");
- // wait for 30 minutes for stabilization
+ // wait for 1 hour for stabilization
try {
- Thread.sleep(30 * 60 * 1000);
+ Thread.sleep(60 * 60 * 1000);
} catch (InterruptedException e1) {
e1.printStackTrace();
}
More information about the tor-commits
mailing list