create static method
Creates and initializes a new RelayManager.
The manager will listen for reachability changes and start/stop the underlying Circuit Relay v2 service accordingly.
host
is the libp2p host instance.
Optional parameters maxReservations
, maxConnections
, reservationTtl
,
connectionDuration
, and connectionData
are used to configure the
Resources for the managed relay service.
Implementation
static Future<RelayManager> create(
Host host, {
int maxReservations = 128,
int maxConnections = 128,
int reservationTtl = 3600, // seconds
int connectionDuration = 3600, // seconds
int connectionData = 1 << 20, // 1 MiB
}) async {
final relayResources = Resources(
maxReservations: maxReservations,
maxConnections: maxConnections,
reservationTtl: reservationTtl,
connectionDuration: connectionDuration,
connectionData: connectionData,
);
final manager = RelayManager._(host, relayResources);
manager._backgroundCompleter = Completer<void>();
manager._startBackgroundListener();
_log.fine('RelayManager created and service monitoring started.');
return manager;
}