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

[tor-commits] [flashproxy/master] Add -4 and -6 options to flashproxy-client.



commit 9f1627dec5f1f5d309596adf74d12b36cd9a6f31
Author: Jorge Couchet <jorge.couchet@xxxxxxxxx>
Date:   Fri Dec 21 12:29:44 2012 -0300

    Add -4 and -6 options to flashproxy-client.
    
    These are passed down to registration helpers that support them.
---
 flashproxy-client |   21 +++++++++++++++++----
 1 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/flashproxy-client b/flashproxy-client
index 0c58754..6fc152c 100755
--- a/flashproxy-client
+++ b/flashproxy-client
@@ -59,6 +59,7 @@ class options(object):
     register_commands = []
     pid_filename = None
     safe_logging = True
+    address_family = socket.AF_UNSPEC
 
 # We accept up to this many bytes from a socket not yet matched with a partner
 # before disconnecting it.
@@ -90,6 +91,8 @@ connect to you. You need to register in some way in order to get any service.
 The --facilitator option allows controlling which facilitator is used; if
 omitted, it uses a public default.
 
+  -4                        registration helpers use IPv4.
+  -6                        registration helpers use IPv6.
       --daemon              daemonize (Unix only).
       --external            be an external proxy (don't interact with Tor using
                               environment variables and stdout).
@@ -943,10 +946,16 @@ def build_register_command(method):
     if not script_dir:
         # Maybe the script was read from stdin; in any case don't guess at the directory.
         raise ValueError("Can't find executable directory for registration helpers")
+    af = []
+    if options.address_family == socket.AF_INET:
+        af = ["-4"]
+    elif options.address_family == socket.AF_INET6:
+        af = ["-6"]
     if method == "email":
-        return [os.path.join(script_dir, "flashproxy-reg-email")]
+        command = [os.path.join(script_dir, "flashproxy-reg-email")] + af
+        return command
     elif method == "http":
-        command = [os.path.join(script_dir, "flashproxy-reg-http")]
+        command = [os.path.join(script_dir, "flashproxy-reg-http")] + af
         if options.facilitator_url is not None:
             command += ["-f", options.facilitator_url]
         return command
@@ -1029,9 +1038,13 @@ def main():
     register_addr_spec = None
     register_methods = []
 
-    opts, args = getopt.gnu_getopt(sys.argv[1:], "f:hl:r", ["daemon", "external", "facilitator=", "help", "log=", "pidfile=", "register", "register-addr=", "register-methods=", "unsafe-logging"])
+    opts, args = getopt.gnu_getopt(sys.argv[1:], "46f:hl:r", ["daemon", "external", "facilitator=", "help", "log=", "pidfile=", "register", "register-addr=", "register-methods=", "unsafe-logging"])
     for o, a in opts:
-        if o == "--daemon":
+        if o == "-4":
+            options.address_family = socket.AF_INET
+        elif o == "-6":
+            options.address_family = socket.AF_INET6
+        elif o == "--daemon":
             options.daemonize = True
         elif o == "--external":
             options.managed = False



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