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

bonjour-hap

Package Overview
Dependencies
Maintainers
1
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bonjour-hap - npm Package Compare versions

Comparing version 3.5.4 to 3.5.5

.github/PULL_REQUEST_TEMPLATE/enhancement_pull_request_template.md

10

lib/Browser.js

@@ -6,4 +6,4 @@ 'use strict'

var serviceName = require('multicast-dns-service-types')
var dnsEqual = require('dns-equal')
var dnsTxt = require('dns-txt')
var dnsEqual = require('./utils/dnsEqual')
var dnsTxt = require('./utils/txtDecoder')

@@ -180,6 +180,4 @@ var TLD = '.local'

// rr.data is an Array of Buffer instead of Buffer
service.rawTxt = rr.data
service.txt = rr.data.reduce((acc, elt) => {
return Object.assign(acc, txt.decode(elt))
}, {})
service.rawTxt = rr.data // array of buffers, each representing a block
service.txt = txt.decodeBlocks(service.rawTxt)
}

@@ -186,0 +184,0 @@ })

18

lib/Prober.js
'use strict'
var dnsEqual = require('dns-equal')
var dnsEqual = require('./utils/dnsEqual')

@@ -37,8 +37,8 @@ /**

try: function () {
// abort if the service have or is being stopped in the meantime
// abort if the service have or is being stopped in the meantime
if (!this.service._activated || this.service._destroyed) return
this.mdns.query(this.service.fqdn, 'ANY', function () {
// This function will optionally be called with an error object. We'll
// just silently ignore it and retry as we normally would
// This function will optionally be called with an error object. We'll
// just silently ignore it and retry as we normally would
this.sent = true

@@ -55,7 +55,7 @@ this.timer = setTimeout(++this.retries < 3 ? this.try.bind(this) : this.done.bind(this, false), 250)

onMDNSresponse: function (packet) {
// Apparently conflicting Multicast DNS responses received *before*
// the first probe packet is sent MUST be silently ignored (see
// discussion of stale probe packets in RFC 6762 Section 8.2,
// "Simultaneous Probe Tiebreaking" at
// https://tools.ietf.org/html/rfc6762#section-8.2
// Apparently conflicting Multicast DNS responses received *before*
// the first probe packet is sent MUST be silently ignored (see
// discussion of stale probe packets in RFC 6762 Section 8.2,
// "Simultaneous Probe Tiebreaking" at
// https://tools.ietf.org/html/rfc6762#section-8.2
if (!this.sent) { return }

@@ -62,0 +62,0 @@

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

/**
/**
* Stop the given services

@@ -75,3 +75,3 @@ *

/**
/**
* Initial service announcement

@@ -106,3 +106,3 @@ *

// Handle error
// Handle error
service.stop()

@@ -109,0 +109,0 @@ service.emit('error', new Error('Service name is already in use on the network'))

'use strict'
var multicastdns = require('multicast-dns')
var dnsEqual = require('dns-equal')
var dnsEqual = require('./utils/dnsEqual')
var flatten = require('array-flatten')

@@ -23,10 +23,10 @@ var helpers = require('./helpers.js')

// generate the answers section
// generate the answers section
var answers = type === 'ANY'
? flatten.depth(Object.keys(this.registry).map(this._recordsFor.bind(this, name)), 1)
: this._recordsFor(name, type)
? flatten.depth(Object.keys(this.registry).map(this._recordsFor.bind(this, name)), 1)
: this._recordsFor(name, type)
if (answers.length === 0) return
// generate the additionals section
// generate the additionals section
var additionals = []

@@ -37,21 +37,21 @@ if (type !== 'ANY') {

additionals = additionals
.concat(this._recordsFor(answer.data, 'SRV'))
.concat(this._recordsFor(answer.data, 'TXT'))
.concat(this._recordsFor(answer.data, 'SRV'))
.concat(this._recordsFor(answer.data, 'TXT'))
})
// to populate the A and AAAA records, we need to get a set of unique
// targets from the SRV record
// to populate the A and AAAA records, we need to get a set of unique
// targets from the SRV record
additionals
.filter(function (record) {
return record.type === 'SRV'
})
.map(function (record) {
return record.data.target
})
.filter(helpers.unique())
.forEach(function (target) {
additionals = additionals
.concat(this._recordsFor(target, 'A'))
.concat(this._recordsFor(target, 'AAAA'))
})
.filter(function (record) {
return record.type === 'SRV'
})
.map(function (record) {
return record.data.target
})
.filter(helpers.unique())
.forEach(function (target) {
additionals = additionals
.concat(this._recordsFor(target, 'A'))
.concat(this._recordsFor(target, 'AAAA'))
})
}

@@ -58,0 +58,0 @@

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

if (!this.published) { return }
this._unpublish()

@@ -116,5 +116,5 @@ this.announce()

records.push(
address.family === 'IPv4'
? this._rrA(address.address)
: this._rrAaaa(address.address))
address.family === 'IPv4'
? this._rrA(address.address)
: this._rrAaaa(address.address))
}

@@ -154,4 +154,4 @@ }

var val = txtRecords[key]
data.push(key + "=" + val);
});
data.push(key + '=' + val)
})
}

@@ -158,0 +158,0 @@ return {

{
"name": "bonjour-hap",
"version": "3.5.4",
"version": "3.5.5",
"description": "A Bonjour/Zeroconf implementation in pure JavaScript (for HAP)",
"main": "index.js",
"dependencies": {
"array-flatten": "^2.1.0",
"deep-equal": "^1.0.1",
"dns-equal": "^1.0.0",
"dns-txt": "^2.0.2",
"multicast-dns": "^7.2.0",
"multicast-dns-service-types": "^1.1.0"
},
"devDependencies": {
"after-all": "^2.0.2",
"safe-buffer": "^5.1.1",
"standard": "^11.0.0",
"tape": "^4.5.1"
},
"author": "Thomas Watson Steen <w@tson.dk> (https://twitter.com/wa7son)",
"license": "MIT",
"scripts": {
"test": "standard && tape test/*.js"
},
"homepage": "https://github.com/homebridge/bonjour",
"repository": {
"type": "git",
"url": "https://github.com/KhaosT/bonjour.git"
"url": "https://github.com/homebridge/bonjour.git"
},
"bugs": {
"url": "https://github.com/homebridge/bonjour/issues"
},
"keywords": [

@@ -40,12 +32,13 @@ "bonjour",

],
"author": "Thomas Watson Steen <w@tson.dk> (https://twitter.com/wa7son)",
"license": "MIT",
"bugs": {
"url": "https://github.com/watson/bonjour/issues"
"dependencies": {
"array-flatten": "^2.1.2",
"deep-equal": "^2.0.2",
"multicast-dns": "^7.2.2",
"multicast-dns-service-types": "^1.1.0"
},
"homepage": "https://github.com/KhaosT/bonjour",
"coordinates": [
55.68250900965318,
12.586377442991648
]
"devDependencies": {
"after-all": "^2.0.2",
"standard": "^14.3.3",
"tape": "^4.5.1"
}
}

@@ -9,3 +9,2 @@ 'use strict'

var Bonjour = require('../')
var Buffer = require('safe-buffer').Buffer

@@ -87,3 +86,3 @@ var getAddresses = function () {

t.deepEqual(s.txt, {})
t.deepEqual(s.rawTxt, Buffer.from('00', 'hex'))
t.deepEqual(s.rawTxt, [])
} else {

@@ -93,3 +92,3 @@ t.equal(s.name, 'Baz')

t.deepEqual(s.txt, { foo: 'bar' })
t.deepEqual(s.rawTxt, Buffer.from('07666f6f3d626172', 'hex'))
t.deepEqual(s.rawTxt, [Buffer.from('foo=bar')])
}

@@ -124,3 +123,3 @@ t.equal(s.host, os.hostname())

test('bonjour.change', function (bonjour, t) {
var data = {init: true, found: false, timer: null}
var data = { init: true, found: false, timer: null }
var service = bonjour.publish({ name: 'Baz', type: 'test', port: 3000, txt: { foo: 'bar' } }).on('up', function () {

@@ -139,3 +138,3 @@ var browser = bonjour.find({ type: 'test' })

data.init = false
service.updateTxt({foo: 'baz'})
service.updateTxt({ foo: 'baz' })
}

@@ -161,3 +160,3 @@

t.deepEqual(s.txt, { bar: Buffer.from('buz') })
t.deepEqual(s.rawTxt, Buffer.from('076261723d62757a', 'hex'))
t.deepEqual(s.rawTxt, [Buffer.from('bar=buz')])
bonjour.destroy()

@@ -164,0 +163,0 @@ t.end()

@@ -6,3 +6,2 @@ 'use strict'

var Service = require('../lib/Service.js')
var Buffer = require('safe-buffer').Buffer

@@ -81,3 +80,3 @@ var getAddressesRecords = function (host) {

{ data: { port: 3000, target: os.hostname() }, name: s.fqdn, ttl: 120, type: 'SRV' },
{ data: Buffer.from('00', 'hex'), name: s.fqdn, ttl: 4500, type: 'TXT' }
{ data: [], name: s.fqdn, ttl: 120, type: 'TXT' }
].concat(getAddressesRecords(s.host)))

@@ -92,5 +91,5 @@ t.end()

{ data: { port: 3000, target: 'example.com' }, name: s.fqdn, ttl: 120, type: 'SRV' },
{ data: Buffer.from('07666f6f3d626172', 'hex'), name: s.fqdn, ttl: 4500, type: 'TXT' }
{ data: ['foo=bar'], name: s.fqdn, ttl: 120, type: 'TXT' }
].concat(getAddressesRecords(s.host)))
t.end()
})

Sorry, the diff of this file is not supported yet

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