latest.ipv8.messaging.anonymization.hidden_services
The hidden tunnel community.
Author(s): Egbert Bouman
Module Contents
Classes
Settings for the hidden tunnel community. |
|
Extension of TunnelCommunity logic to link up circuits and create closed-loop e2e circuits. |
- class latest.ipv8.messaging.anonymization.hidden_services.HiddenTunnelSettings
Bases:
latest.ipv8.messaging.anonymization.community.TunnelSettings
Settings for the hidden tunnel community.
- class latest.ipv8.messaging.anonymization.hidden_services.HiddenTunnelCommunity(settings: HiddenTunnelSettings)
Bases:
latest.ipv8.messaging.anonymization.community.TunnelCommunity
Extension of TunnelCommunity logic to link up circuits and create closed-loop e2e circuits.
- settings_class
- join_swarm(info_hash: bytes, hops: int, callback: Callable[[Address], None] | None = None, seeding: bool = True) → None
Join a hidden swarm. This should be called by both the downloader and the seeder. Calling this method while already part of the swarm will cause the community to drop all pre-existing connections. Note that the seeder should also create introduction points by calling create_introduction_point().
- Parameters:
info_hash – the swarm identifier
hops – the amount of hops for our introduction/rendezvous circuits
callback – the callback function to call when we have established an e2e circuit
seeding – whether the swarm should be joined as seeder
- leave_swarm(info_hash: bytes) → None
Leave a hidden swarm. Can be called by both the downloader and the seeder.
- Parameters:
info_hash – the swarm identifier
- async estimate_swarm_size(info_hash: bytes, hops: int = 1, max_requests: int = 10) → int
Estimate the number of unique seeders that are part of a hidden swarm.
- Parameters:
info_hash – the swarm identifier
hops – the amount of hops to use for contacting introduction points
max_requests – the number of introduction points we should send a get-peers message to
- Returns:
number of unique seeders
- select_circuit_for_infohash(info_hash: bytes) → Circuit | None
Get a circuit that connectes to the swarm of the given SHA-1 hash.
- create_circuit_for_infohash(info_hash: bytes, ctype: str, exit_flags: Set[int] | None = None, required_exit: latest.ipv8.peer.Peer | None = None) → Circuit | None
Create a circuit that connects to the swarm given by the SHA-1 (info) hash.
- do_circuits() → None
Beyond normal circuit creation, make sure we have circuits for introduction points.
- remove_circuit(circuit_id: int, additional_info: str = '', remove_now: bool = False, destroy: bool | int = False) → Coroutine[Any, Any, None]
Remove the given circuit and update any swarms it may be part of.
- remove_exit_socket(circuit_id: int, additional_info: str = '', remove_now: bool = False, destroy: bool = False) → Coroutine[Any, Any, latest.ipv8.messaging.anonymization.exit_socket.TunnelExitSocket | None]
Remove the given exit circuit, remove associated rendezvous points and update any PEX communities it may be part of.
- get_max_time(circuit_id: int) → float
Get the maximum time that a given circuit is allowed to exist.
- tunnel_data(circuit: Circuit | latest.ipv8.messaging.anonymization.exit_socket.TunnelExitSocket, destination: Address, payload: VariablePayloadWID) → None
Send any serializable payload to the next hop in the circuit.
- select_circuit(destination: Address | None, hops: int) → Circuit | None
Make sure that we select the right circuit when dealing with an e2e connection.
- send_peers_request(info_hash: bytes, target: latest.ipv8.messaging.anonymization.tunnel.IntroductionPoint | None, hops: int) → Future[list[latest.ipv8.messaging.anonymization.tunnel.IntroductionPoint]]
Attempt to find peers for a given SHA-1 (info) hash.
- async on_peers_request(source_address: Address, payload: PeersRequestPayload, circuit_id: int | None = None) → None
Callback for when someone wants us to find peers for their circuit.
- send_peers_response(target_addr: Address, request: PeersRequestPayload, intro_points: list[latest.ipv8.messaging.anonymization.tunnel.IntroductionPoint], circuit_id: int | None) → None
Send a response with the peers that we found through the DHT.
- on_peers_response(source_address: Address, payload: PeersResponsePayload, circuit_id: int | None) → None
Callback for when someone performed a DHT lookup for us.
- create_e2e(info_hash: bytes, intro_point: latest.ipv8.messaging.anonymization.tunnel.IntroductionPoint) → None
Create an e2e bridge for the given SHA-1 (info) hash over the given introduction point.
- async on_create_e2e(source_address: Address, payload: CreateE2EPayload, circuit_id: int | None = None) → None
Callback for when we receive a creation message for an e2e circuit.
- create_created_e2e(rp: latest.ipv8.messaging.anonymization.tunnel.RendezvousPoint, source_address: Address, payload: CreateE2EPayload, circuit_id: int | None) → None
Callback for when we receive “create” or “created” payloads.
- async on_created_e2e(source_address: Address, payload: CreatedE2EPayload, circuit_id: int | None) → None
Callback for when peers signal that they have created an e2e circuit.
- on_link_e2e(source_address: Address, payload: LinkE2EPayload, circuit_id: int | None) → None
Callback for when an e2e circuit attempts to link up sender and receiver.
- on_linked_e2e(source_address: Address, payload: LinkedE2EPayload, circuit_id: int | None) → None
Callback for when a sender and receiver circuit have been linked up.
- async create_introduction_point(info_hash: bytes, required_ip: latest.ipv8.peer.Peer | None = None) → None
Create an introduction point for the given SHA-1 (info) hash.
- on_establish_intro(source_address: Address, payload: EstablishIntroPayload, circuit_id: int | None) → None
Callback for when we are asked to be an introduction point.
- on_intro_established(source_address: Address, payload: IntroEstablishedPayload, circuit_id: int | None) → None
Callback for when a peer signals that an introduction point has been created for us.
- async create_rendezvous_point(info_hash: bytes) → latest.ipv8.messaging.anonymization.tunnel.RendezvousPoint | None
Create a new rendezvous point for the given SHA-1 (info) hash.
- on_establish_rendezvous(source_address: Address, payload: EstablishRendezvousPayload, circuit_id: int | None) → None
Callback for when we are requested to be a rendezvous point.
- on_rendezvous_established(source_address: Address, payload: RendezvousEstablishedPayload, circuit_id: int | None) → None
Callback for when a peer signals that they act as a rendezvous point for us.
- async dht_lookup(info_hash: bytes) → tuple[bytes, list[latest.ipv8.messaging.anonymization.tunnel.IntroductionPoint]] | None
Attempt to find introduction points for the given SHA-1 (info) hash.
- async dht_announce(info_hash: bytes, intro_point: latest.ipv8.messaging.anonymization.tunnel.IntroductionPoint) → None
Announce ourselves as a candidate for the given SHA-1 (info) hash.