Comparing version 0.2.9 to 0.3.0
var mdns = require('../'); | ||
console.log('should advertise a http service on port 9876'); | ||
var service = mdns.createAdvertisement(mdns.tcp('_http'), 9876, | ||
@@ -4,0 +5,0 @@ { |
@@ -5,2 +5,5 @@ var mdns = require('../'); | ||
//if you have avahi or bonjour or other mdns service running on the same system | ||
//you REALLY would like to exlude 0.0.0.0 from the interfaces bound to | ||
//mdns.excludeInterface('0.0.0.0') | ||
@@ -7,0 +10,0 @@ var browser = mdns.createBrowser(); //defaults to mdns.ServiceType.wildcard |
@@ -30,3 +30,2 @@ | ||
/* @borrows Advertisement as Advertisement */ | ||
@@ -33,0 +32,0 @@ module.exports.Advertisement = require('./lib/advertisement'); //just for convenience |
@@ -9,2 +9,3 @@ var debug = require('debug')('mdns:lib:networking'); | ||
var dgram = require('dgram'); | ||
var semver = require('semver'); | ||
@@ -18,3 +19,4 @@ var dns = require('mdns-js-packet'); | ||
var Networking = module.exports = function () { | ||
var Networking = module.exports = function (options) { | ||
options = options || {}; | ||
this.created = 0; | ||
@@ -72,7 +74,14 @@ this.connections = []; | ||
interfaceIndex, networkInterface, address, port, next) { | ||
var sock = dgram.createSocket('udp4'); | ||
var sock; | ||
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); | ||
this.created++; | ||
sock.bind(port, address, function (err) { | ||
if (port === 5353 && address === '0.0.0.0') { | ||
sock.bind(port, address, function () { | ||
if (port === 5353) { | ||
sock.addMembership(MDNS_MULTICAST); | ||
@@ -82,4 +91,5 @@ sock.setMulticastTTL(255); | ||
} | ||
next(err, interfaceIndex, networkInterface, sock); | ||
next(null, interfaceIndex, networkInterface, sock); | ||
}); | ||
}; | ||
@@ -86,0 +96,0 @@ |
{ | ||
"name": "mdns-js", | ||
"version": "0.2.9", | ||
"version": "0.3.0", | ||
"repository": { | ||
@@ -14,13 +14,17 @@ "type": "git", | ||
], | ||
"engines": { | ||
"node": "^0.10.3 || ^0.12.0" | ||
}, | ||
"main": "index.js", | ||
"dependencies": { | ||
"debug": "^2.1.0", | ||
"mdns-js-packet": "0.1.x" | ||
"debug": "^2.1.1", | ||
"mdns-js-packet": "0.1.x", | ||
"semver": "^4.3.1" | ||
}, | ||
"devDependencies": { | ||
"code": "^1.2.1", | ||
"joi": "^5.0.1", | ||
"jscs": "^1.6.2", | ||
"jshint": "^2.5.0", | ||
"lab": "^5.1.0" | ||
"code": "^1.3.0", | ||
"joi": "^5.1.0", | ||
"jscs": "^1.11.1", | ||
"jshint": "^2.6.0", | ||
"lab": "^5.2.1" | ||
}, | ||
@@ -27,0 +31,0 @@ "scripts": { |
@@ -32,2 +32,4 @@ mDNS-js | ||
var mdns = require('mdns-js'); | ||
//if you have another mdns daemon running, like avahi or bonjour, uncomment following line | ||
//mdns.excludeInterface('0.0.0.0'); | ||
@@ -34,0 +36,0 @@ var browser = mdns.createBrowser(); |
@@ -17,2 +17,3 @@ var Lab = require('lab'); | ||
before(function (done) { | ||
// mdns.excludeInterface('0.0.0.0'); | ||
expect(mdns, 'library does not exist!?').to.exist(mdns); | ||
@@ -19,0 +20,0 @@ browser = mdns.createBrowser(); |
Sorry, the diff of this file is not supported yet
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
80398
65
1850
113
3
+ Addedsemver@^4.3.1
+ Addedsemver@4.3.6(transitive)
Updateddebug@^2.1.1