Envelope contains a signed payload produced by a peer.
This is a placeholder for the actual Envelope class that would be defined in the record module.
When the record module is implemented, this should be replaced with the actual Envelope class.
Conn is a connection to a remote peer. It multiplexes streams.
Usually there is no need to use a Conn directly, but it may
be useful to get information about the peer on the other side:
EvtLocalAddressesUpdated should be emitted when the set of listen addresses for
the local host changes. This may happen for a number of reasons. For example,
we may have opened a new relay connection, established a new NAT mapping via
UPnP, or been informed of our observed address by another peer.
EvtLocalProtocolsUpdated should be emitted when stream handlers are attached or detached from the local host.
For handlers attached with a matcher predicate (host.setStreamHandlerMatch()), only the protocol ID will be
included in this event.
Host is an object participating in a p2p network, which
implements protocols or provides services. It handles
requests like a Server, and issues requests like a Client.
It is called Host because it is both Server and Client (and Peer
may be confusing).
Multiplexer wraps a connection with a stream multiplexing
implementation and returns a MuxedConn that supports opening
multiple streams over the underlying connection
Network is the interface used to connect to the outside world.
It dials and listens for connections. it uses a Swarm to pool
connections. Connections are encrypted with a TLS-like protocol.
NotifyBundle implements Notifiee by calling any of the functions set on it,
and nop'ing if they are unset. This is the easy way to register for
notifications.
Represents a bidirectional channel between two agents in
a libp2p network. "agent" is as granular as desired, potentially
being a "request -> reply" pair, or whole protocols.
PeerMetadata can handle values of any type. Serializing values is
up to the implementation. Dynamic type introspection may not be
supported, in which case explicitly enlisting types in the
serializer may be required.
PeerRecord contains information that is broadly useful to share with other peers,
either through a direct exchange (as in the libp2p identify protocol), or through
a Peer Routing provider, such as a DHT.
PeerRouting is a way to find address information about certain peers.
This can be implemented by a simple lookup table, a tracking server,
or even a DHT.
Switch is the component responsible for "dispatching" incoming stream requests to
their corresponding stream handlers. It is both a Negotiator and a Router.
Router is an interface that allows users to add and remove protocol handlers,
which will be invoked when incoming stream requests for registered protocols
are accepted.
Routing is the combination of different routing types supported by libp2p.
It can be satisfied by a single item (such as a DHT) or multiple different
pieces that are more optimized to each task.
TransportConn extends the Conn interface with methods for reading and writing raw data.
This is used by transport implementations that need to send and receive data directly.
AddrAction represents an action taken on one of a Host's listen addresses.
It is used to add context to address change events in EvtLocalAddressesUpdated.
Common types used by both conn.dart and rcmgr.dart to avoid circular dependencies
Direction specifies whether this is an inbound or an outbound connection.
MessageSizeMax is a soft (recommended) maximum for network messages.
One can write more, as the interface is a stream. But it is useful
to bunch it up into multiple read/writes when the whole message is
a single, large serialized object.
GetCertifiedAddrBook is a helper to "upcast" an AddrBook to a
CertifiedAddrBook by using type assertion. If the given AddrBook
is also a CertifiedAddrBook, it will be returned, and the ok return
value will be true. Returns (null, false) if the AddrBook is not a
CertifiedAddrBook.