Comparing version 0.2.2 to 0.2.3
@@ -9,2 +9,3 @@ var mdns = require('../'); | ||
//var browser = mdns.createBrowser(mdns.tcp("workstation")); | ||
//var browser = mdns.createBrowser(mdns.tcp('http')); | ||
@@ -11,0 +12,0 @@ browser.on('ready', function onReady() { |
@@ -15,3 +15,5 @@ | ||
internal.sendDNSPacket = function (packet, cb) { | ||
var buf = packet.toBuffer(); | ||
debug('sending %d question, %d answer', packet.question.length, packet.answer.length); | ||
//debug('packet', packet); | ||
var buf = DNSPacket.toBuffer(packet); | ||
@@ -94,3 +96,3 @@ // send packet | ||
sock.on('message', function (message, remote) { | ||
debug('got packet from remote', remote); | ||
//debug('got packet from remote', remote); | ||
var packet; | ||
@@ -105,4 +107,4 @@ try { | ||
// check if it is a query where we are the authority for | ||
packet.each('qd', handleQuery.bind(this)); | ||
packet.each('an', handleAnswer.bind(this)); | ||
packet.question.forEach(handleQuery.bind(this)); | ||
packet.answer.forEach(handleAnswer.bind(this)); | ||
}.bind(this)); | ||
@@ -125,5 +127,5 @@ | ||
// var is_qu = (rec.cl & DNSRecord.Class.IS_QM) === DNSRecord.Class.IS_QM; | ||
rec.cl &= ~DNSRecord.Class.IS_OM; | ||
if (rec.cl !== DNSRecord.Class.IN && rec.type !== DNSRecord.Class.ANY) { | ||
debug('skipping query: class not IN/ANY: %d', rec.cl); | ||
rec.class &= ~DNSRecord.Class.IS_OM; | ||
if (rec.class !== DNSRecord.Class.IN && rec.type !== DNSRecord.Class.ANY) { | ||
debug('skipping query: class not IN/ANY: %d', rec.class); | ||
return; | ||
@@ -130,0 +132,0 @@ } |
@@ -104,3 +104,6 @@ | ||
created++; | ||
sock.bind(port, address, function (err) { | ||
sock.bind(port, function (err) { | ||
if (port === 5353) { | ||
sock.addMembership(address); | ||
} | ||
cb(err, interfaceIndex, networkInterface, sock); | ||
@@ -107,0 +110,0 @@ }); |
@@ -34,2 +34,6 @@ var debug = require('debug')('mdns:lib:decoder'); | ||
obj.type = obj.type || []; | ||
//TODO: posibly check rec.data if it can be splitted by '.' | ||
// to detect if service name or not. | ||
// See pr #20 | ||
if (packet.header.qr === 1 && rec.name.indexOf('_service') === 0) { | ||
@@ -36,0 +40,0 @@ if (rec.data) { |
{ | ||
"name": "mdns-js", | ||
"version": "0.2.2", | ||
"version": "0.2.3", | ||
"repository": { | ||
@@ -5,0 +5,0 @@ "type": "git", |
@@ -5,6 +5,8 @@ mDNS-js | ||
Pure JavaScript/NodeJS mDNS discovery implementation. | ||
It's definitely not a full implementation at the current | ||
state and it will NOT work in the browser. | ||
A lot of the functionality is copied from | ||
The starting inspiration came from | ||
https://github.com/GoogleChrome/chrome-app-samples/tree/master/mdns-browser | ||
but adapted for node. | ||
but adapted for node. It's not much left of that now though. | ||
@@ -11,0 +13,0 @@ Install by |
76277
1696
110