multicast-dns
Advanced tools
Comparing version 4.0.0 to 4.0.1
{ | ||
"name": "multicast-dns", | ||
"version": "4.0.0", | ||
"version": "4.0.1", | ||
"description": "Low level multicast-dns implementation in pure javascript", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -72,4 +72,4 @@ var types = require('./types') | ||
var QUERY_FLAG = 0x0000 | ||
var RESPONSE_FLAG = 0x8400 | ||
var QUERY_FLAG = 0 | ||
var RESPONSE_FLAG = 1 << 15 | ||
@@ -80,7 +80,6 @@ var header = {} | ||
var flags = buf.readUInt16BE(offset + 2) | ||
if (flags !== RESPONSE_FLAG && flags !== QUERY_FLAG) throw new Error('bad type: ' + flags) | ||
header.decode.bytes = 12 | ||
return { | ||
type: flags === RESPONSE_FLAG ? 'response' : 'query', | ||
type: flags & RESPONSE_FLAG ? 'response' : 'query', | ||
qdcount: buf.readUInt16BE(offset + 4), | ||
@@ -87,0 +86,0 @@ ancount: buf.readUInt16BE(offset + 6), |
@@ -192,4 +192,4 @@ # multicast-dns | ||
``` js | ||
mdns.response([{name:'brunhilde.local', type:'A', data:'192.158.1.5'}]) | ||
mdns.response({ | ||
mdns.respond([{name:'brunhilde.local', type:'A', data:'192.158.1.5'}]) | ||
mdns.respond({ | ||
answers: [{name:'brunhilde.local', type:'A', data:'192.158.1.5'}] | ||
@@ -196,0 +196,0 @@ }) |
12
test.js
@@ -55,3 +55,3 @@ var mdns = require('./') | ||
t.same(packet.questions[0], {name: 'hello-world', type: 'A', class: 1}) | ||
dns.response([{type: 'A', name: 'hello-world', ttl: 120, data: '127.0.0.1'}]) | ||
dns.respond([{type: 'A', name: 'hello-world', ttl: 120, data: '127.0.0.1'}]) | ||
}) | ||
@@ -75,3 +75,3 @@ | ||
t.same(packet.questions[1], {name: 'hej.verden', type: 'A', class: 1}) | ||
dns.response([{type: 'A', name: 'hello-world', ttl: 120, data: '127.0.0.1'}, {type: 'A', name: 'hej.verden', ttl: 120, data: '127.0.0.2'}]) | ||
dns.respond([{type: 'A', name: 'hello-world', ttl: 120, data: '127.0.0.1'}, {type: 'A', name: 'hej.verden', ttl: 120, data: '127.0.0.2'}]) | ||
}) | ||
@@ -95,3 +95,3 @@ | ||
t.same(packet.questions[0], {name: 'hello-world', type: 'AAAA', class: 1}) | ||
dns.response([{type: 'AAAA', name: 'hello-world', ttl: 120, data: 'fe80::5ef9:38ff:fe8c:ceaa'}]) | ||
dns.respond([{type: 'AAAA', name: 'hello-world', ttl: 120, data: 'fe80::5ef9:38ff:fe8c:ceaa'}]) | ||
}) | ||
@@ -114,3 +114,3 @@ | ||
t.same(packet.questions[0], {name: 'hello-world', type: 'SRV', class: 1}) | ||
dns.response([{type: 'SRV', name: 'hello-world', ttl: 120, data: {port: 11111, target: 'hello.world.com', priority: 10, weight: 12}}]) | ||
dns.respond([{type: 'SRV', name: 'hello-world', ttl: 120, data: {port: 11111, target: 'hello.world.com', priority: 10, weight: 12}}]) | ||
}) | ||
@@ -135,3 +135,3 @@ | ||
t.same(packet.questions[0], {name: 'hello-world', type: 'TXT', class: 1}) | ||
dns.response([{type: 'TXT', name: 'hello-world', ttl: 120, data: data}]) | ||
dns.respond([{type: 'TXT', name: 'hello-world', ttl: 120, data: data}]) | ||
}) | ||
@@ -152,3 +152,3 @@ | ||
dns.once('query', function (packet) { | ||
dns.response([{type: 'TXT', name: 'hello-world', ttl: 120}]) | ||
dns.respond([{type: 'TXT', name: 'hello-world', ttl: 120}]) | ||
}) | ||
@@ -155,0 +155,0 @@ |
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
28058
709