libp2p/observedaddrmanager

Search:
Group by:
Source   Edit  

Types

ObservedAddrManager = ref object of RootObj
  
Source   Edit  

Procs

proc `$`(self: ObservedAddrManager): string {....raises: [], tags: [RootEffect],
    forbids: [].}
Returns a string representation of the ObservedAddrManager. Source   Edit  
proc addObservation(self: ObservedAddrManager; observedAddr: MultiAddress): bool {.
    ...raises: [], tags: [], forbids: [].}
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: [], forbids: [].}
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], forbids: [].}
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