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

[tor-commits] [flashproxy/master] Honor both "flashproxy" and "websocket" method names.



commit 93be030227cf96aa682f9fb8dbc9ccc986d1c36c
Author: David Fifield <david@xxxxxxxxxxxxxxx>
Date:   Sat Jun 8 20:31:32 2013 -0700

    Honor both "flashproxy" and "websocket" method names.
    
    These are treated as synonyms. If Tor asks for "*", it gets only one of
    them.
---
 ChangeLog                   |    3 +++
 doc/flashproxy-client.1     |    2 +-
 doc/flashproxy-client.1.txt |    2 +-
 flashproxy-client           |   44 ++++++++++++++++++++++++-------------------
 4 files changed, 30 insertions(+), 21 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index c342eb0..9f47f12 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -9,6 +9,9 @@
     facilitator to estimate the level of service each client is getting.
     Proxies send a protocol revision number "r=1" to signify the change.
 
+  o The managed transport method name "flashproxy" is now recognized as
+    a synonym for "websocket".
+
 Changes in version 1.1
   o Programs that use certificate pins now take a --disable-pin option
     that causes pins to be ignored.
diff --git a/doc/flashproxy-client.1 b/doc/flashproxy-client.1
index e9fea5c..d431a58 100644
--- a/doc/flashproxy-client.1
+++ b/doc/flashproxy-client.1
@@ -38,7 +38,7 @@ Wait for connections on a local and a remote port\&. When any pair of connection
 .sp
 The local connection acts as a SOCKS4a proxy, but the host and port in the SOCKS request are ignored and the local connection is always linked to a remote connection\&.
 .sp
-By default, runs as a managed proxy: informs a parent Tor process of support for the "websocket" pluggable transport\&. In managed mode, the \fILOCAL\fR port is chosen arbitrarily instead of defaulting to 9001; however this can be overridden by including a \fILOCAL\fR port in the command\&. This is the way the program should be invoked in a torrc ClientTransportPlugin "exec" line\&. Use the \fB\-\-external\fR option to run as an external proxy that does not interact with Tor\&.
+By default, runs as a managed proxy: informs a parent Tor process of support for the "flashproxy" or "websocket" pluggable transport\&. In managed mode, the \fILOCAL\fR port is chosen arbitrarily instead of defaulting to 9001; however this can be overridden by including a \fILOCAL\fR port in the command\&. This is the way the program should be invoked in a torrc ClientTransportPlugin "exec" line\&. Use the \fB\-\-external\fR option to run as an external proxy that does not interact with Tor\&.
 .sp
 If any of the \fB\-\-register\fR, \fB\-\-register\-addr\fR, or \fB\-\-register\-methods\fR options are used, then your IP address will be sent to the facilitator so that proxies can connect to you\&. You need to register in some way in order to get any service\&. The \fB\-\-facilitator\fR option allows controlling which facilitator is used; if omitted, it uses a public default\&.
 .SH "OPTIONS"
diff --git a/doc/flashproxy-client.1.txt b/doc/flashproxy-client.1.txt
index 66eaa50..8d9a99e 100644
--- a/doc/flashproxy-client.1.txt
+++ b/doc/flashproxy-client.1.txt
@@ -25,7 +25,7 @@ request are ignored and the local connection is always linked to a remote
 connection.
 
 By default, runs as a managed proxy: informs a parent Tor process of support for
-the "websocket" pluggable transport. In managed mode, the __LOCAL__ port is chosen
+the "flashproxy" or "websocket" pluggable transport. In managed mode, the __LOCAL__ port is chosen
 arbitrarily instead of defaulting to 9001; however this can be
 overridden by including a __LOCAL__ port in the command. This is the way the
 program should be invoked in a torrc ClientTransportPlugin "exec" line.
diff --git a/flashproxy-client b/flashproxy-client
index 3c40be9..7feaefe 100755
--- a/flashproxy-client
+++ b/flashproxy-client
@@ -79,12 +79,12 @@ request are ignored and the local connection is always linked to a remote
 connection.
 
 By default, runs as a managed proxy: informs a parent Tor process of support for
-the "websocket" pluggable transport. In managed mode, the LOCAL port is chosen
-arbitrarily instead of defaulting to %(local_port)d; however this can be
-overridden by including a LOCAL port in the command. This is the way the
-program should be invoked in a torrc ClientTransportPlugin "exec" line.
-Use the --external option to run as an external proxy that does not
-interact with Tor.
+the "flashproxy" or "websocket" pluggable transport. In managed mode,
+the LOCAL port is chosen arbitrarily instead of defaulting to
+%(local_port)d; however this can be overridden by including a LOCAL port
+in the command. This is the way the program should be invoked in a torrc
+ClientTransportPlugin "exec" line. Use the --external option to run as
+an external proxy that does not interact with Tor.
 
 If any of the --register, --register-addr, or --register-methods options are
 used, then your IP address will be sent to the facilitator so that proxies can
@@ -1003,10 +1003,12 @@ def pt_cmethoderror(msg):
     pt_line("CMETHOD-ERROR", msg)
     sys.exit(1)
 
-def pt_get_client_transports(known):
+def pt_get_client_transports(known, wildcard = None):
     result = []
     if os.environ.get("TOR_PT_CLIENT_TRANSPORTS") == "*":
-        return known
+        if wildcard is None:
+            wildcard = known
+        return wildcard
     for method in os.environ.get("TOR_PT_CLIENT_TRANSPORTS", "").split(","):
         if method in known:
             result.append(method)
@@ -1033,10 +1035,11 @@ option.\
         pt_line("VERSION-ERROR", "no-version")
         sys.exit(1)
 
-    client_transports = pt_get_client_transports(["websocket"])
+    client_transports = pt_get_client_transports(["flashproxy", "websocket"], ["flashproxy"])
     if not client_transports:
         pt_cmethods_done()
         sys.exit(1)
+    return client_transports
 
 def pt_cmethod(method_name, addr):
     pt_line("CMETHOD", method_name, "socks4", format_sockaddr(addr))
@@ -1096,7 +1099,9 @@ def main():
         options.log_file = sys.stderr
 
     if options.managed:
-        pt_setup_managed()
+        method_names = pt_setup_managed()
+    else:
+        method_names = ["flashproxy"]
 
     if options.managed:
         default_local_port = DEFAULT_LOCAL_PORT_MANAGED
@@ -1154,15 +1159,16 @@ def main():
     # Local sockets, accepting SOCKS requests from localhost
     local_listen = []
     for addr in options.local_addrs:
-        try:
-            listen = listen_socket(addr)
-        except socket.error, e:
-            log(u"Failed to listen local on %s: %s." % (addr, str(e)))
-            continue
-        local_listen.append(listen)
-        log(u"Listening local on %s." % format_sockaddr(listen.getsockname()))
-        if options.managed:
-            pt_cmethod("websocket", listen.getsockname())
+        for method_name in method_names:
+            try:
+                listen = listen_socket(addr)
+            except socket.error, e:
+                log(u"Failed to listen local on %s: %s." % (addr, str(e)))
+                continue
+            local_listen.append(listen)
+            log(u"Listening local on %s." % format_sockaddr(listen.getsockname()))
+            if options.managed:
+                pt_cmethod(method_name, listen.getsockname())
     if not local_listen:
         log(u"Failed to open any local listeners, quitting.")
         pt_cmethoderror("Failed to open any local listeners.")

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