[Pkg-privacy-commits] [obfsproxy] 207/353: Fix a bug and add some docs on the setup() method.
Ximin Luo
infinity0 at moszumanska.debian.org
Sat Aug 22 13:02:00 UTC 2015
This is an automated email from the git hooks/post-receive script.
infinity0 pushed a commit to branch master
in repository obfsproxy.
commit 0b2edb087e91c0d7d5354a01b6cb07c077992bf1
Author: George Kadianakis <desnacked at riseup.net>
Date: Wed Nov 13 15:30:47 2013 +0000
Fix a bug and add some docs on the setup() method.
pt_configs are per-transport (since on the server-side they contain
transport-specific parameters), so we should initialize one for each
transport.
---
ChangeLog | 2 ++
obfsproxy/managed/client.py | 10 +++++-----
obfsproxy/managed/server.py | 8 ++++----
obfsproxy/pyobfsproxy.py | 5 +++--
4 files changed, 14 insertions(+), 11 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 9bbba1e..b784de2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,8 @@
Changes in version 0.2.5 - UNRELEASED
- Use gmpy's modular exponentiation function since it's more efficient.
Fixes #10031 and adds gmpy as a dependency. Patch by Philipp Winter.
+ - Add a setup() method that gets called on obfsproxy startup and
+ can be used by transports for expensive initializations.
Changes in version 0.2.4 - 2013-09-30
diff --git a/obfsproxy/managed/client.py b/obfsproxy/managed/client.py
index a3a3e53..6d0e7ed 100644
--- a/obfsproxy/managed/client.py
+++ b/obfsproxy/managed/client.py
@@ -29,13 +29,13 @@ def do_managed_client():
log.debug("pyptlib gave us the following data:\n'%s'", pprint.pformat(ptclient.getDebugData()))
-
- # Will hold configuration parameters for the pluggable transport module.
- pt_config = transport_config.TransportConfig()
- pt_config.setStateLocation(ptclient.config.getStateLocation())
-
for transport in ptclient.getTransports():
+ # Will hold configuration parameters for the pluggable transport module.
+ pt_config = transport_config.TransportConfig()
+ pt_config.setStateLocation(ptclient.config.getStateLocation())
+
+ # Call setup() method for this transport.
transport_class = transports.get_transport_class(transport, 'socks')
transport_class.setup(pt_config)
diff --git a/obfsproxy/managed/server.py b/obfsproxy/managed/server.py
index 2b5d518..095049b 100644
--- a/obfsproxy/managed/server.py
+++ b/obfsproxy/managed/server.py
@@ -34,17 +34,17 @@ def do_managed_server():
orport = ptserver.config.getORPort()
server_transport_options = ptserver.config.getServerTransportOptions()
- # Will hold configuration parameters for the pluggable transport module.
- pt_config = transport_config.TransportConfig()
- pt_config.setStateLocation(ptserver.config.getStateLocation())
-
for transport, transport_bindaddr in ptserver.getBindAddresses().items():
+ # Will hold configuration parameters for the pluggable transport module.
+ pt_config = transport_config.TransportConfig()
+ pt_config.setStateLocation(ptserver.config.getStateLocation())
transport_options = ""
if server_transport_options and transport in server_transport_options:
transport_options = server_transport_options[transport]
pt_config.setServerTransportOptions(transport_options)
+ # Call setup() method for this tranpsort.
transport_class = transports.get_transport_class(transport, 'server')
transport_class.setup(pt_config)
diff --git a/obfsproxy/pyobfsproxy.py b/obfsproxy/pyobfsproxy.py
index b29d669..d0f9388 100755
--- a/obfsproxy/pyobfsproxy.py
+++ b/obfsproxy/pyobfsproxy.py
@@ -83,6 +83,7 @@ def do_external_mode(args):
pt_config = transport_config.TransportConfig()
pt_config.setStateLocation(args.data_dir)
+ # Run setup() method.
run_transport_setup(pt_config)
launch_transport.launch_transport_listener(args.name, args.listen_addr, args.mode, args.dest, pt_config, args.ext_cookie_file)
@@ -109,9 +110,9 @@ def consider_cli_args(args):
elif (args.name == 'managed') and (not args.log_file):
# managed proxies without a logfile must not log at all.
log.disable_logs()
-
+
def run_transport_setup(pt_config):
- """Pass the Pluggable Transport Config to each transport."""
+ """Run the setup() method for our transports."""
for transport, transport_class in transports.transports.items():
transport_class['base'].setup(pt_config)
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-privacy/packages/obfsproxy.git
More information about the Pkg-privacy-commits
mailing list