Libp2p.MultistreamSelect (libp2p_elixir v0.9.0)
Multistream-select 1.0 negotiation helpers.
Used to negotiate:
- connection-level protocols (security, muxer) and
- stream-level protocols (app protocols, e.g. eth2 req/resp).
Summary
Functions
Decode a single message. Returns {msg, rest} or :more.
Encode a multistream-select message (uvarint length prefix + utf8 + \n).
Feed inbound bytes. Returns {events, out_bytes, st2}.
Produce bytes that should be written immediately when starting negotiation.
Types
Functions
Decode a single message. Returns {msg, rest} or :more.
Returned msg excludes the trailing \n.
Encode a multistream-select message (uvarint length prefix + utf8 + \n).
Feed inbound bytes. Returns {events, out_bytes, st2}.
Events:
{:selected, protocol_id}when negotiation completes successfully.{:error, reason}for protocol violations.
@spec multistream_id() :: binary()
@spec new_responder() :: state()
Produce bytes that should be written immediately when starting negotiation.