[Pkg-privacy-commits] [obfsproxy] 141/353: Don't break CLI compatibility with C-obfsproxy.

Ximin Luo infinity0 at moszumanska.debian.org
Sat Aug 22 13:01:51 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 336b16c9f845711452f353033a41cceca2d0f87c
Author: George Kadianakis <desnacked at riseup.net>
Date:   Thu Mar 28 12:53:55 2013 -0700

    Don't break CLI compatibility with C-obfsproxy.
---
 ChangeLog     |  2 ++
 bin/obfsproxy | 12 ++++++++++++
 2 files changed, 14 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index 79a5594..545d24b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -5,6 +5,8 @@ Changes in version 0.0.3 - ??
  - Add support for per-connection SOCKS arguments.
  - Add a setup script for py2exe.
  - Slightly improve the executable script.
+ - Improve command line interface compatibility between C-obfpsroxy
+   and Python-obfsproxy by supporting the "--managed" switch.
 
 
 Changes in version 0.0.2 - 2013-02-17
diff --git a/bin/obfsproxy b/bin/obfsproxy
index a716b18..cc67781 100755
--- a/bin/obfsproxy
+++ b/bin/obfsproxy
@@ -8,6 +8,18 @@ path_to_project_root = os.path.abspath(os.path.join(dir_of_executable, '..'))
 
 sys.path.insert(0, path_to_project_root)
 
+# Pyobfsproxy's CLI uses "managed" whereas C-obfsproxy uses
+# "--managed" to configure managed-mode. Python obfsproxy can't
+# recognize "--managed" because it uses argparse subparsers and
+# http://bugs.python.org/issue9253 is not yet solved. This is a crazy
+# hack to maintain CLI compatibility between the two versions. we
+# basically inplace replace "--managed" with "managed" in the argument
+# list.
+if len(sys.argv) > 1 and '--managed' in sys.argv:
+    for n, arg in enumerate(sys.argv):
+        if arg == '--managed':
+            sys.argv[n] = 'managed'
+
 from obfsproxy.pyobfsproxy import run
 run()
 

-- 
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