[tor-commits] [flashproxy/master] Add remote-tor-direct.sh.

dcf at torproject.org dcf at torproject.org
Fri Nov 4 21:59:36 UTC 2011


commit 64918e685118a140dc1f5cd177a888ea1a0e7f39
Author: David Fifield <david at bamsoftware.com>
Date:   Fri Nov 4 14:01:43 2011 -0700

    Add remote-tor-direct.sh.
    
    This tests the speed of a Tor download without any flash proxy.
---
 experiments/switching/remote-tor-direct.sh |   37 ++++++++++++++++++++++++++++
 experiments/switching/switching-all.sh     |    3 ++
 experiments/switching/torrc.bridge         |    5 ++++
 3 files changed, 45 insertions(+), 0 deletions(-)

diff --git a/experiments/switching/remote-tor-direct.sh b/experiments/switching/remote-tor-direct.sh
new file mode 100755
index 0000000..1b6bdaa
--- /dev/null
+++ b/experiments/switching/remote-tor-direct.sh
@@ -0,0 +1,37 @@
+#!/bin/bash
+
+# Usage: ./remote-tor-direct.sh [OUTPUT_FILENAME]
+#
+# Tests a Tor download without using a flash proxy. If OUTPUT_FILENAME is
+# supplied, appends the time measurement to that file.
+
+. ../common.sh
+
+DATA_FILE_NAME="$FLASHPROXY_DIR/dump"
+OUTPUT_FILENAME="$1"
+
+# Declare an array.
+declare -a PIDS_TO_KILL
+stop() {
+	if [ -n "${PIDS_TO_KILL[*]}" ]; then
+		echo "Kill pids ${PIDS_TO_KILL[@]}."
+		kill "${PIDS_TO_KILL[@]}"
+	fi
+	echo "Delete data file."
+	rm -f "$DATA_FILE_NAME"
+	exit
+}
+trap stop EXIT
+
+echo "Start Tor."
+"$TOR" -f torrc.bridge &
+PIDS_TO_KILL+=($!)
+
+# Let Tor bootstrap.
+visible_sleep 15
+
+if [ -n "$OUTPUT_FILENAME" ]; then
+	real_time torify wget http://torperf.torproject.org/.5mbfile --wait=0 --waitretry=0 -c -t 0 -O "$DATA_FILE_NAME" >> "$OUTPUT_FILENAME"
+else
+	real_time torify wget http://torperf.torproject.org/.5mbfile --wait=0 --waitretry=0 -c -t 0 -O "$DATA_FILE_NAME"
+fi
diff --git a/experiments/switching/switching-all.sh b/experiments/switching/switching-all.sh
index b3051cc..f306152 100755
--- a/experiments/switching/switching-all.sh
+++ b/experiments/switching/switching-all.sh
@@ -28,6 +28,9 @@ repeat $NUM_ITERATIONS ./local-http-constant.sh "local-http-constant-$DATE.log"
 > "local-http-alternating-$DATE.log"
 repeat $NUM_ITERATIONS ./local-http-alternating.sh "local-http-alternating-$DATE.log"
 
+> "remote-tor-direct-$DATE.log"
+repeat $NUM_ITERATIONS ./remote-tor-direct.sh "remote-tor-direct-$DATE.log"
+
 > "remote-tor-constant-$DATE.log"
 repeat $NUM_ITERATIONS ./remote-tor-constant.sh "remote-tor-constant-$DATE.log"
 
diff --git a/experiments/switching/torrc.bridge b/experiments/switching/torrc.bridge
new file mode 100644
index 0000000..d70c8b1
--- /dev/null
+++ b/experiments/switching/torrc.bridge
@@ -0,0 +1,5 @@
+# This configuration file causes a direct Tor connection to use the same bridge
+# used by a flash proxy.
+
+UseBridges 1
+Bridge tor1.bamsoftware.com:9001



More information about the tor-commits mailing list