Comparing version 0.3.0 to 0.3.1
14
index.js
@@ -30,2 +30,16 @@ | ||
module.exports.excludeInterface = function (iface) { | ||
if (networking.started) { | ||
throw new Error('can not exclude interfaces after start'); | ||
} | ||
if (iface === '0.0.0.0') { | ||
networking.INADDR_ANY = false; | ||
} | ||
else { | ||
var err = new Error('Not a supported interface'); | ||
err.interface = iface; | ||
} | ||
}; | ||
/* @borrows Advertisement as Advertisement */ | ||
@@ -32,0 +46,0 @@ module.exports.Advertisement = require('./lib/advertisement'); //just for convenience |
@@ -24,2 +24,4 @@ var debug = require('debug')('mdns:lib:networking'); | ||
this.users = []; | ||
this.INADDR_ANY = typeof options.INADDR_ANY === 'undefined' ? | ||
false : options.INADDR_ANY; | ||
}; | ||
@@ -52,4 +54,6 @@ | ||
this.createSocket(index++, 'pseudo multicast', | ||
'0.0.0.0', 5353, this.bindToAddress.bind(this)); | ||
if (this.INADDR_ANY) { | ||
this.createSocket(index++, 'pseudo multicast', | ||
'0.0.0.0', 5353, this.bindToAddress.bind(this)); | ||
} | ||
}; | ||
@@ -74,9 +78,9 @@ | ||
interfaceIndex, networkInterface, address, port, next) { | ||
var sock; | ||
var sock; | ||
if (semver.gte(process.versions.node, '0.11.13')) { | ||
sock = dgram.createSocket({type:'udp4', reuseAddr:true}); | ||
} else { | ||
sock = dgram.createSocket('udp4'); | ||
} | ||
if (semver.gte(process.versions.node, '0.11.13')) { | ||
sock = dgram.createSocket({type:'udp4', reuseAddr:true}); | ||
} else { | ||
sock = dgram.createSocket('udp4'); | ||
} | ||
debug('creating socket for', networkInterface); | ||
@@ -83,0 +87,0 @@ this.created++; |
{ | ||
"name": "mdns-js", | ||
"version": "0.3.0", | ||
"version": "0.3.1", | ||
"repository": { | ||
@@ -5,0 +5,0 @@ "type": "git", |
@@ -17,3 +17,3 @@ var Lab = require('lab'); | ||
before(function (done) { | ||
// mdns.excludeInterface('0.0.0.0'); | ||
mdns.excludeInterface('0.0.0.0'); | ||
expect(mdns, 'library does not exist!?').to.exist(mdns); | ||
@@ -20,0 +20,0 @@ browser = mdns.createBrowser(); |
@@ -155,3 +155,3 @@ var Lab = require('lab'); | ||
it('should work out _sub of apple-mobdev', {only: true}, function (done) { | ||
it('should work out _sub of apple-mobdev', function (done) { | ||
var s = new ServiceType('46c20544._sub._apple-mobdev2._tcp.local'); | ||
@@ -158,0 +158,0 @@ expect(s.name, 'name').to.equal('apple-mobdev2'); |
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
80827
1866