RouterL3 class
Router implementation for Layer 3 (Network Layer).
This class extends RouterL2 and provides functionality for managing
network addresses and bootstrapping. It handles the discovery and
connection to bootstrap nodes, enabling the router to join the network.
- Inheritance
-
- Object
- RouterBase
- RouterL0
- RouterL1
- RouterL2
- RouterL3
Constructors
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
-
lastSeenStream
→ Stream<
PeerStatus> -
A stream of peer status updates.
no setterinherited
- 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 setterinherited
- 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
- peerOnlineTimeout ↔ Duration
-
The timeout period for considering a peer offline.
getter/setter pairinherited
- retryPeriod ↔ Duration
-
The retry period for sending messages.
getter/setter pairinherited
-
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 setterinherited
- 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
-
addBootstrap(
{required String bsName, required String bsPeerId, int port = TransportUdp.defaultPort}) → Future< void> - Adds a bootstrap node to the router.
-
addPeerAddress(
{required PeerId peerId, required FullAddress address, required AddressProperties properties, bool? canForward}) → void -
Adds an address for a peer to the routing table.
inherited
-
getPeerStatus(
PeerId peerId) → bool -
Returns the status of a peer.
inherited
-
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 packets.
inherited
-
pingPeer(
PeerId peerId) → Future< bool> -
Pings a peer to check if it is online.
inherited
-
removeAllBootstraps(
) → void - Removes all bootstrap nodes from the router.
-
removePeerAddress(
PeerId peerId) → void -
Removes the peer address from the routing table.
inherited
-
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.
inherited
-
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.
inherited
-
start(
{int port = TransportUdp.defaultPort}) → Future< void> -
Starts the router and binds to available network interfaces.
override
-
stop(
) → void -
Stops the router and clears the transports.
override
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited