LanTransport constructor

LanTransport({
  1. Duration discoveryInterval = const Duration(seconds: 5),
  2. Duration reconnectBaseDelay = const Duration(seconds: 2),
  3. Duration reconnectMaxDelay = const Duration(seconds: 60),
  4. int maxInboundConnections = 64,
  5. Duration helloTimeout = const Duration(seconds: 10),
  6. int maxFrameBytes = 4 << 20,
})

Creates a transport.

discoveryInterval controls how often the network is re-browsed for new peers. reconnectBaseDelay and reconnectMaxDelay bound the exponential backoff used when re-dialing a dropped peer.

maxInboundConnections, helloTimeout and maxFrameBytes bound what an inbound connection from the network may cost: a connection beyond the cap is closed, one that has not named itself within helloTimeout is evicted, and one that sends a message larger than maxFrameBytes is closed. Hygiene against floods, not authentication: a node id is only a claim, and peers are authenticated by Passnote's signed session handshake.

Implementation

LanTransport({
  Duration discoveryInterval = const Duration(seconds: 5),
  Duration reconnectBaseDelay = const Duration(seconds: 2),
  Duration reconnectMaxDelay = const Duration(seconds: 60),
  this.maxInboundConnections = 64,
  this.helloTimeout = const Duration(seconds: 10),
  this.maxFrameBytes = 4 << 20,
})  : _discoveryInterval = discoveryInterval,
      _reconnectBaseDelay = reconnectBaseDelay,
      _reconnectMaxDelay = reconnectMaxDelay;