From 8d3b541d3d0aee2786b9d64bff918124d8b02aab Mon Sep 17 00:00:00 2001 From: Fabian Stamm Date: Sun, 13 May 2018 22:34:20 +0200 Subject: [PATCH] Adding function to Recursion Available flag from header dynamicly --- lib/request.d.ts | 1 + lib/request.js | 5 ++++- lib/request.js.map | 2 +- package.json | 2 +- src/request.ts | 8 +++++++- 5 files changed, 14 insertions(+), 4 deletions(-) diff --git a/lib/request.d.ts b/lib/request.d.ts index 47ec901..fea8e9c 100644 --- a/lib/request.d.ts +++ b/lib/request.d.ts @@ -103,6 +103,7 @@ export declare class Request implements Message { _packet: Buffer; constructor(packet: Buffer, sendCallback: (packet: Buffer) => any); error(error: ErrorCodes): void; + noRecursion(): void; send(): void; serialize(truncate?: boolean, rcode?: 0 | 1 | 2 | 3 | 4 | 5): Buffer; private serializeHeader(); diff --git a/lib/request.js b/lib/request.js index ebd07f3..5ed611b 100644 --- a/lib/request.js +++ b/lib/request.js @@ -176,6 +176,7 @@ class Request { this._header = headerParser.parse(headerData); this._header.AD = 0; this._header.RCODE = types_1.ErrorCodes.NoError; + this._header.RA = this._header.RD; this._questions = parseQuestions(this._header.QDCOUNT, bodyData); } get header() { @@ -188,6 +189,9 @@ class Request { if (this._header.RCODE === types_1.ErrorCodes.NoError) this._header.RCODE = error; } + noRecursion() { + this._header.RA = 0; + } send() { this.sendCallback(this.serialize()); } @@ -198,7 +202,6 @@ class Request { this._header.NSCOUNT = this.authorities.length; this._header.QR = 1; this._header.RCODE = rcode; - this._header.RA = 0; let questions = this.questions.map(this.serializeQuestion, this); let answers = this.answers.map(this.serializeResourceRecord, this); let authority = this.authorities.map(this.serializeResourceRecord, this); diff --git a/lib/request.js.map b/lib/request.js.map index c202133..c67ee0f 100644 --- a/lib/request.js.map +++ b/lib/request.js.map @@ -1 +1 @@ -{"version":3,"file":"request.js","sourceRoot":"","sources":["../src/request.ts"],"names":[],"mappings":";;AAAA,iDAAsC;AACtC,mCAAoG;AAEpG,MAAM,cAAc,GAAG,EAAE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,IAAI,KAAK,GAAG,CAAC,IAAI,KAAK,GAAG,KAAK;YAAE,MAAM,IAAI,SAAS,CAAC,wBAAwB,CAAC,CAAA;QAC7E,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACtB,CAAC;IAED,IAAI,IAAI;QACL,OAAO,IAAI,CAAC,KAAK,CAAC;IACrB,CAAC;IAGD,IAAI,KAAK,CAAC,KAAK;QACZ,IAAI,KAAK,GAAG,CAAC,IAAI,KAAK,GAAG,KAAK;YAAE,MAAM,IAAI,SAAS,CAAC,yBAAyB,CAAC,CAAA;QAC9E,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;IACvB,CAAC;IAED,IAAI,KAAK;QACN,OAAO,IAAI,CAAC,MAAM,CAAC;IACtB,CAAC;IAGD,IAAI,GAAG,CAAC,KAAK;QACV,IAAI,KAAK,GAAG,CAAC,IAAI,KAAK,GAAG,UAAU;YAAE,MAAM,IAAI,SAAS,CAAC,8BAA8B,CAAC,CAAA;IAC3F,CAAC;IAED,IAAI,GAAG;QACJ,OAAO,IAAI,CAAC,IAAI,CAAC;IACpB,CAAC;IAID,IAAI,QAAQ;QACT,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC;IAC5B,CAAC;CACH;AApCD,wCAoCC"} \ No newline at end of file +{"version":3,"file":"request.js","sourceRoot":"","sources":["../src/request.ts"],"names":[],"mappings":";;AAAA,iDAAsC;AACtC,mCAAoG;AAEpG,MAAM,cAAc,GAAG,EAAE,CAAC;AAE1B,IAAY,UA8GX;AA9GD,WAAY,UAAU;IACnB;;OAEG;IACH,qCAAQ,CAAA;IAER;;OAEG;IACH,uCAAS,CAAA;IAET;;OAEG;IACH,uCAAS,CAAA;IAET;;OAEG;IACH,uCAAS,CAAA;IAET;;OAEG;IACH,6CAAY,CAAA;IAEZ;;OAEG;IACH,yCAAU,CAAA;IAEV;;OAEG;IACH,uCAAS,CAAA;IAET;;OAEG;IACH,uCAAS,CAAA;IAET;;OAEG;IACH,uCAAS,CA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GD,IAAI,KAAK,CAAC,KAAK;QACZ,IAAI,KAAK,GAAG,CAAC,IAAI,KAAK,GAAG,KAAK;YAAE,MAAM,IAAI,SAAS,CAAC,yBAAyB,CAAC,CAAA;QAC9E,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;IACvB,CAAC;IAED,IAAI,KAAK;QACN,OAAO,IAAI,CAAC,MAAM,CAAC;IACtB,CAAC;IAGD,IAAI,GAAG,CAAC,KAAK;QACV,IAAI,KAAK,GAAG,CAAC,IAAI,KAAK,GAAG,UAAU;YAAE,MAAM,IAAI,SAAS,CAAC,8BAA8B,CAAC,CAAA;IAC3F,CAAC;IAED,IAAI,GAAG;QACJ,OAAO,IAAI,CAAC,IAAI,CAAC;IACpB,CAAC;IAID,IAAI,QAAQ;QACT,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC;IAC5B,CAAC;CACH;AApCD,wCAoCC"} \ No newline at end of file diff --git a/package.json b/package.json index 22ba47b..44abfdf 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "nodename-core", - "version": "0.1.7", + "version": "0.1.8", "main": "lib/listener.js", "types": "lib/listener.d.ts", "author": "Fabian Stamm ", diff --git a/src/request.ts b/src/request.ts index c60319a..b212d29 100644 --- a/src/request.ts +++ b/src/request.ts @@ -213,6 +213,8 @@ export class Request implements Message { this._header = headerParser.parse(headerData); this._header.AD = 0; this._header.RCODE = ErrorCodes.NoError; + this._header.RA = this._header.RD; + this._questions = parseQuestions(this._header.QDCOUNT, bodyData); } @@ -221,6 +223,10 @@ export class Request implements Message { this._header.RCODE = error; } + noRecursion() { + this._header.RA = 0; + } + send() { this.sendCallback(this.serialize()); } @@ -232,7 +238,7 @@ export class Request implements Message { this._header.NSCOUNT = this.authorities.length; this._header.QR = 1; this._header.RCODE = rcode; - this._header.RA = 0; + let questions = this.questions.map(this.serializeQuestion, this) let answers = this.answers.map(this.serializeResourceRecord, this) let authority = this.authorities.map(this.serializeResourceRecord, this)