Libp2p.Identify (libp2p_elixir v0.9.0)
Implements the /ipfs/id/1.0.0 and /ipfs/id/push/1.0.0 protocols.
The Identify protocol is used to exchange information about peers, including their public keys, listening addresses, and supported protocols.
Protocol Variants
- Identify (
/ipfs/id/1.0.0): A query-response protocol where one peer asks for the other's identity. The response contains theIdentifyprotobuf message. - Identify Push (
/ipfs/id/push/1.0.0): A one-way stream used to proactively notify connected peers of changes (e.g., a new listening address).
Message Content
The exchanged Identify message includes:
- protocolVersion: Family of protocols (e.g.,
ipfs/0.1.0). - agentVersion: The client implementation (e.g.,
libp2p-elixir/0.1.0). - publicKey: The public key of the peer.
- listenAddrs: A list of multiaddresses the peer is listening on.
- observedAddr: The address of the remote peer as seen by the sender (useful for NAT detection).
- protocols: A list of protocol IDs supported by the peer.
Summary
Functions
@spec handle_inbound(pid(), non_neg_integer(), binary()) :: :ok
@spec handle_inbound(pid(), non_neg_integer(), binary(), binary()) :: :ok | {:error, term()}
Handle an inbound identify stream.
Perform an outbound identify request.