RouterBase class abstract

Abstract base class for network routers.

This class provides the fundamental functionality for managing network communication, including initialization, starting and stopping the router, and handling routes. It defines the core interface for interacting with the network and is intended to be extended by concrete router implementations.

Implementers

Constructors

RouterBase({Crypto? crypto, List<TransportBase>? transports, Duration messageTTL = const Duration(seconds: 3), Duration keepalivePeriod = const Duration(seconds: 15), void logger(String)?})

Properties

crypto Crypto
The cryptography instance used for encryption and signing.
final
hashCode int
The hash code for this object.
no setterinherited
isNotRunning bool
no setter
isRunning bool
no setter
keepalivePeriod Duration
The keepalive period, specifying the interval for sending keepalive messages to peers.
final
logger ↔ void Function(String)?
The logger used for logging events.
getter/setter pair
maxStoredHeaders int
The maximum number of stored headers for routes.
getter/setter pair
messageTTL Duration
The message time-to-live, specifying how long messages are considered valid.
getter/setter pair
peerAddressTTL Duration
The peer address time-to-live, specifying how long peer addresses are considered valid. Defaults to twice the keepalive period.
getter/setter pair
routes Map<PeerId, Route>
The routes maintained by the router, stored as a map of PeerId to Route.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
selfId PeerId
no setter
transports List<TransportBase>
The transports used for network communication.
final
useForwardersLimit int
Defines the maximum number of forwarders to use for message delivery.
getter/setter pair

Methods

init([Uint8List? seed]) Future<Uint8List>
Initializes the router.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onMessage(Packet packet) Future<Packet>
Handles incoming messages.
resolvePeerId(PeerId peerId) Iterable<FullAddress>
Resolves a Peer ID to a set of network addresses.
sendDatagram({required Iterable<FullAddress> addresses, required Uint8List datagram}) → void
Sends a datagram to the specified addresses.
start() Future<void>
Starts the router.
stop() → void
Stops the router.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited