[Pkg-privacy-commits] [obfsproxy] 276/353: Per asn, create_proxy_client() should just take an instance

Ximin Luo infinity0 at moszumanska.debian.org
Sat Aug 22 13:02:10 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 5436c7d268164f8807e34bf30a8dc5ab90152288
Author: Yawning Angel <yawning at schwanenlied.me>
Date:   Thu Mar 20 00:58:28 2014 +0000

    Per asn, create_proxy_client() should just take an instance
---
 ChangeLog                    |  2 +-
 obfsproxy/network/network.py | 15 +++++----------
 obfsproxy/network/socks.py   |  2 +-
 3 files changed, 7 insertions(+), 12 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index da37aca..9fa0221 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,6 @@
 Changes in version 0.2.8 - UNRELEASED
  - Support connecting over SOCKS4(a) and SOCKS5.  Based on the patch by
-   Arturo Filasto with changes by Yawning Angel.  Fixes #8956.
+   Arturo Filastò with changes by Yawning Angel.  Fixes #8956.
 
 
 Changes in version 0.2.7 - 2014-03-15
diff --git a/obfsproxy/network/network.py b/obfsproxy/network/network.py
index fe4b020..41e923f 100644
--- a/obfsproxy/network/network.py
+++ b/obfsproxy/network/network.py
@@ -374,13 +374,13 @@ class StaticDestinationServerFactory(Factory):
         if settings.config.proxy:
             create_proxy_client(self.remote_host, self.remote_port,
                                 settings.config.proxy,
-                                klass_instance=clientFactory)
+                                clientFactory)
         else:
             reactor.connectTCP(self.remote_host, self.remote_port, clientFactory)
 
         return StaticDestinationProtocol(circuit, self.mode, addr)
 
-def create_proxy_client(host, port, proxy_spec, klass=None, klass_args=None):
+def create_proxy_client(host, port, proxy_spec, instance):
     """
     host:
     the host of the final destination
@@ -388,10 +388,8 @@ def create_proxy_client(host, port, proxy_spec, klass=None, klass_args=None):
     the port number of the final destination
     proxy_spec:
     the address of the proxy server as a urlparse.SplitResult
-    klass:
-    is either a class or instance
-    klass_args:
-    if specified klass will be treated as a class and will be passed to the class constructor
+    instance:
+    is the instance to be associated with the endpoint
 
     Returns a deferred that will fire when the connection to the SOCKS server has been established.
     """
@@ -415,10 +413,7 @@ def create_proxy_client(host, port, proxy_spec, klass=None, klass_args=None):
             else:
                 assert(username == None and password == None)
                 SOCKSPoint = SOCKS5ClientEndpoint(host, port, TCPPoint)
-        if klass_args:
-            d = SOCKSPoint.connect(klass(klass_args))
-        else:
-            d = SOCKSPoint.connect(klass)
+        d = SOCKSPoint.connect(instance)
         return d
     elif proxy_spec.scheme == "http":
         # TODO: This should be supported one day
diff --git a/obfsproxy/network/socks.py b/obfsproxy/network/socks.py
index 16b93bf..04874fe 100644
--- a/obfsproxy/network/socks.py
+++ b/obfsproxy/network/socks.py
@@ -147,7 +147,7 @@ class OBFSSOCKSv5Protocol(socks5.SOCKSv5Protocol, network.GenericProtocol):
 
         if settings.config.proxy:
             instance = OBFSSOCKSv5OutgoingFactory(self)
-            return network.create_proxy_client(addr, port, settings.config.proxy, klass=instance)
+            return network.create_proxy_client(addr, port, settings.config.proxy, instance)
         else:
             return protocol.ClientCreator(reactor, OBFSSOCKSv5Outgoing, self).connectTCP(addr, port)
 

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