
Security News
Risky Biz Podcast: AI Agents Are Raising the Stakes for Software Supply Chain Security
Open source attacks are accelerating as AI coding agents pull in dependencies faster, with less human review.
replicator-discovery
Advanced tools
DHT discovery session for replicator
const DHT = require('hyperdht')
const Discovery = require('@holepunchto/replicator-discovery')
const dht = new DHT({ bootstrap })
await dht.ready()
const server = dht.createServer()
await server.listen()
const discovery = new Discovery(dht, topic, {
announce: true,
seed,
relayAddresses: () => server.relayAddresses,
onpeer(peer) {
console.log(peer.publicKey)
}
})
await discovery.refresh()
await discovery.suspend()
await discovery.resume()
await discovery.destroy()
await server.close()
await dht.destroy()
new Discovery(dht, topic, opts)Options:
announce (false) see setAnnounceonpeer(peer, data) peer info callback during lookupseed seed keyPairkeyPair announced keyPairrelayAddresses() getter for relay addresses during announceonerror(err) error-handler for internal timersonbump(number) invoked when higher number is seenlimit (Infinity) max peers emitted per refreshsuspended (false) initialize as suspendedwait (null) promise awaited before refresh startsAttributes:
topickeyPairdestroyedsuspendedannounceactive refresh cycle is alivelastRefreshed timestampbump.local local valuebump.announced announced valuebump.seen max seen remote valuediscovery.setAnnounce(bool, bump = -1)Switch mode:
true => announcefalse => lookupFor bump see update()
discovery.update(bump)Updates the local bump value. The local value will be published on next refresh when announcing.
await discovery.refresh()Performs announce/lookup and starts background discovery cycle.
await discovery.flushed()Wait for the current in-flight refresh.
await discovery.abort()Abort the active query and stop discovery cycle.
Use refresh() to restart.
await discovery.suspend()Abort the active query and unannounce if needed.
await discovery.resume()Resume and refresh.
await discovery.destroy()Destroy permanently.
After destroy, refresh() throws Error('PeerDiscovery is destroyed').
Apache-2.0
FAQs
peer discovery for replicator
The npm package replicator-discovery receives a total of 5 weekly downloads. As such, replicator-discovery popularity was classified as not popular.
We found that replicator-discovery demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Open source attacks are accelerating as AI coding agents pull in dependencies faster, with less human review.

Research
/Security News
Malicious Chrome and Firefox extensions posed as free VPNs while stealing clipboard data through later extension updates.

Research
/Security News
Miasma Mini Shai-Hulud hits @immobiliarelabs Backstage plugins, targeting GitLab and LDAP auth packages on npm.