Libp2p.InboundStream (libp2p_elixir v0.9.0)

Behaviour for handling inbound Libp2p streams.

Modules implementing this behaviour are used to handle incoming streams for specific protocols (like /ipfs/id/1.0.0 or custom application protocols).

Usage

When a remote peer initiates a new stream, the Libp2p.ConnectionV2 process negotiates the protocol using Multistream-select. If a handler is registered for the agreed-upon protocol, its handle_stream/2 callback is invoked.

The handler receives:

  • The connection pid (to send data back).
  • The stream_id (identifying the specific Yamux stream).

Summary

Functions

Returns a specification to start this module under a supervisor.

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

start_link(opts)

@spec start_link(keyword()) :: GenServer.on_start()