RouterBase constructor

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

Implementation

RouterBase({
  Crypto? crypto,
  List<TransportBase>? transports,
  this.messageTTL = const Duration(seconds: 3),
  this.keepalivePeriod = const Duration(seconds: 15),
  this.logger,
}) : crypto = crypto ?? Crypto() {
  // Initialize transports with provided or default UDP transports.
  this.transports.addAll(
    transports ??
        [
          TransportUdp(
            bindAddress: FullAddress(
              address: InternetAddress.anyIPv4,
              port: TransportUdp.defaultPort,
            ),
            ttl: messageTTL.inSeconds,
          ),
          TransportUdp(
            bindAddress: FullAddress(
              address: InternetAddress.anyIPv6,
              port: TransportUdp.defaultPort,
            ),
            ttl: messageTTL.inSeconds,
          ),
        ],
  );
}