[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [metrics-tasks/master] Commit HSDir-set-listing scripts for #2649



commit 22eb1da05f6a0b667f9ba03ca700fc341a3722f6
Author: Robert Ransom <rransom.8774@xxxxxxxxx>
Date:   Tue May 24 13:06:02 2011 -0700

    Commit HSDir-set-listing scripts for #2649
    
    The scripts were done early on 2011-04-18, but never committed.
---
 task-2649/.gitignore                     |    2 +
 task-2649/README                         |   31 ++++++++++++++++++++++++++++++
 task-2649/generate-consensus-hsdir-lists |   28 +++++++++++++++++++++++++++
 task-2649/list-consensus-hsdirs          |   19 ++++++++++++++++++
 task-2649/list-consensus-hsdirs.awk      |   25 ++++++++++++++++++++++++
 5 files changed, 105 insertions(+), 0 deletions(-)

diff --git a/task-2649/.gitignore b/task-2649/.gitignore
new file mode 100644
index 0000000..c77b69b
--- /dev/null
+++ b/task-2649/.gitignore
@@ -0,0 +1,2 @@
+dev/
+out/
diff --git a/task-2649/README b/task-2649/README
new file mode 100644
index 0000000..4283696
--- /dev/null
+++ b/task-2649/README
@@ -0,0 +1,31 @@
+
+Purpose:
+
+  These scripts are intended to determine how unstable the set of
+  relays with the HSDir flag is.
+
+Dependencies:
+
+  You will need linedemux and linemux installed.  See branch parrun in
+  https://gitweb.torproject.org/rransom/tor-utils.git for now.
+
+  You will also need Tcl 8.5.9 and gnuplot 4.4.0 installed.
+
+Instructions:
+
+  First, unpack all of the v3 consensus archive tarballs you want to
+  analyze into a single directory, and set the consensus_archive_dir
+  environment variable to point to that directory.
+
+  Then run:
+
+    ./generate-consensus-hsdir-lists
+    ./compute-hsdir-set-instability
+    ./graph-hsdir-set-instability
+
+Bugs:
+
+  This code compares each consensus with each of the four following
+  consensuses; it should compare each hour's consensus with the
+  consensuses in effect in each of the four following hours.
+
diff --git a/task-2649/generate-consensus-hsdir-lists b/task-2649/generate-consensus-hsdir-lists
new file mode 100755
index 0000000..104e4bc
--- /dev/null
+++ b/task-2649/generate-consensus-hsdir-lists
@@ -0,0 +1,28 @@
+#!/bin/sh
+
+# This script must be run as ./generate-consensus-hsdir-lists .
+
+# This script will die horribly later if $consensus_archive_dir
+# expands to a string containing a shell metacharacter, so don't try
+# to not die now.
+test -z $consensus_archive_dir &&
+export consensus_archive_dir=/usr/local/opt/tor-consensuses
+
+
+mkdir -m 0700 -p dev/
+for i in 0 1 2 3 ;do mkfifo -m 0600 dev/in$i dev/out$i ;done
+
+mkdir -p out/consensus-hsdir-lists
+
+
+(cd "$consensus_archive_dir" ;find consensuses-* -type f -print ) |
+sed -e 's|^|./list-consensus-hsdirs |' |
+linedemux --fname -- dev/in0 dev/in1 dev/in2 dev/in3 &
+
+sh <dev/in0 >dev/out0 &
+sh <dev/in1 >dev/out1 &
+sh <dev/in2 >dev/out2 &
+sh <dev/in3 >dev/out3 &
+
+linemux --fname -- dev/out0 dev/out1 dev/out2 dev/out3
+
diff --git a/task-2649/list-consensus-hsdirs b/task-2649/list-consensus-hsdirs
new file mode 100755
index 0000000..1b10243
--- /dev/null
+++ b/task-2649/list-consensus-hsdirs
@@ -0,0 +1,19 @@
+#!/bin/sh
+
+# This script must be run as ./list-consensus-hsdirs , by
+# generate-consensus-hsdir-lists.
+
+consensus_file="$1"
+
+
+consensus_basename="$(basename "$consensus_file" -consensus )"
+hsdir_list_dir="out/consensus-hsdir-lists/$(echo "$consensus_basename" |cut -f 1-2 -d - )"
+hsdir_list_name="$hsdir_list_dir/$consensus_basename"
+
+
+mkdir -p "$hsdir_list_dir"
+
+awk -f list-consensus-hsdirs.awk <"$consensus_archive_dir/$consensus_file" >"$hsdir_list_name"
+
+echo "generated HSDir list $consensus_basename"
+
diff --git a/task-2649/list-consensus-hsdirs.awk b/task-2649/list-consensus-hsdirs.awk
new file mode 100644
index 0000000..343c5e7
--- /dev/null
+++ b/task-2649/list-consensus-hsdirs.awk
@@ -0,0 +1,25 @@
+
+BEGIN {
+    OFS=":"
+    idDigest="<oops>"
+}
+
+$1 == "r" {
+    idDigest=$3
+}
+
+$1 == "s" {
+    isHSDir=0
+    for (i = NF; i >= 1; --i) {
+        if ($i == "HSDir") {
+            isHSDir=1
+        }
+    }
+
+    if (isHSDir != 0) {
+        print idDigest
+    }
+
+    idDigest="<oops>"
+}
+



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits