3.0.ipv8.dht.discovery ====================== .. py:module:: 3.0.ipv8.dht.discovery Classes ------- .. autoapisummary:: 3.0.ipv8.dht.discovery.DHTDiscoveryCommunity Module Contents --------------- .. py:class:: DHTDiscoveryCommunity(settings: 3.0.ipv8.community.CommunitySettings) Bases: :py:obj:`3.0.ipv8.dht.community.DHTCommunity` Community for discovering peers that are behind NAT. .. py:attribute:: store :type: dict[bytes, list[3.0.ipv8.dht.routing.Node]] .. py:attribute:: store_for_me :type: dict[bytes, list[3.0.ipv8.dht.routing.Node]] .. py:method:: on_ping_request(peer: 3.0.ipv8.types.Peer, payload: 3.0.ipv8.dht.payload.PingRequestPayload, data: bytes) -> None When a ping comes in and we store it, update its metrics. .. py:method:: on_ping_response(peer: 3.0.ipv8.types.Peer, payload: 3.0.ipv8.dht.payload.PingResponsePayload, data: bytes) -> None When a ping response comes in and we store it, update its metrics. .. py:method:: find_node_in_dict(public_key_bin: bytes, node_dict: dict[bytes, list[3.0.ipv8.dht.routing.Node]]) -> 3.0.ipv8.dht.routing.Node | None Get the Node instance belonging to the public key in the given dictionary. .. py:method:: store_peer() -> list[3.0.ipv8.dht.routing.Node] :async: Store ourselves. .. py:method:: send_store_peer_request(key: bytes, nodes: list[3.0.ipv8.dht.routing.Node]) -> list[3.0.ipv8.dht.routing.Node] :async: Send a request for storage to the given nodes. .. py:method:: connect_peer(mid: bytes, peer: 3.0.ipv8.types.Peer | None = None) -> list[3.0.ipv8.dht.routing.Node] :async: Attempt to connect to a peer with the given mid, at first without a DHT lookup. .. py:method:: send_connect_peer_request(key: bytes, nodes: list[3.0.ipv8.dht.routing.Node]) -> list[3.0.ipv8.dht.routing.Node] :async: Send a request for connection to the given nodes. .. py:method:: on_store_peer_request(peer: 3.0.ipv8.types.Peer, payload: 3.0.ipv8.dht.payload.StorePeerRequestPayload) -> None When we receive a request to store a peer, attempt to add it. .. py:method:: on_store_peer_response(peer: 3.0.ipv8.types.Peer, payload: 3.0.ipv8.dht.payload.StorePeerResponsePayload) -> None When a peer signals storage is complete, pop it from our cache. .. py:method:: on_connect_peer_request(peer: 3.0.ipv8.types.Peer, payload: 3.0.ipv8.dht.payload.ConnectPeerRequestPayload) -> None When a peer wants to connect to another peer, try to puncture the requested "other" peer. .. py:method:: on_connect_peer_response(peer: 3.0.ipv8.types.Peer, payload: 3.0.ipv8.dht.payload.ConnectPeerResponsePayload) -> None Handle responses of peers that performed punctures for us. .. py:method:: ping_all() -> None Send a ping to all known nodes.