libp2p.identity.identify_push package
Submodules
libp2p.identity.identify_push.identify_push module
- libp2p.identity.identify_push.identify_push.identify_push_handler_for(host: IHost, use_varint_format: bool = True) Callable[[object], Awaitable[None]]
Create a handler for the identify/push protocol.
This handler receives pushed identify messages from remote peers and updates the local peerstore with the new information.
- Args:
host: The libp2p host. use_varint_format: True=length-prefixed, False=raw protobuf.
- async libp2p.identity.identify_push.identify_push.push_identify_to_peer(host: ~libp2p.abc.IHost, peer_id: ~libp2p.peer.id.ID, observed_multiaddr: ~multiaddr.multiaddr.Multiaddr | None = None, limit: ~trio.Semaphore = <trio.Semaphore(10)>, use_varint_format: bool = True) bool
Push an identify message to a specific peer.
This function opens a stream to the peer using the identify/push protocol, sends the identify message, and closes the stream.
- Args:
host: The libp2p host. peer_id: The peer ID to push to. observed_multiaddr: The observed multiaddress (optional). limit: Semaphore for concurrency control. use_varint_format: True=length-prefixed, False=raw protobuf.
- Returns:
bool: True if the push was successful, False otherwise.
- async libp2p.identity.identify_push.identify_push.push_identify_to_peers(host: IHost, peer_ids: set[ID] | None = None, observed_multiaddr: Multiaddr | None = None, use_varint_format: bool = True) None
Push an identify message to multiple peers in parallel.
If peer_ids is None, push to all connected peers.
- Args:
host: The libp2p host. peer_ids: Set of peer IDs to push to (if None, push to all connected peers). observed_multiaddr: The observed multiaddress (optional). use_varint_format: True=length-prefixed, False=raw protobuf.
Module contents
- libp2p.identity.identify_push.identify_push_handler_for(host: IHost, use_varint_format: bool = True) Callable[[object], Awaitable[None]]
Create a handler for the identify/push protocol.
This handler receives pushed identify messages from remote peers and updates the local peerstore with the new information.
- Args:
host: The libp2p host. use_varint_format: True=length-prefixed, False=raw protobuf.
- async libp2p.identity.identify_push.push_identify_to_peer(host: ~libp2p.abc.IHost, peer_id: ~libp2p.peer.id.ID, observed_multiaddr: ~multiaddr.multiaddr.Multiaddr | None = None, limit: ~trio.Semaphore = <trio.Semaphore(10)>, use_varint_format: bool = True) bool
Push an identify message to a specific peer.
This function opens a stream to the peer using the identify/push protocol, sends the identify message, and closes the stream.
- Args:
host: The libp2p host. peer_id: The peer ID to push to. observed_multiaddr: The observed multiaddress (optional). limit: Semaphore for concurrency control. use_varint_format: True=length-prefixed, False=raw protobuf.
- Returns:
bool: True if the push was successful, False otherwise.
- async libp2p.identity.identify_push.push_identify_to_peers(host: IHost, peer_ids: set[ID] | None = None, observed_multiaddr: Multiaddr | None = None, use_varint_format: bool = True) None
Push an identify message to multiple peers in parallel.
If peer_ids is None, push to all connected peers.
- Args:
host: The libp2p host. peer_ids: Set of peer IDs to push to (if None, push to all connected peers). observed_multiaddr: The observed multiaddress (optional). use_varint_format: True=length-prefixed, False=raw protobuf.