Parcourir la source

wip building circuits for telescoping

Chelsea H. Komlo il y a 4 ans
Parent
commit
bd62fbc3a0
1 fichiers modifiés avec 16 ajouts et 0 suppressions
  1. 16 0
      client.py

+ 16 - 0
client.py

@@ -136,10 +136,26 @@ class ClientChannelManager(relay.ChannelManager):
 
         return circhandler
 
+    def new_circuit_telescoping(self):
+        """Create a new circuit from this client. (Telescoping Walking Onions
+        version)"""
+
+        # Get our channel to the guard- walking onions assumes the client can
+        # botostrap the first hop using out-of-channel mechanisms
+        print("GUARD ADDRESS " + self.guardaddr)
+        guardchannel = self.get_channel_to(self.guardaddr)
+
+        # Allocate a new circuit id on it
+        circid, circhandler = guardchannel.new_circuit()
+
     def new_circuit(self):
         """Create a new circuit from this client."""
         if network.thenetwork.womode == network.WOMode.VANILLA:
+            print("creating enw circuit of type " + network.WOMODE.VANILLA)
             return self.new_circuit_vanilla()
+        elif network.thenetwork.womode == network.WOMode.TELESCOPING:
+            return self.new_circuit_telescoping()
+        #TODO create a new circuit for single-pass
 
     def received_msg(self, msg, peeraddr, channel):
         """Callback when a NetMsg not specific to a circuit is