Socket
Socket
Sign inDemoInstall

mdns-discovery

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mdns-discovery - npm Package Compare versions

Comparing version 0.0.4 to 0.0.5

71

mdns-discovery.js

@@ -15,6 +15,6 @@ "use strict";

name: '_amzn-wplay._tcp.local',
type: dnsjs.DNSRecord.Type.PTR,
type: 'PTR',
class: 0x8001
},
timeout: 30,
timeout: 4,
multicastTTL: 64,

@@ -30,5 +30,5 @@ ttl: 64

for (var prop in def) {
if (def.hasOwnProperty(prop) && opts[prop] === undefined) {
if (def.hasOwnProperty(prop)) {
if (def[prop] instanceof Array) {
opts[prop] = [].concat(def[prop]);
if (!opts[prop]) opts[prop] = [].concat(def[prop]);
} else if (typeof def[prop] === 'object') {

@@ -40,3 +40,3 @@ if (typeof opts[prop] !== 'object') {

} else {
opts[prop] = def[prop];
if (opts[prop] === undefined) opts[prop] = def[prop];
}

@@ -48,2 +48,3 @@ }

function MulticastDNS(opts) {

@@ -53,4 +54,3 @@ if (this instanceof MulticastDNS === false) {

}
opts = opts || {};
checkOptions(opts);
this.setOptions(opts);

@@ -76,2 +76,9 @@ // opts.name = opts.name || 'm_d_n_s';

MulticastDNS.prototype.setOptions = function (opts) {
opts = opts || {};
opts.q = opts.q || {};
opts.q.name = opts.q.name || opts.name;
checkOptions(opts);
}
MulticastDNS.prototype.getInterfaces = function () {

@@ -92,3 +99,3 @@ if (this.options.interfaces && this.options.interfaces.length) return;

MulticastDNS.prototype.getPayload = function () {
MulticastDNS.prototype.getPayloadx = function () {
var payload = new Buffer(

@@ -122,11 +129,12 @@ [].concat([0x00, 0x00, // ID

MulticastDNS.prototype.getPayload1 = function () {
MulticastDNS.prototype.getPayload = function () {
var message = packet.encode({
questions:[{
name: this.options.q.name,
type: 'PTR',
class: 0x8001,
//ttl: 3600
}]
questions: [this.options.q]
// questions:[{
// name: this.options.q.name,
// type: this.options.q.type, //'PTR',
// class: this.options.q.class, //0x8001,
// //ttl: 3600
// }]
});

@@ -172,6 +180,2 @@ return message;

MulticastDNS.prototype.close = function () {
this.clients.forEach(function(client, i) {
if (client) client.close();
this.clients[i] = undefined;
});
if (this.timer) {

@@ -181,2 +185,6 @@ clearTimeout(this.timer);

}
this.clients.forEach(function(client, i) {
if (client) client.close();
this.clients[i] = undefined;
}.bind(this));
};

@@ -192,6 +200,6 @@

readyCallback && readyCallback(this.found);
});
}.bind(this), this.options.timeout * 1000);
};
MulticastDNS.prototype.onPacket = function (packets) {
MulticastDNS.prototype.onPacket = function (packets, rinfo) {
//this.options.find = 'amzn.dmgr:';

@@ -216,5 +224,2 @@ if (!this.options.find || !packets.answers) return;

if (rinfo.address !== '192.168.1.91' && rinfo.address !== '192.168.1.94') {
return;
}
var packets;

@@ -226,13 +231,11 @@ try {

}
this.onPacket(packets);
this.onPacket(packets, rinfo);
var s = message.toString();
//console.log(rinfo.address);
//if (rinfo.address == '192.168.1.91' || rinfo.address == '192.168.1.94') {
// var m = packet.decode(message);
// if (packets.answers) packets.answers.forEach(function(packet, i) {
// //console.log('packet[%d]=%s type=%s class=%d, ttl=%d', i, packet.name, packet.type, packet.class, packet.ttl);
// console.log(`packet[${i}]=${packet.name}, type=${packet.type}, class=${packet.class}, ttl=${packet.ttl}}`);
// });
//}
//var s = message.toString();
console.log(rinfo.address);
var m = packet.decode(message);
if (packets.answers) packets.answers.forEach(function(packet, i) {
//console.log('packet[%d]=%s type=%s class=%d, ttl=%d', i, packet.name, packet.type, packet.class, packet.ttl);
console.log(`packet[${i}]=${packet.name}, type=${packet.type}, class=${packet.class}, ttl=${packet.ttl}}`);
});
};

@@ -239,0 +242,0 @@

{
"name": "mdns-discovery",
"version": "0.0.4",
"version": "0.0.5",
"description": "Multicast DNS",

@@ -5,0 +5,0 @@ "author": {

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