Create and return a PeerFilter. This can be used by topologies to prevent them receiving duplicate notifications for a peer that connects repeatedly.
The maximum number of peers expected to be added to the filter
The acceptable error rate
import { peerFilter } from '@libp2p/peer-collections'import type { Registrar } from '@libp2p/interface-internal'const registrar: Registrarregistrar.register('/my/protocol/1.0.0', { filter: peerFilter(), onConnect: (peerId) => { // will only be invoked for a given peerId once }}) Copy
import { peerFilter } from '@libp2p/peer-collections'import type { Registrar } from '@libp2p/interface-internal'const registrar: Registrarregistrar.register('/my/protocol/1.0.0', { filter: peerFilter(), onConnect: (peerId) => { // will only be invoked for a given peerId once }})
Create and return a PeerFilter. This can be used by topologies to prevent them receiving duplicate notifications for a peer that connects repeatedly.