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

[tor-commits] [fog/master] Switched the obfs3_flashproxy into a config file. This file is now read as the default configuration if no configuration file is specified on the command line



commit 20602bc6985459a67bc1008d51a0fb97282b0e6e
Author: Quinn Jarrell <qjarrell@xxxxxxxxxxxxxxx>
Date:   Wed Jul 2 13:52:54 2014 -0400

    Switched the obfs3_flashproxy into a config file. This file is now read as the default configuration if no configuration file is specified on the command line
---
 example-fog-config |   13 -------------
 fogrc              |   17 +++++++++++++++++
 obfs-flash-client  |   42 ++++++------------------------------------
 torrc              |    4 +---
 4 files changed, 24 insertions(+), 52 deletions(-)

diff --git a/example-fog-config b/example-fog-config
deleted file mode 100644
index 746e5ad..0000000
--- a/example-fog-config
+++ /dev/null
@@ -1,13 +0,0 @@
-#Based off of ticket #9744
-#Client transports are setup like so:
-#ClientTransportPlugin name commandline
-#For instance to launch obfs3, the client transport line should be this
-#ClientTransportPlugin obfs3 obfsproxy managed
-#
-#For chaining transports together, an alias line is used.
-#Alias chainname firsttransportname|secondtransportname
-#tor expects alias to use underscores instead of pipes. So an alias links the tor version of a plugin chain to the actual plugins. See ticket #9580
-
-ClientTransportPlugin dummy obfsproxy managed
-ClientTransportPlugin b64 obfsproxy managed
-Alias dummy_b64 dummy|b64
diff --git a/fogrc b/fogrc
new file mode 100644
index 0000000..ee28514
--- /dev/null
+++ b/fogrc
@@ -0,0 +1,17 @@
+#Based off of ticket #9744
+#Client transports are setup like so:
+#ClientTransportPlugin name commandline
+#For instance to launch obfs3, the client transport line should be this
+#ClientTransportPlugin obfs3 obfsproxy managed
+#
+#For chaining transports together, an alias line is used.
+#Alias chainname firsttransportname|secondtransportname
+#tor expects alias to use underscores instead of pipes. So an alias links the tor version of a plugin chain to the actual plugins. See ticket #9580
+
+ClientTransportPlugin obfs3 obfsproxy managed
+ClientTransportPlugin flashproxy flashproxy-client --transport obfs3|websocket --register 127.0.0.1:0 :9000 
+# If port 9000 cannot be portforwarded change it to a port that can be ported like so:
+#ClientTransportPlugin flashproxy flashproxy-client --transport obfs3|websocket --register 127.0.0.1:0 :3923
+# use a different facilitator
+#ClientTransportPlugin flashproxy flashproxy-client --transport obfs3|websocket -f http://siteb.fp-facilitator.org/fac/ --register â??-register-methods=http 127.0.0.1:0 :3923 
+Alias obfs3_flashproxy obfs3|flashproxy
diff --git a/obfs-flash-client b/obfs-flash-client
index 1c2267d..18adff4 100755
--- a/obfs-flash-client
+++ b/obfs-flash-client
@@ -30,6 +30,8 @@ import shlex
 
 import logging
 
+DEFAULT_CONFIG_FILE_NAME = 'fogrc'
+
 logger = None
 def pt_setup_logger():
     global logger
@@ -504,52 +506,20 @@ class Config():
                 raise KeyError('Transport map is missing pluggable transport %s needed for chain %s. Check your configuration file for a ClientTransportPlugin line can launch %s' % (pt_name, alias_name, pt_name))
         alias_map[alias_name] = alias_path
 
-def obfs3_flashproxy(fp_remote, fp_args=[], fp_local=0):
-    """
-    Set up the obfs3_flashproxy combined PT.
-    :param str fp_remote: Listen address for remote flashproxy connections.
-    :param str fp_args: The arguments to pass to the flashproxy connections.
-    :param int fp_local: Local listen port for local flashproxy connections.
-    """
-    ob_client = os.getenv("OBFSPROXY", "obfsproxy")
-    fp_client = os.getenv("FLASHPROXY_CLIENT", "flashproxy-client")
-
-    fp_cmdline =  [fp_client, "--transport", 'obfs3|websocket'] + fp_args + ['127.0.0.1:%s' % fp_local, fp_remote]
-    obfs_cmd_line = [ob_client, "managed"]
-
-    transport_map = {'obfs3': obfs_cmd_line, 'flashproxy': fp_cmdline}
-    alias_map = {'obfs3_flashproxy': ['obfs3', 'flashproxy']}
-
-    configuration = Config(transport_map, alias_map)
-    return configuration
-
 def main(*args):
     parser = argparse.ArgumentParser()
-    parser.add_argument("fp_remote", help="remote connections listen address "
-        "for flashproxy, default %(default)s",
-        metavar='REMOTE:PORT', nargs='?', default=":9000")
-    parser.add_argument("--fp-arg", help="arguments for flashproxy-client",
-        metavar='ARG', action='append')
     parser.add_argument("-f", help="fog configuration file path",
-        metavar='FOGFILE', type=argparse.FileType('r'))
+        metavar='FOGFILE', type=argparse.FileType('r'), default=DEFAULT_CONFIG_FILE_NAME)
 
     pt_setup_logger()
     # TODO(infinity0): add an "external" mode, which would require us to run
     # obfsproxy in external mode too.
 
     opts = parser.parse_args(args)
-
-    # ensure string address is valid
-    _, _, = parse_addr_spec(opts.fp_remote, defhost="0.0.0.0")
     configuration = None
-
-    if opts.f:
-        file_contents = opts.f.read()
-        configuration = Config.parse(file_contents)
-        pt_method_names = configuration.alias_map.keys()
-    else:
-        pt_method_names = ["obfs3_flashproxy"]
-        configuration = obfs3_flashproxy(opts.fp_remote, opts.fp_arg or [])
+    file_contents = opts.f.read()
+    configuration = Config.parse(file_contents)
+    pt_method_names = configuration.alias_map.keys()
     client = ClientTransportPlugin()
     client.init(pt_method_names) # Initialize our possible methods to all the chains listed by the fog file and stored in alias map.
     if not client.getTransports():
diff --git a/torrc b/torrc
index 42560c1..32c558e 100644
--- a/torrc
+++ b/torrc
@@ -2,6 +2,4 @@ UseBridges 1
 Bridge obfs3_flashproxy 127.0.0.1:9000
 LearnCircuitBuildTimeout 0
 CircuitBuildTimeout 300
-ClientTransportPlugin obfs3_flashproxy exec ./obfs-flash-client --fp-arg=--register
-# use a different facilitator
-#ClientTransportPlugin obfs3_flashproxy exec ./obfs-flash-client --fp-arg=-f --fp-arg=http://siteb.fp-facilitator.org/fac/ --fp-arg=--register-methods=http
+ClientTransportPlugin obfs3_flashproxy exec ./obfs-flash-client



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