[Pkg-privacy-commits] [obfsproxy] 211/353: Add code examples to get_public_options doc str

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 02282559a4d98292bb668b4ca29dc08192b937c1
Author: David Stainton <dstainton415 at gmail.com>
Date:   Thu Nov 28 10:56:11 2013 -0800

    Add code examples to get_public_options doc str
    
    Further document BaseTransport's get_public_options
    using a simple example torrc and code sample.
---
 obfsproxy/transports/base.py | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/obfsproxy/transports/base.py b/obfsproxy/transports/base.py
index 1bffc72..dccbf6c 100644
--- a/obfsproxy/transports/base.py
+++ b/obfsproxy/transports/base.py
@@ -52,7 +52,25 @@ class BaseTransport(object):
         If the transport server wishes to prevent some server
         transport options from being added to the BridgeDB then
         the transport may override this method and return a
-        transport_options dict with the keys to be distributed.
+        transport_options dict with the keys/values to be distributed.
+
+        get_public_options receives the transport_options argument which
+        is a dict of server transport options... for example:
+
+        A torrc could specify multiple server transport options:
+
+        ServerTransportPlugin bananaphone exec /usr/local/bin/obfsproxy --log-min-severity=debug --log-file=/var/log/tor/obfsproxy.log managed
+        ServerTransportOptions bananaphone corpus=/opt/bananaphone-corpora/pg29468.txt encodingSpec=words,sha1,4 modelName=markov order=1
+
+        But if the transport wishes to only pass the encodingSpec to
+        the BridgeDB then get_public_options can be overridden like this:
+
+        @classmethod
+        def get_public_options(cls, transport_options):
+            return dict(encodingSpec = transport_options['encodingSpec'])
+
+        In this example the get_public_options receives the transport_options dict:
+        {'corpus': '/opt/bananaphone-corpora/pg29468.txt', 'modelName': 'markov', 'order': '1', 'encodingSpec': 'words,sha1,4'}
         """
         return None
 

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