libp2p/observedaddrmanager

    Dark Mode
Search:
Group by:
  Source   Edit

Types

ObservedAddrManager = ref object of RootObj
  observedIPsAndPorts: seq[MultiAddress]
  maxSize: int
  minCount: int
  Source   Edit

Procs

proc `$`(self: ObservedAddrManager): string {....raises: [], tags: [RootEffect].}
Returns a string representation of the ObservedAddrManager.   Source   Edit
proc addObservation(self: ObservedAddrManager; observedAddr: MultiAddress): bool {.
    ...raises: [], tags: [].}
Adds a new observed MultiAddress. If the number of observations exceeds maxSize, the oldest one is removed.   Source   Edit
proc getMostObservedProtosAndPorts(self: ObservedAddrManager): seq[MultiAddress] {.
    ...raises: [], tags: [].}
Returns the most observed IP4/Port and IP6/Port address or an empty seq if the number of observations are less than minCount.   Source   Edit
proc guessDialableAddr(self: ObservedAddrManager; ma: MultiAddress): MultiAddress {.
    ...raises: [], tags: [RootEffect].}
Replaces the first proto value of each listen address by the corresponding (matching the proto code) most observed value. If the most observed value is not available, the original MultiAddress is returned.   Source   Edit
proc new(T: typedesc[ObservedAddrManager]; maxSize = 10; minCount = 3): T:type {.
    ...raises: [].}
Creates a new ObservedAddrManager.   Source   Edit