[Pkg-privacy-commits] [obfsproxy] 181/353: Pass name of pluggable transport to Extended ORPort.

Ximin Luo infinity0 at moszumanska.debian.org
Sat Aug 22 13:01:57 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 8f1f43a823a8695b5f583dc45190b5e2ab7a2f05
Author: George Kadianakis <desnacked at riseup.net>
Date:   Tue Sep 10 02:21:15 2013 +0300

    Pass name of pluggable transport to Extended ORPort.
---
 ChangeLog                             |  4 +++-
 obfsproxy/network/extended_orport.py  | 19 +++++++++++++------
 obfsproxy/network/launch_transport.py |  2 +-
 3 files changed, 17 insertions(+), 8 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index b0ab4f4..d10c5b1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,6 @@
-Changes in version 0.2.3 - ??
+Changes in version 0.2.3 - UNRELEASED
+ - Add support for sending the pluggable transport name to Tor (using
+   the Extended ORPort) so that it can be considered in the statistics.
  - Remove licenses of dependencies from the LICENSE file. (They were
    moved to be with browser bundle packaging scripts.)
  - Fix a bug in the SOCKS code. An assertion would trigger if
diff --git a/obfsproxy/network/extended_orport.py b/obfsproxy/network/extended_orport.py
index 28475f1..c4cacea 100644
--- a/obfsproxy/network/extended_orport.py
+++ b/obfsproxy/network/extended_orport.py
@@ -31,6 +31,7 @@ AUTH_HASH_LEN = 32
 # Transport-to-Bridge
 EXT_OR_CMD_TB_DONE = 0x0000
 EXT_OR_CMD_TB_USERADDR = 0x0001
+EXT_OR_CMD_TB_TRANSPORT = 0x0002
 
 # Bridge-to-Transport
 EXT_OR_CMD_BT_OKAY = 0x1000
@@ -79,7 +80,8 @@ class ExtORPortProtocol(network.GenericProtocol):
     like it would do to an ORPort.
 
     Specifically, after completing the Extended ORPort authentication
-    we send a USERADDR command with the address of our client, and a
+    we send a USERADDR command with the address of our client, a
+    TRANSPORT command with the name of the pluggable transport, and a
     DONE command to signal that we are done with the Extended ORPort
     protocol. Then we wait for an OKAY command back from the server to
     start sending application-data.
@@ -97,7 +99,7 @@ class ExtORPortProtocol(network.GenericProtocol):
                  authentication cookie in the Extended ORPort Authentication
                  protocol.
     """
-    def __init__(self, circuit, ext_orport_addr, cookie_file, peer_addr):
+    def __init__(self, circuit, ext_orport_addr, cookie_file, peer_addr, transport_name):
         self.state = STATE_WAIT_FOR_AUTH_TYPES
         self.name = "ext_%s" % hex(id(self))
 
@@ -108,6 +110,8 @@ class ExtORPortProtocol(network.GenericProtocol):
         self.client_nonce = rand.random_bytes(AUTH_NONCE_LEN)
         self.client_hash = None
 
+        self.transport_name = transport_name
+
         network.GenericProtocol.__init__(self, circuit)
 
     def connectionMade(self):
@@ -195,6 +199,7 @@ class ExtORPortProtocol(network.GenericProtocol):
         # ORPort, then signal that we are done and that we want to
         # start transferring application-data.
         self._write_ext_orport_command(EXT_OR_CMD_TB_USERADDR, '%s:%s' % (self.peer_addr.host, self.peer_addr.port))
+        self._write_ext_orport_command(EXT_OR_CMD_TB_TRANSPORT, '%s' % self.transport_name)
         self._write_ext_orport_command(EXT_OR_CMD_TB_DONE, '')
 
     def _handle_auth_types(self):
@@ -335,22 +340,24 @@ class ExtORPortProtocol(network.GenericProtocol):
 
 
 class ExtORPortClientFactory(network.StaticDestinationClientFactory):
-    def __init__(self, circuit, cookie_file, peer_addr):
+    def __init__(self, circuit, cookie_file, peer_addr, transport_name):
         self.circuit = circuit
         self.peer_addr = peer_addr
         self.cookie_file = cookie_file
+        self.transport_name = transport_name
 
         self.name = "fact_ext_c_%s" % hex(id(self))
 
     def buildProtocol(self, addr):
-        return ExtORPortProtocol(self.circuit, addr, self.cookie_file, self.peer_addr)
+        return ExtORPortProtocol(self.circuit, addr, self.cookie_file, self.peer_addr, self.transport_name)
 
 class ExtORPortServerFactory(network.StaticDestinationClientFactory):
-    def __init__(self, ext_or_addrport, ext_or_cookie_file, transport_class):
+    def __init__(self, ext_or_addrport, ext_or_cookie_file, transport_name, transport_class):
         self.ext_or_host = ext_or_addrport[0]
         self.ext_or_port = ext_or_addrport[1]
         self.cookie_file = ext_or_cookie_file
 
+        self.transport_name = transport_name
         self.transport_class = transport_class
 
         self.name = "fact_ext_s_%s" % hex(id(self))
@@ -364,7 +371,7 @@ class ExtORPortServerFactory(network.StaticDestinationClientFactory):
         circuit = network.Circuit(self.transport_class())
 
         # XXX instantiates a new factory for each client
-        clientFactory = ExtORPortClientFactory(circuit, self.cookie_file, addr)
+        clientFactory = ExtORPortClientFactory(circuit, self.cookie_file, addr, self.transport_name)
         reactor.connectTCP(self.ext_or_host, self.ext_or_port, clientFactory)
 
         return network.StaticDestinationProtocol(circuit, 'server', addr)
diff --git a/obfsproxy/network/launch_transport.py b/obfsproxy/network/launch_transport.py
index dde7b75..1407123 100644
--- a/obfsproxy/network/launch_transport.py
+++ b/obfsproxy/network/launch_transport.py
@@ -35,7 +35,7 @@ def launch_transport_listener(transport, bindaddr, role, remote_addrport, ext_or
         factory = socks.SOCKSv4Factory(transport_class)
     elif role == 'ext_server':
         assert(remote_addrport and ext_or_cookie_file)
-        factory = extended_orport.ExtORPortServerFactory(remote_addrport, ext_or_cookie_file, transport_class)
+        factory = extended_orport.ExtORPortServerFactory(remote_addrport, ext_or_cookie_file, transport, transport_class)
     else:
         assert(remote_addrport)
         factory = network.StaticDestinationServerFactory(remote_addrport, role, transport_class)

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