core/interfaces library

Classes

AddrDelay
AddrDelay provides an address along with the delay after which the address should be dialed
AddrInfo
Represents a peer with its addresses
Conn
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:
ConnManagementScope
ConnManagementScope is the low level interface for connection resource scopes.
ConnScope
ConnScope is the user view of a connection scope.
ConnState
ConnectionState holds information about the connection.
ConnStats
ConnStats stores metadata pertaining to a given Conn.
Context
Context class for network operations
Dialer
Dialer represents a service that can dial out to peers
EvtPeerConnectednessChanged
Host
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).
MultiAddr
Represents a multiaddress
MultiaddrDNSResolver
MultiaddrDNSResolver resolves DNS multiaddrs
Multiplexer
Multiplexer wraps a connection with a stream multiplexing implementation and returns a MuxedConn that supports opening multiple streams over the underlying connection
MuxedConn
MuxedConn represents a connection to a remote peer that has been extended to support stream multiplexing.
MuxedStream
MuxedStream is a bidirectional io pipe within a connection.
Negotiator
Negotiator is a component capable of reaching agreement over what protocols to use for inbound streams of communication.
Network
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.
NoopNotifiee
NoopNotifiee is a no-op implementation of Notifiee
Notifiee
Notifiee is an interface for an object wishing to receive notifications from a Network.
NotifyBundle
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.
NullResourceManager
NullResourceManager is a stub for tests and initialization of default values
NullScope
NullScope is a stub for tests and initialization of default values
P2PStream<T>
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.
PeerScope
PeerScope is the interface for peer resource scopes.
ProtocolIDUtil
Utility functions for protocol IDs
ProtocolScope
ProtocolScope is the interface for protocol resource scopes.
ProtocolSwitch
Switch is the component responsible for "dispatching" incoming stream requests to their corresponding stream handlers. It is both a Negotiator and a Router.
ReservationPriority
Reservation priorities
ReservedProtocolIDs
These are reserved protocol IDs.
ResourceManager
ResourceManager is the interface for managing resources in libp2p.
ResourceScope
ResourceScope is the interface for all scopes.
ResourceScopeSpan
ResourceScopeSpan is a ResourceScope with a delimited span.
ResourceScopeViewer
ResourceScopeViewer is a mixin interface providing view methods for accessing top level scopes.
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.
ScopeStat
ScopeStat is a struct containing resource accounting information.
ServiceScope
ServiceScope is the interface for service resource scopes
Stats
Stats stores metadata pertaining to a given Stream / Conn.
StreamManagementScope
StreamManagementScope is the interface for stream resource scopes.
StreamScope
StreamScope is the user view of a StreamScope.
StreamStats
Stores metadata pertaining to a given Stream

Enums

Connectedness
Connectedness signals the capacity for a connection with a given node. It is used to signal to services and other peers whether a node is reachable.
NATDeviceType
NATDeviceType indicates the type of the NAT device.
NATTransportProtocol
NATTransportProtocol is the transport protocol for which the NAT Device Type has been determined.
Reachability
Reachability indicates how reachable a node is.

Constants

messageSizeMax → const int
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.

Properties

globalNoopNotifiee NoopNotifiee
Global noop notifiee. Do not change.
final

Typedefs

AddrsFactory = List<MultiAddr> Function(List<MultiAddr> addrs)
AddrsFactory functions can be passed to a Host to override addresses returned by Addrs.
DialRanker = List<AddrDelay> Function(List<MultiAddr> addrs)
DialRanker provides a schedule of dialing the provided addresses
HandlerFunc = void Function(ProtocolID protocol, P2PStream stream)
HandlerFunc is a user-provided function used by the Router to handle a protocol/stream.
ProtocolID = String
ProtocolID is a string identifier for a protocol.
StreamHandler = Future<void> Function(P2PStream stream, PeerId remotePeer)
StreamHandler is the type of function used to listen for streams opened by the remote side.

Exceptions / Errors

ConnectionFailedException
Thrown when connection establishment fails
Libp2pException
Base class for libp2p-related exceptions
LimitedConnException
Exception thrown when attempting to open a stream to a peer with only a limited connection, without specifying the AllowLimitedConn option.
NoConnException
Exception thrown when attempting to open a stream to a peer with the NoDial option and no usable connection is available.
NoRemoteAddrsException
Exception thrown when there are no addresses associated with a peer during a dial.
ProtocolNegotiationException
Thrown when protocol negotiation fails
ResetException
Error thrown when reading or writing on a reset stream.
ResourceLimitExceededException
Exception thrown when attempting to perform an operation that would exceed system resource limits.
ResourceScopeClosedException
Exception thrown when attempting to reserve resources in a closed resource scope.
TemporaryException
Exception thrown when a temporary error occurs
TransientConnException
Exception thrown when attempting to open a stream to a peer with only a transient connection, without specifying the UseTransient option.