RouterL1 class

Enhanced router with confirmation and keepalive features.

This class extends the functionality of RouterL0 by implementing enhanced protocol features like message confirmation and keepalive mechanisms. It is suitable for use as an advanced relay node or as a base class for clients that require more reliable communication.

Inheritance
Implementers

Constructors

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

Properties

crypto Crypto
The cryptography instance used for encryption and signing.
finalinherited
deltaT int
Defines the required clock synchronization accuracy between nodes, in milliseconds.
getter/setter pairinherited
hashCode int
The hash code for this object.
no setterinherited
isNotRunning bool
no setterinherited
isRunning bool
no setterinherited
keepalivePeriod Duration
The keepalive period, specifying the interval for sending keepalive messages to peers.
finalinherited
logger ↔ void Function(String)?
The logger used for logging events.
getter/setter pairinherited
maxForwardsLimit int
Defines the maximum number of times a message can be forwarded.
getter/setter pairinherited
maxStoredHeaders int
The maximum number of stored headers for routes.
getter/setter pairinherited
messageStream Stream<Message>
Returns a stream of incoming messages.
no setter
messageTTL Duration
The message time-to-live, specifying how long messages are considered valid.
getter/setter pairinherited
peerAddressTTL Duration
The peer address time-to-live, specifying how long peer addresses are considered valid. Defaults to twice the keepalive period.
getter/setter pairinherited
retryPeriod Duration
The retry period for sending messages.
getter/setter pair
routes Map<PeerId, Route>
The routes maintained by the router, stored as a map of PeerId to Route.
finalinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
selfAddresses Iterable<FullAddress>
Returns an iterable of the self addresses of this router.
no setter
selfId PeerId
no setterinherited
transports List<TransportBase>
The transports used for network communication.
finalinherited
useForwardersLimit int
Defines the maximum number of forwarders to use for message delivery.
getter/setter pairinherited

Methods

init([Uint8List? seed]) Future<Uint8List>
Initializes the router.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onMessage(Packet packet) Future<Packet>
Handles incoming messages.
override
resolvePeerId(PeerId peerId) Iterable<FullAddress>
Resolves a Peer ID to a set of network addresses.
inherited
sendDatagram({required Iterable<FullAddress> addresses, required Uint8List datagram}) → void
Sends a datagram to the specified addresses.
inherited
sendDatagramConfirmable({required int messageId, required Uint8List datagram, required Iterable<FullAddress> addresses, Duration? ackTimeout}) Future<void>
Sends a confirmable datagram and waits for an acknowledgement.
sendMessage({required PeerId dstPeerId, bool isConfirmable = false, int? messageId, Uint8List? payload, Duration? ackTimeout, Iterable<FullAddress>? useAddresses}) Future<PacketHeader>
Sends a message to the specified destination peer.
start() Future<void>
Starts the router.
override
stop() → void
Stops the router.
override
toString() String
A string representation of this object.
inherited

Operators

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