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

[tor-commits] [flashproxy/master] Let swfcat get the relay from the facilitator.



commit c48df422a4eb497d5cc65a77f4d987f3d4999cbf
Author: David Fifield <david@xxxxxxxxxxxxxxx>
Date:   Fri Jun 10 03:15:59 2011 -0700

    Let swfcat get the relay from the facilitator.
---
 README     |    9 +++++----
 design.txt |    6 +++---
 swfcat.as  |   27 ++++++++++++++-------------
 3 files changed, 22 insertions(+), 20 deletions(-)

diff --git a/README b/README
index 4e58907..b4b1d0e 100644
--- a/README
+++ b/README
@@ -81,8 +81,8 @@ changing pool of addresses.
 
 == Design notes
 
-The Tor relay address is hardcoded in swfcat.as. It could be any relay,
-with the caveat that the server also has to serve a crossdomain policy.
+Any Tor relay can be used, as long as it also serves a crossdomain
+policy.
 
 The Tor client needs to be able to listen for an incoming connection,
 which generally means not being behind NAT.
@@ -94,11 +94,12 @@ Clients register with the facilitator by sending an HTTP message:
 The Flash proxy also gets a client address over HTTP:
 	GET / HTTP/1.0\r\n
 	\r\n
-The server sends back an address specification in an HTTP respose.
+The server sends back address specifications of a client and a relay in
+an HTTP respose.
 	HTTP/1.0 200 OK\r\n
 	Server: BaseHTTP/0.3 Python/2.5.2\r\n
 	\r\n
-	client=1.2.3.4%3A9000
+	client=1.2.3.4%3A9000&relay=9.9.9.9:9001
 
 == ActionScript programming
 
diff --git a/design.txt b/design.txt
index abc53a4..27be8ab 100644
--- a/design.txt
+++ b/design.txt
@@ -128,8 +128,8 @@ Design of Flash proxies
 7. Behavior of the Flash proxy
 
   The Flash proxy polls the facilitator for client registrations. When
-  it receives a registration, it opens one connection to a Tor relay,
-  one to the given client, and begin proxying data between them.
+  it receives a registration, it opens one connection to the given Tor
+  relay, one to the given client, and begin proxying data between them.
 
   The proxy asks the facilitator for a registration with an HTTP GET
   request:
@@ -139,7 +139,7 @@ Design of Flash proxies
 
   The response code is 200 and the body looks like this:
 
-    client=[<address>:<port>]
+    client=[<address>:<port>]&relay=<address>:<port>
 
   If <address>:<port> is missing, it means that there are no client
   registrations for this proxy.
diff --git a/swfcat.as b/swfcat.as
index 34983ce..8c91ae8 100644
--- a/swfcat.as
+++ b/swfcat.as
@@ -18,12 +18,6 @@ package
 
     public class swfcat extends Sprite
     {
-        /* David's relay (nickname 3VXRyxz67OeRoqHn) that also serves a
-           crossdomain policy. */
-        private const DEFAULT_RELAY_ADDR:Object = {
-            host: "173.255.221.44",
-            port: 9001
-        };
         private const DEFAULT_FACILITATOR_ADDR:Object = {
             host: "tor-facilitator.bamsoftware.com",
             port: 9002
@@ -43,7 +37,6 @@ package
         private var output_text:TextField;
 
         private var fac_addr:Object;
-        private var relay_addr:Object;
 
         /* Number of proxy pairs currently connected (up to
            MAX_NUM_PROXY_PAIRS). */
@@ -158,11 +151,6 @@ package
                 puts("Error: Facilitator spec must be in the form \"host:port\".");
                 return;
             }
-            relay_addr = get_param_addr("relay", DEFAULT_RELAY_ADDR);
-            if (!relay_addr) {
-                puts("Error: Relay spec must be in the form \"host:port\".");
-                return;
-            }
 
             main();
         }
@@ -213,6 +201,8 @@ package
             var loader:URLLoader;
             var client_spec:String;
             var client_addr:Object;
+            var relay_spec:String;
+            var relay_addr:Object;
             var proxy_pair:Object;
 
             setTimeout(main, FACILITATOR_POLL_INTERVAL);
@@ -226,13 +216,24 @@ package
                 puts("Error: missing \"client\" in response.");
                 return;
             }
-            puts("Facilitator: got \"" + client_spec + "\".");
+            relay_spec = loader.data.relay;
+            if (!relay_spec) {
+                puts("Error: missing \"relay\" in response.");
+                return;
+            }
+            puts("Facilitator: got client:\"" + client_spec + "\" "
+                + "relay:\"" + relay_spec + "\".");
 
             client_addr = parse_addr_spec(client_spec);
             if (!client_addr) {
                 puts("Error: Client spec must be in the form \"host:port\".");
                 return;
             }
+            relay_addr = parse_addr_spec(relay_spec);
+            if (!client_addr) {
+                puts("Error: Relay spec must be in the form \"host:port\".");
+                return;
+            }
 
             num_proxy_pairs++;
             total_proxy_pairs++;



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