Adding function to Recursion Available flag from header dynamicly
This commit is contained in:
parent
e5c55b402b
commit
8d3b541d3d
1
lib/request.d.ts
vendored
1
lib/request.d.ts
vendored
@ -103,6 +103,7 @@ export declare class Request implements Message {
|
|||||||
_packet: Buffer;
|
_packet: Buffer;
|
||||||
constructor(packet: Buffer, sendCallback: (packet: Buffer) => any);
|
constructor(packet: Buffer, sendCallback: (packet: Buffer) => any);
|
||||||
error(error: ErrorCodes): void;
|
error(error: ErrorCodes): void;
|
||||||
|
noRecursion(): void;
|
||||||
send(): void;
|
send(): void;
|
||||||
serialize(truncate?: boolean, rcode?: 0 | 1 | 2 | 3 | 4 | 5): Buffer;
|
serialize(truncate?: boolean, rcode?: 0 | 1 | 2 | 3 | 4 | 5): Buffer;
|
||||||
private serializeHeader();
|
private serializeHeader();
|
||||||
|
@ -176,6 +176,7 @@ class Request {
|
|||||||
this._header = headerParser.parse(headerData);
|
this._header = headerParser.parse(headerData);
|
||||||
this._header.AD = 0;
|
this._header.AD = 0;
|
||||||
this._header.RCODE = types_1.ErrorCodes.NoError;
|
this._header.RCODE = types_1.ErrorCodes.NoError;
|
||||||
|
this._header.RA = this._header.RD;
|
||||||
this._questions = parseQuestions(this._header.QDCOUNT, bodyData);
|
this._questions = parseQuestions(this._header.QDCOUNT, bodyData);
|
||||||
}
|
}
|
||||||
get header() {
|
get header() {
|
||||||
@ -188,6 +189,9 @@ class Request {
|
|||||||
if (this._header.RCODE === types_1.ErrorCodes.NoError)
|
if (this._header.RCODE === types_1.ErrorCodes.NoError)
|
||||||
this._header.RCODE = error;
|
this._header.RCODE = error;
|
||||||
}
|
}
|
||||||
|
noRecursion() {
|
||||||
|
this._header.RA = 0;
|
||||||
|
}
|
||||||
send() {
|
send() {
|
||||||
this.sendCallback(this.serialize());
|
this.sendCallback(this.serialize());
|
||||||
}
|
}
|
||||||
@ -198,7 +202,6 @@ class Request {
|
|||||||
this._header.NSCOUNT = this.authorities.length;
|
this._header.NSCOUNT = this.authorities.length;
|
||||||
this._header.QR = 1;
|
this._header.QR = 1;
|
||||||
this._header.RCODE = rcode;
|
this._header.RCODE = rcode;
|
||||||
this._header.RA = 0;
|
|
||||||
let questions = this.questions.map(this.serializeQuestion, this);
|
let questions = this.questions.map(this.serializeQuestion, this);
|
||||||
let answers = this.answers.map(this.serializeResourceRecord, this);
|
let answers = this.answers.map(this.serializeResourceRecord, this);
|
||||||
let authority = this.authorities.map(this.serializeResourceRecord, this);
|
let authority = this.authorities.map(this.serializeResourceRecord, this);
|
||||||
|
File diff suppressed because one or more lines are too long
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "nodename-core",
|
"name": "nodename-core",
|
||||||
"version": "0.1.7",
|
"version": "0.1.8",
|
||||||
"main": "lib/listener.js",
|
"main": "lib/listener.js",
|
||||||
"types": "lib/listener.d.ts",
|
"types": "lib/listener.d.ts",
|
||||||
"author": "Fabian Stamm <dev@fabianstamm.de>",
|
"author": "Fabian Stamm <dev@fabianstamm.de>",
|
||||||
|
@ -213,6 +213,8 @@ export class Request implements Message {
|
|||||||
this._header = <any>headerParser.parse(headerData);
|
this._header = <any>headerParser.parse(headerData);
|
||||||
this._header.AD = 0;
|
this._header.AD = 0;
|
||||||
this._header.RCODE = ErrorCodes.NoError;
|
this._header.RCODE = ErrorCodes.NoError;
|
||||||
|
this._header.RA = this._header.RD;
|
||||||
|
|
||||||
this._questions = parseQuestions(this._header.QDCOUNT, bodyData);
|
this._questions = parseQuestions(this._header.QDCOUNT, bodyData);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -221,6 +223,10 @@ export class Request implements Message {
|
|||||||
this._header.RCODE = error;
|
this._header.RCODE = error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
noRecursion() {
|
||||||
|
this._header.RA = 0;
|
||||||
|
}
|
||||||
|
|
||||||
send() {
|
send() {
|
||||||
this.sendCallback(this.serialize());
|
this.sendCallback(this.serialize());
|
||||||
}
|
}
|
||||||
@ -232,7 +238,7 @@ export class Request implements Message {
|
|||||||
this._header.NSCOUNT = this.authorities.length;
|
this._header.NSCOUNT = this.authorities.length;
|
||||||
this._header.QR = 1;
|
this._header.QR = 1;
|
||||||
this._header.RCODE = rcode;
|
this._header.RCODE = rcode;
|
||||||
this._header.RA = 0;
|
|
||||||
let questions = this.questions.map(this.serializeQuestion, this)
|
let questions = this.questions.map(this.serializeQuestion, this)
|
||||||
let answers = this.answers.map(this.serializeResourceRecord, this)
|
let answers = this.answers.map(this.serializeResourceRecord, this)
|
||||||
let authority = this.authorities.map(this.serializeResourceRecord, this)
|
let authority = this.authorities.map(this.serializeResourceRecord, this)
|
||||||
|
Loading…
Reference in New Issue
Block a user