latest.ipv8.test.messaging.anonymization.test_community

Module Contents

Classes

TestTunnelCommunity

Tests related to the TunnelCommunity.

Functions

_on_packet_fragile_cb(→ None)

A fragile version of on_packet that crashes on message handling failures.

latest.ipv8.test.messaging.anonymization.test_community._on_packet_fragile_cb(self: latest.ipv8.messaging.anonymization.community.TunnelCommunity, source_address: latest.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.

class latest.ipv8.test.messaging.anonymization.test_community.TestTunnelCommunity(methodName: str = 'runTest')

Bases: latest.ipv8.test.base.TestBase[latest.ipv8.messaging.anonymization.community.TunnelCommunity]

Tests related to the TunnelCommunity.

setUp() None

Create two nodes and allocate a variable for a possible exit node endpoint.

async tearDown() None

If an endpoint was used, close it.

create_node(settings: latest.ipv8.community.CommunitySettings | None = None, create_dht: bool = False, enable_statistics: bool = False) latest.ipv8.test.mocking.ipv8.MockIPv8

Initialize a TunnelCommunity without circuits or exit node functionality.

_patch_overlay(overlay: latest.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.

assert_no_more_tunnels() None

Utility method to check whether there are no more tunnels left.

settings(i: int) latest.ipv8.messaging.anonymization.community.TunnelSettings

Shortcut for the tunnel settings of a particular node.

async test_introduction_as_exit() None

Check if introduction requests share the fact that nodes are exit nodes.

async test_introduction_as_exit_twoway() None

Check if two nodes can have each other as exit nodes.

async test_introduction_as_exit_noway() None

Check if two nodes don’t advertise themselves as exit node incorrectly.

async test_create_circuit() None

Check if 1 hop circuit creation works.

async test_create_circuit_destruct_initializing() None

Check if a circuit is destructed and cleaned correctly while still initializing.

async test_create_circuit_no_exit() None

Check if 1 hop circuit creation fails without exit nodes.

async test_create_circuit_too_many_hops() None

Check if creating a circuit that is too long fails.

async test_create_circuit_relay_early_fail_hop1() None

Check if extending a circuit using a cell with a bad relay_early flag fails at the first hop.

async test_create_circuit_relay_early_fail_hop2() None

Check if extending a circuit using a cell with a bad relay_early flag fails at the second hop.

async test_create_circuit_multiple_calls() None

Check if circuit creation is aborted when it’s already building the requested circuit.

async test_destroy_circuit_from_originator() None

Check if a 2 hop circuit can be destroyed (by the exit node).

async test_destroy_circuit_from_exit() None

Check if a 2 hop circuit can be destroyed (by the exit node).

async test_destroy_circuit_from_relay() None

Check if a 2 hop circuit can be destroyed (by the relay node).

async test_destroy_circuit_bad_id() None

Check if the correct circuit gets destroyed.

async test_tunnel_data() None

Check if data is correctly exited.

async test_two_hop_circuit() None

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.

async test_three_hop_circuit() None

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.

async test_create_two_circuit() None

Check if multiple 1 hop circuit creation works.

async test_reuse_partial_circuit() None

Check if we can change the unverified hop of a circuit.

async test_reuse_partial_circuit_first_hop() None

Check if we can change the first unverified hop of a circuit.

async test_tunnel_endpoint_anon() None

Check if the tunnel endpoint is routing traffic correctly with anonymity enabled.

async test_tunnel_endpoint_no_anon() None

Check if the tunnel endpoint is routing traffic correctly with anonymity disabled.

async test_tunnel_unicode_destination() None

Check if the encoding/decoding a unicode hostname works.

async test_test_request() None

Check if sending test-request messages works as expected.