Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

libp2p-mdns

Package Overview
Dependencies
Maintainers
1
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

libp2p-mdns - npm Package Compare versions

Comparing version 0.4.0 to 0.5.0

3

package.json
{
"name": "libp2p-mdns",
"version": "0.4.0",
"version": "0.5.0",
"description": "Node.js libp2p mDNS discovery implementation for peer discovery",

@@ -36,3 +36,2 @@ "main": "src/index.js",

"chai": "^3.5.0",
"libp2p-ipfs-nodejs": "^0.16.4",
"pre-commit": "^1.2.0"

@@ -39,0 +38,0 @@ },

@@ -15,3 +15,3 @@ 'use strict'

class MulticastDNS extends EventEmitter {
constructor (node, options) {
constructor (peerInfo, options) {
super()

@@ -21,13 +21,8 @@ options = options || {}

const broadcast = options.broadcast !== false
const interval = options.interval || (1e3 * 5) // default: 5 seconds
const interval = options.interval || (1e3 * 10) // default: 10 seconds
const serviceTag = options.serviceTag || '_ipfs-discovery._udp'
const verify = options.verify === true
const port = options.port || 5353
const peerInfo = node.peerInfo
const self = this // for event emitter
const mdns = multicastDNS({
port: port,
loopback: false
})
const mdns = multicastDNS({ port: port })

@@ -94,3 +89,3 @@ // query the network

Peer.create(peerId, function (err, peerFound) {
Peer.create(peerId, (err, peerFound) => {
if (err) {

@@ -100,23 +95,10 @@ return log('Error creating PeerInfo from new found peer', err)

multiaddrs.forEach(function (addr) {
multiaddrs.forEach((addr) => {
peerFound.multiaddr.add(addr)
})
attemptDial(peerFound)
self.emit('peer', peerFound)
})
}
function attemptDial (peer) {
if (verify) {
node.dialByPeerInfo(peer, (err) => {
if (err) {
return log('Was not able to connect to new found peer', err)
}
self.emit('peer', peer)
})
} else {
self.emit('peer', peer)
}
}
// answer to queries

@@ -123,0 +105,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc