Route class
Represents a route to a peer in the network.
A route encapsulates information about how to reach a specific peer, including its ID, addresses, and whether it can forward messages. It is used by the router to determine the best path for delivering messages to a given destination.
Constructors
-
Route({required PeerId peerId, bool canForward = false, PacketHeader? header, Map<
FullAddress, AddressProperties> ? addresses, ({FullAddress ip, AddressProperties properties})? address})
Properties
-
addresses
→ Map<
FullAddress, AddressProperties> -
The addresses associated with the peer.
no setter
- canForward ↔ bool
-
Whether the peer can forward messages to other peers.
getter/setter pair
- hashCode → int
-
The hash code for this object.
no setterinherited
- isEmpty → bool
-
Whether the route is empty (has no addresses).
no setter
- isNotEmpty → bool
-
Whether the route is not empty (has at least one address).
no setter
-
lastHeaders
→ QueueList<
PacketHeader> -
The last headers received from the peer.
no setter
- lastSeen → int
-
The last time the peer was seen (in milliseconds since epoch).
no setter
- peerId → PeerId
-
The unique identifier of the peer associated with this route.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
addAddress(
{required FullAddress address, required AddressProperties properties, bool? canForward}) → void - Adds an address to the route.
-
addHeader(
PacketHeader header) → void - Adds a header to the route's header history.
-
getActualAddresses(
{required int staleAt}) → Iterable< FullAddress> - Returns the actual addresses for the route, filtering out stale addresses.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
removeStaleAddresses(
{required int staleAt}) → void - Removes stale addresses from the route.
-
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
- maxStoredHeaders ↔ int
-
The maximum number of headers to store for the route.
getter/setter pair