def write(self, packet):
     try:
         ip_packet = IPv6(packet)
     except struct.error:
         log.msg("not an IPv6 packet")
         return
     onion = convert_ipv6_to_onion(ip_packet.dst)
     if onion not in self.onion_packet_queue_map:
         self.onion_packet_queue_map[onion] = PacketDeque(self.deque_max_len, self.reactor, lambda new_packet: self.write_to_onion(onion, new_packet), lambda: self.forget_peer(onion))
         self.try_onion_connect(onion)
     self.onion_packet_queue_map[onion].append(packet)
Esempio n. 2
0
 def write(self, packet):
     print "write()"
     try:
         ip_packet = IPv6(packet)
         # XXX assert that the source address is correct?
     except struct.error:
         log.msg("not an IPv6 packet")
         return
     print "ipv6 onion consumer: write: ip dest: %s" % (ip_packet.dst,)
     onion = convert_ipv6_to_onion(ip_packet.dst)
     d = self.getOnionConnection(onion)
     d.addCallback(lambda p: p.transport.write(packet))
Esempio n. 3
0
 def write(self, packet):
     print "write()"
     try:
         ip_packet = IPv6(packet)
         # XXX assert that the source address is correct?
     except struct.error:
         log.msg("not an IPv6 packet")
         return
     print "ipv6 onion consumer: write: ip dest: %s" % (ip_packet.dst, )
     onion = convert_ipv6_to_onion(ip_packet.dst)
     d = self.getOnionConnection(onion)
     d.addCallback(lambda p: p.transport.write(packet))
 def write(self, packet):
     try:
         ip_packet = IPv6(packet)
     except struct.error:
         log.msg("not an IPv6 packet")
         return
     onion = convert_ipv6_to_onion(ip_packet.dst)
     if onion not in self.onion_packet_queue_map:
         self.onion_packet_queue_map[onion] = PacketDeque(
             self.deque_max_len, self.reactor,
             lambda new_packet: self.write_to_onion(onion, new_packet),
             lambda: self.forget_peer(onion))
         self.try_onion_connect(onion)
     self.onion_packet_queue_map[onion].append(packet)
Esempio n. 5
0
    def write(self, packet):
        """
        Tries to determine the destination onion address, create a client
        connection to that endpoint, and send the data.
        """

        log.msg("IPv6OnionConsumer.write() called")
        try:
            ip_packet = IPv6(packet)
            # XXX assert that the source address is correct?
        except struct.error:
            log.msg("not an IPv6 packet")
            return
        onion = convert_ipv6_to_onion(ip_packet.dst)
        print("Onion connection: {} -> {}".format(ip_packet.dst, onion))

        self.onion_conn_d.addCallback(lambda ign: self.getOnionConnection(onion))
        # Send data when connection opens
        self.onion_conn_d.addCallback(lambda protocol: self.write_to_onion(protocol, packet))
        self.onion_conn_d.addErrback(self.onionConnectionFailed)
Esempio n. 6
0
    def write(self, packet):
        """
        Tries to determine the destination onion address, create a client
        connection to that endpoint, and send the data.
        """

        log.msg("IPv6OnionConsumer.write() called")
        try:
            ip_packet = IPv6(packet)
            # XXX assert that the source address is correct?
        except struct.error:
            log.msg("not an IPv6 packet")
            return
        onion = convert_ipv6_to_onion(ip_packet.dst)
        print("Onion connection: {} -> {}".format(ip_packet.dst, onion))

        self.onion_conn_d.addCallback(
            lambda ign: self.getOnionConnection(onion))
        # Send data when connection opens
        self.onion_conn_d.addCallback(
            lambda protocol: self.write_to_onion(protocol, packet))
        self.onion_conn_d.addErrback(self.onionConnectionFailed)