3.0.ipv8.test.messaging.anonymization.test_community ==================================================== .. py:module:: 3.0.ipv8.test.messaging.anonymization.test_community Classes ------- .. autoapisummary:: 3.0.ipv8.test.messaging.anonymization.test_community.TestTunnelCommunity Functions --------- .. autoapisummary:: 3.0.ipv8.test.messaging.anonymization.test_community._on_packet_fragile_cb Module Contents --------------- .. py:function:: _on_packet_fragile_cb(self: 3.0.ipv8.messaging.anonymization.community.TunnelCommunity, source_address: 3.0.ipv8.types.Address, data: bytes, circuit_id: int | None) -> None A fragile version of on_packet that crashes on message handling failures. These failures won't actually cause IPv8 to crash in production, but you should probably handle these. Add overlay classes to use in production mode to the ``production_overlay_classes`` list. Filter nodes to run in production mode by overwriting ``TestBase.patch_overlays``. .. py:class:: TestTunnelCommunity(methodName: str = 'runTest') Bases: :py:obj:`3.0.ipv8.test.base.TestBase`\ [\ :py:obj:`3.0.ipv8.messaging.anonymization.community.TunnelCommunity`\ ] Tests related to the TunnelCommunity. .. py:method:: setUp() -> None Create two nodes and allocate a variable for a possible exit node endpoint. .. py:method:: tearDown() -> None :async: If an endpoint was used, close it. .. py:method:: create_node(settings: 3.0.ipv8.community.CommunitySettings | None = None, create_dht: bool = False, enable_statistics: bool = False) -> 3.0.ipv8.test.mocking.ipv8.MockIPv8 Initialize a TunnelCommunity without circuits or exit node functionality. .. py:method:: _patch_overlay(overlay: 3.0.ipv8.types.Overlay) -> None Perform patches on an overlay for testing purposes. By default, this patches out the general try-except in the packet handler, allowing crashes. .. py:method:: assert_no_more_tunnels() -> None Utility method to check whether there are no more tunnels left. .. py:method:: settings(i: int) -> 3.0.ipv8.messaging.anonymization.community.TunnelSettings Shortcut for the tunnel settings of a particular node. .. py:method:: test_introduction_as_exit() -> None :async: Check if introduction requests share the fact that nodes are exit nodes. .. py:method:: test_introduction_as_exit_twoway() -> None :async: Check if two nodes can have each other as exit nodes. .. py:method:: test_introduction_as_exit_noway() -> None :async: Check if two nodes don't advertise themselves as exit node incorrectly. .. py:method:: test_create_circuit() -> None :async: Check if 1 hop circuit creation works. .. py:method:: test_create_circuit_destruct_initializing() -> None :async: Check if a circuit is destructed and cleaned correctly while still initializing. .. py:method:: test_create_circuit_no_exit() -> None :async: Check if 1 hop circuit creation fails without exit nodes. .. py:method:: test_create_circuit_too_many_hops() -> None :async: Check if creating a circuit that is too long fails. .. py:method:: test_create_circuit_relay_early_fail_hop1() -> None :async: Check if extending a circuit using a cell with a bad relay_early flag fails at the first hop. .. py:method:: test_create_circuit_relay_early_fail_hop2() -> None :async: Check if extending a circuit using a cell with a bad relay_early flag fails at the second hop. .. py:method:: test_create_circuit_multiple_calls() -> None :async: Check if circuit creation is aborted when it's already building the requested circuit. .. py:method:: test_destroy_circuit_from_originator() -> None :async: Check if a 2 hop circuit can be destroyed (by the exit node). .. py:method:: test_destroy_circuit_from_exit() -> None :async: Check if a 2 hop circuit can be destroyed (by the exit node). .. py:method:: test_destroy_circuit_from_relay() -> None :async: Check if a 2 hop circuit can be destroyed (by the relay node). .. py:method:: test_destroy_circuit_bad_id() -> None :async: Check if the correct circuit gets destroyed. .. py:method:: test_tunnel_data() -> None :async: Check if data is correctly exited. .. py:method:: test_two_hop_circuit() -> None :async: Check if a two hop circuit is correctly created. Note that we avoid exit nodes in the relay path, so we explicitly set relay nodes to not be exits. .. py:method:: test_three_hop_circuit() -> None :async: Check if a three hop circuit is correctly created. Note that we avoid exit nodes in the relay path, so we explicitly set relay nodes to not be exits. .. py:method:: test_create_two_circuit() -> None :async: Check if multiple 1 hop circuit creation works. .. py:method:: test_reuse_partial_circuit() -> None :async: Check if we can change the unverified hop of a circuit. .. py:method:: test_reuse_partial_circuit_first_hop() -> None :async: Check if we can change the first unverified hop of a circuit. .. py:method:: test_tunnel_endpoint_anon() -> None :async: Check if the tunnel endpoint is routing traffic correctly with anonymity enabled. .. py:method:: test_tunnel_endpoint_no_anon() -> None :async: Check if the tunnel endpoint is routing traffic correctly with anonymity disabled. .. py:method:: test_tunnel_unicode_destination() -> None :async: Check if the encoding/decoding a unicode hostname works. .. py:method:: test_test_request() -> None :async: Check if sending test-request messages works as expected.