[Pkg-privacy-commits] [obfsproxy] 209/353: Add get_public_options method to BaseTransport
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 6f981cab512083072e290cdf76758dfe97d63877
Author: David Stainton <dstainton415 at gmail.com>
Date: Wed Nov 27 13:12:35 2013 -0800
Add get_public_options method to BaseTransport
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.
---
obfsproxy/managed/server.py | 17 ++++++++++++++---
obfsproxy/transports/base.py | 11 +++++++++++
2 files changed, 25 insertions(+), 3 deletions(-)
diff --git a/obfsproxy/managed/server.py b/obfsproxy/managed/server.py
index 095049b..31f05fe 100644
--- a/obfsproxy/managed/server.py
+++ b/obfsproxy/managed/server.py
@@ -40,6 +40,7 @@ def do_managed_server():
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)
@@ -78,10 +79,20 @@ def do_managed_server():
extra_log = " (server transport options: '%s')" % str(transport_options)
log.debug("Successfully launched '%s' at '%s'%s" % (transport, log.safe_addr_str(str(addrport)), extra_log))
+ # Potentially filter the transport options
+ # with the transport's get_public_options() method
+ filtered_options = transport_class.get_public_options(transport_options)
+ optlist = []
+ for k, v in filtered_options.items():
+ optlist.append("%s=%s" % (k,v))
+ public_options = ",".join(optlist)
+
+ log.debug("\n\ndo_managed_server: public_options: %s\n\n" % public_options)
+
# Report success for this transport.
- # (We leave the 'options' as None and let pyptlib handle the
- # SMETHOD argument sending.)
- ptserver.reportMethodSuccess(transport, addrport, None)
+ # If public_options is None then all of the
+ # transport options from ptserver are used instead.
+ ptserver.reportMethodSuccess(transport, addrport, public_options)
ptserver.reportMethodsEnd()
diff --git a/obfsproxy/transports/base.py b/obfsproxy/transports/base.py
index 1e74abf..1bffc72 100644
--- a/obfsproxy/transports/base.py
+++ b/obfsproxy/transports/base.py
@@ -45,6 +45,17 @@ class BaseTransport(object):
"""
pass
+ @classmethod
+ def get_public_options(cls, transport_options):
+ """
+ By default all server transport options are passed to BridgeDB.
+ 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.
+ """
+ return None
+
def handshake(self, circuit):
"""
The Circuit 'circuit' was completed, and this is a good time
--
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