AutoRelayConfig.static constructor

AutoRelayConfig.static(
  1. List<AddrInfo> staticRelays, {
  2. Clock? clock,
  3. Duration? bootDelay,
  4. Duration? backoff,
  5. Duration? maxCandidateAge,
  6. Duration? minInterval,
  7. MetricsTracer? metricsTracer,
})

Implementation

factory AutoRelayConfig.static(
  List<AddrInfo> staticRelays, {
  Clock? clock,
  Duration? bootDelay, // bootDelay is not set by Go's WithStaticRelays
  Duration? backoff,   // backoff is not set by Go's WithStaticRelays
  Duration? maxCandidateAge, // maxCandidateAge is not set by Go's WithStaticRelays
  Duration? minInterval, // minInterval is not set by Go's WithStaticRelays
  MetricsTracer? metricsTracer,
}) {
  if (staticRelays.isEmpty) {
    throw ArgumentError('staticRelays list cannot be empty if provided.');
  }
  return AutoRelayConfig(
    clock: clock,
    staticRelays: staticRelays,
    // In Go, WithStaticRelays sets peerSource, minCandidates, maxCandidates, and desiredRelays.
    // minCandidates, maxCandidates, desiredRelays are set to len(staticRelays).
    minCandidates: staticRelays.length,
    maxCandidates: staticRelays.length,
    desiredRelays: staticRelays.length,
    // Other parameters use defaults or provided values
    bootDelay: bootDelay,
    backoff: backoff,
    maxCandidateAge: maxCandidateAge,
    minInterval: minInterval,
    metricsTracer: metricsTracer,
  );
}