[tor-commits] [obfsproxy/master] Make txsocksx an optional dependency.

asn at torproject.org asn at torproject.org
Fri Apr 25 19:24:50 UTC 2014


commit a2cd2dfa38ca021eefa82bf3ee47702b68df1624
Author: George Kadianakis <desnacked at riseup.net>
Date:   Fri Apr 25 20:20:11 2014 +0100

    Make txsocksx an optional dependency.
    
    Server-side obfsproxy does not need txsocksx.
---
 obfsproxy/network/network.py |   10 +++++-----
 setup.py                     |    7 +++++--
 2 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/obfsproxy/network/network.py b/obfsproxy/network/network.py
index 2715ae9..fa4d1e6 100644
--- a/obfsproxy/network/network.py
+++ b/obfsproxy/network/network.py
@@ -1,17 +1,12 @@
 from twisted.internet import reactor
-from twisted.internet.endpoints import HostnameEndpoint
 from twisted.internet.protocol import Protocol, Factory
 
-from txsocksx.client import SOCKS4ClientEndpoint, SOCKS5ClientEndpoint
-
 import obfsproxy.common.log as logging
 import obfsproxy.common.heartbeat as heartbeat
 
 import obfsproxy.network.buffer as obfs_buf
 import obfsproxy.transports.base as base
 
-from obfsproxy.network.http import HTTPConnectClientEndpoint
-
 log = logging.get_obfslogger()
 
 """
@@ -396,6 +391,11 @@ def create_proxy_client(host, port, proxy_spec, instance):
     Returns a deferred that will fire when the connection to the SOCKS server has been established.
     """
 
+    # Inline import so that txsocksx is an optional dependency.
+    from twisted.internet.endpoints import HostnameEndpoint
+    from txsocksx.client import SOCKS4ClientEndpoint, SOCKS5ClientEndpoint
+    from obfsproxy.network.http import HTTPConnectClientEndpoint
+
     TCPPoint = HostnameEndpoint(reactor, proxy_spec.hostname, proxy_spec.port)
     username = proxy_spec.username
     password = proxy_spec.password
diff --git a/setup.py b/setup.py
index 7017e75..2353a29 100644
--- a/setup.py
+++ b/setup.py
@@ -34,7 +34,10 @@ setup(
         'Twisted',
         'argparse',
         'pyptlib >= 0.0.6',
-        'pyyaml',
-        'txsocksx'
+        'pyyaml'
         ],
+
+    extras_require = {
+        'SOCKS': ["txsocksx"]
+        }
 )





More information about the tor-commits mailing list