[Pkg-privacy-commits] [obfsproxy] 55/353: Start using the new pyptlib init().
Ximin Luo
infinity0 at moszumanska.debian.org
Sat Aug 22 13:01:39 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 9875f617e58f6fe122e5e55a4f0e4ad32f615dee
Author: George Kadianakis <desnacked at riseup.net>
Date: Tue Sep 4 03:37:59 2012 +0300
Start using the new pyptlib init().
Server-side managed proxy should get the ORPort from pyptlib's init()
return value.
---
src/obfsproxy/framework/managed/client.py | 10 +++++++---
src/obfsproxy/framework/managed/server.py | 22 +++++++++++++---------
2 files changed, 20 insertions(+), 12 deletions(-)
diff --git a/src/obfsproxy/framework/managed/client.py b/src/obfsproxy/framework/managed/client.py
index 443bfd3..4b48031 100755
--- a/src/obfsproxy/framework/managed/client.py
+++ b/src/obfsproxy/framework/managed/client.py
@@ -38,11 +38,15 @@ class ManagedClient:
'obfs3': Obfs3Client,
}
- matchedTransports = init(self.supportedTransports.keys())
- for transport in matchedTransports:
+ managed_info = init(self.supportedTransports.keys())
+ if managed_info is None: # XXX what should we return?
+ print "failz" # XXX make sure that pyptlib has whined to Tor.
+ return
+
+ for transport in managed_info['transports']:
try:
logging.error('Launching %s' % transport)
- self.launchClient(transport, 8182)
+ self.launchClient(transport, 8182) # XXX hardcoded
reportSuccess(transport, 5, ('127.0.0.1', 8182), None,
None)
except TransportLaunchException:
diff --git a/src/obfsproxy/framework/managed/server.py b/src/obfsproxy/framework/managed/server.py
index 416746b..3fcb62a 100755
--- a/src/obfsproxy/framework/managed/server.py
+++ b/src/obfsproxy/framework/managed/server.py
@@ -16,7 +16,7 @@ from obfsproxy.transports.dust_transport import DustServer
from obfsproxy.transports.obfs3 import Obfs3Server
from pyptlib.easy.server import init, reportSuccess, reportFailure, \
- reportEnd, getORPort
+ reportEnd
class TransportLaunchException(Exception):
@@ -27,8 +27,6 @@ class TransportLaunchException(Exception):
class ManagedServer:
def __init__(self):
- self.handler = ProxyHandler(*getORPort())
-
self.supportedTransports = {
'dummy': DummyServer,
'rot13': Rot13Server,
@@ -36,11 +34,17 @@ class ManagedServer:
'obfs3': Obfs3Server,
}
- matchedTransports = init(self.supportedTransports)
- for transport in matchedTransports:
+ managed_info = init(self.supportedTransports)
+ if managed_info is None: # XXX what is this function supposed to return?!
+ print "failz" # XXX make sure that pyptlib has whined to Tor.
+ return
+
+ self.orport_handler = ProxyHandler(*managed_info['orport'])
+
+ for transport, transport_bindaddr in managed_info['transports'].items():
try:
- self.launchServer(transport, 1051)
- reportSuccess(transport, ('127.0.0.1', 1051), None)
+ self.launchServer(transport, transport_bindaddr[1])
+ reportSuccess(transport, transport_bindaddr, None)
except TransportLaunchException:
reportFailure(transport, 'Failed to launch')
reportEnd()
@@ -53,8 +57,8 @@ class ManagedServer:
% name)
serverClass = self.supportedTransports[name]
- self.handler.setTransport(serverClass)
- add_service(Service(self.handler.handle, port=port))
+ self.orport_handler.setTransport(serverClass)
+ add_service(Service(self.orport_handler.handle, port=port))
if __name__ == '__main__':
--
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