Fixed bug when replying to TXT packets.
This commit is contained in:
parent
6d5d55ed83
commit
0567ab8a30
10
main.js
10
main.js
@ -90,7 +90,13 @@ function sniffmDNSLocalPackets() {
|
||||
db.local.A[answer.name] = answer.data;
|
||||
}
|
||||
|
||||
if (["TXT","SRV"].includes(answer.type)) {
|
||||
if (answer.type == "SRV") {
|
||||
// Initialize this device / entry, if needed
|
||||
if (db.local[answer.name] === undefined) db.local[answer.name] = {"TXT":null,"SRV":null};
|
||||
|
||||
db.local[answer.name][answer.type] = answer.data;
|
||||
}
|
||||
if (answer.type == "TXT") {
|
||||
// Initialize this device / entry, if needed
|
||||
if (db.local[answer.name] === undefined) db.local[answer.name] = {"TXT":null,"SRV":null};
|
||||
|
||||
@ -197,7 +203,7 @@ function replyLocallyWithRemoteDevicesData(name,type,query) {
|
||||
if (db.remote.services[name]) {
|
||||
const r = db.remote.services[name];
|
||||
if (r.SRV) answers.push({ name, type: 'SRV', class: 'IN', ttl: 120, data: r.SRV });
|
||||
if (r.TXT) answers.push({ name, type: 'TXT', class: 'IN', ttl: 120, data: Buffer.from(r.TXT, 'utf8') });
|
||||
if (r.TXT) answers.push({ name, type: 'TXT', class: 'IN', ttl: 120, data: r.TXT.map(entry=>Buffer.from(entry.data)) });
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user