BasicHost class
BasicHost is the basic implementation of the Host interface. This particular host implementation:
- uses a protocol muxer to mux per-protocol streams
- uses an identity service to send + receive node information
- uses a nat service to establish NAT port mappings
- Implemented types
- Available extensions
Properties
-
addrs
→ List<
MultiAddr> -
Addrs returns the listen addresses of the Host
no setteroverride
-
allAddrs
→ List<
MultiAddr> -
Returns all addresses the host is listening on.
no setter
- connManager → ConnManager
-
ConnManager returns this hosts connection manager
no setteroverride
- eventBus → EventBus
-
EventBus returns the hosts eventbus
no setteroverride
- hashCode → int
-
The hash code for this object.
no setterinherited
- holePunchService → HolePunchService?
-
Returns the HolePunchService for this host, if available.
no setteroverride
- id → PeerId
-
ID returns the (local) peer.ID associated with this Host
no setteroverride
- mux → ProtocolSwitch
-
Mux returns the Mux multiplexing incoming streams to protocol handlers
no setteroverride
- network → Network
-
Network returns the Network interface of the Host
no setteroverride
- peerStore → Peerstore
-
Peerstore returns the Host's repository of Peer Addresses and Keys.
no setteroverride
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
addStompService(
{StompServiceOptions? options}) → Future< StompService> -
Available on Host, provided by the StompHostExtension extension
Adds STOMP service to the host -
close(
) → Future< void> -
Close shuts down the host, its Network, and services.
override
-
connect(
AddrInfo pi, {Context? context}) → Future< void> -
Connect ensures there is a connection between this host and the peer with
given peer.ID. Connect will absorb the addresses in pi into its internal
peerstore. If there is not an active connection, Connect will issue a
h.Network.Dial, and block until a connection is open, or an error is
returned.
override
-
connectStomp(
{required PeerId peerId, required String hostName, String? login, String? passcode, Duration? timeout}) → Future< StompClient> -
Available on Host, provided by the StompHostExtension extension
Creates a STOMP client connection to a peer -
newStream(
PeerId p, List< ProtocolID> pids, Context context) → Future<P2PStream> -
NewStream opens a new stream to given peer p, and writes a p2p/protocol
header with given ProtocolID. If there is no connection to p, attempts
to create one. If ProtocolID is "", writes no header.
(Thread-safe)
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
removeStreamHandler(
ProtocolID pid) → void -
RemoveStreamHandler removes a handler on the mux that was set by
SetStreamHandler
override
-
setStreamHandler(
ProtocolID pid, StreamHandler handler) → void -
SetStreamHandler sets the protocol handler on the Host's Mux.
This is equivalent to:
host.Mux().SetHandler(proto, handler)
(Thread-safe)
override
-
setStreamHandlerMatch(
ProtocolID pid, bool match(ProtocolID), StreamHandler handler) → void -
SetStreamHandlerMatch sets the protocol handler on the Host's Mux
using a matching function for protocol selection.
override
-
signalAddressChange(
) → void - Signals that the host's addresses may have changed.
-
start(
) → Future< void> -
Starts the host's background tasks.
override
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited