Comparing version 0.0.5 to 0.0.6
@@ -1,2 +0,2 @@ | ||
var Mdns = require('../'); | ||
var Mdns = require('../'); //change to mdns-js if using library as a module | ||
@@ -10,5 +10,8 @@ var mdns = new Mdns(); | ||
mdns.on('update', function () { | ||
console.log('ips with _workstation._tcp service', mdns.ips('_workstation._tcp')); | ||
console.log('services on host 10.100.0.61', mdns.services('10.100.0.61')); | ||
var workstations = mdns.ips('_workstation._tcp'); | ||
console.log('ips with _workstation._tcp service', workstations); | ||
var services = mdns.services(workstations[0]); | ||
console.log('services on first workstation host %s: %s', workstations[0], services); | ||
mdns.shutdown(); | ||
}); |
@@ -44,2 +44,3 @@ var debug = require('debug')('mdns:lib:dnspacket'); | ||
packet.push('qd', part); | ||
debug('new qd dnsrecord: %j', part); | ||
} | ||
@@ -58,2 +59,6 @@ | ||
packet.push(section, part); | ||
debug('new %s dnsrecord: %j', section, part); | ||
if (section === 'an') { | ||
debug('asName', part.asName()); | ||
} | ||
} | ||
@@ -60,0 +65,0 @@ }); |
@@ -183,2 +183,3 @@ var debug = require('debug')('mdns:mdns'); | ||
/** | ||
@@ -188,5 +189,12 @@ * Returns the services found by this ServiceFinder, optionally filtered by IP. | ||
this.services = function(opt_ip) { | ||
var k = Object.keys(opt_ip ? _byIP[opt_ip] : _byService); | ||
k.sort(); | ||
return k; | ||
var x = typeof opt_ip !== 'undefined' ? _byIP[opt_ip] : _byService; | ||
if (typeof x === 'undefined') { | ||
return []; | ||
} | ||
else { | ||
var k = Object.keys(x); | ||
k.sort(); | ||
return k; | ||
} | ||
};//--services | ||
@@ -193,0 +201,0 @@ |
{ | ||
"name": "mdns-js", | ||
"version": "0.0.5", | ||
"version": "0.0.6", | ||
"repository": { | ||
@@ -5,0 +5,0 @@ "type": "git", |
@@ -20,5 +20,6 @@ mDNS-js | ||
pull requests, specifications for wanted functions etc. | ||
Also, as you should avoid to have multiple mDNS stacks on a system this | ||
might clash with stuff like avahi and bonjour. | ||
example | ||
@@ -25,0 +26,0 @@ ------- |
@@ -32,10 +32,6 @@ /*global describe: true, it: true, before: true, after: true */ | ||
hosts.length.should.be.above(0); | ||
var services = mdns.services(); | ||
services.should.be.instanceof(Array); | ||
services.length.should.be.above(0); | ||
var missing = mdns.ips('this should not exist'); | ||
missing.should.be.instanceof(Array); | ||
missing.length.should.equal(0); | ||
done(); | ||
@@ -46,2 +42,18 @@ }); | ||
it('should not crash on missing service when listing ips', function (done) { | ||
var missing = mdns.ips('this service should not exist'); | ||
missing.should.be.instanceof(Array); | ||
missing.length.should.equal(0); | ||
done(); | ||
}); | ||
it('should not crash on missing host when listing services', function (done) { | ||
var missing = mdns.services('this ip should not exist'); | ||
missing.should.be.instanceof(Array); | ||
missing.length.should.equal(0); | ||
done(); | ||
}); | ||
it('should close unused', function (done) { | ||
@@ -48,0 +60,0 @@ mdns.closeUnused(); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
32940
522
70