From 9d3d9f8a80ddd4fbaebf02b1c7a0848c68d73d69 Mon Sep 17 00:00:00 2001 From: Fabian Stamm Date: Thu, 17 May 2018 18:46:50 +0200 Subject: [PATCH] Adding parameter for easy initialization to RecourceRecord constructor. --- lib/request.d.ts | 1 + lib/request.js | 14 +++++++++++--- lib/request.js.map | 2 +- lib/test.js | 12 ++++++++++++ lib/test.js.map | 2 +- src/request.ts | 16 +++++++++++++--- src/test.ts | 13 +++++++++++++ 7 files changed, 52 insertions(+), 8 deletions(-) diff --git a/lib/request.d.ts b/lib/request.d.ts index ce27890..2562f6f 100644 --- a/lib/request.d.ts +++ b/lib/request.d.ts @@ -46,6 +46,7 @@ export declare class Question implements IMessageQuestion { serialize(): Buffer; } export declare class RecourceRecord implements MessageRecourceRecord { + constructor(data?: Partial); /** * This value can be set to identify if specific record is already set */ diff --git a/lib/request.js b/lib/request.js index 21983cd..b487b25 100644 --- a/lib/request.js +++ b/lib/request.js @@ -214,6 +214,13 @@ class Question { } exports.Question = Question; class RecourceRecord { + constructor(data) { + if (data) { + for (let key in data) { + this[key] = data[key]; + } + } + } set TYPE(value) { if (value < 0 || value > 65535) throw new TypeError("TYPE Range: 0 - 65.535"); @@ -244,7 +251,8 @@ class RecourceRecord { serialize() { // TODO: Implement compression let name = serializeName(this.NAME); - let data = Buffer.alloc(name.length + 10 + this.RDLENGTH); // For TYPE, CLASS, TTL, RLENGTH + let rdata = this.RDATA; + let data = Buffer.alloc(name.length + 10 + rdata.length); // For TYPE, CLASS, TTL, RLENGTH name.copy(data, 0, 0, name.length); let offset = name.length; data.writeUInt16BE(this.TYPE, offset); @@ -253,9 +261,9 @@ class RecourceRecord { offset += 2; data.writeUInt32BE(this._TTL, offset); offset += 4; - data.writeUInt16BE(this.RDLENGTH, offset); + data.writeUInt16BE(rdata.length, offset); offset += 2; - this.RDATA.copy(data, offset, 0, this.RDLENGTH); + rdata.copy(data, offset, 0, rdata.length); return data; } } diff --git a/lib/request.js.map b/lib/request.js.map index f5c2f7d..3985753 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,mCAAuG;AAEvG,MAAM,YAAY,GAAW,IAAI,sBAAM,EAAE;KACrC,SAAS,CAAC,KAAK,CAAC;KAChB,MAAM,CAAC,IAAI,CAAC;KACZ,IAAI,CAAC,IAAI,CAAC;KACV,IAAI,CAAC,QAAQ,CAAC;KACd,IAAI,CAAC,IAAI,CAAC;KACV,IAAI,CAAC,IAAI,CAAC;KACV,IAAI,CAAC,IAAI,CAAC;KACV,IAAI,CAAC,IAAI,CAAC;KACV,IAAI,CAAC,GAAG,CAAC;KACT,IAAI,CAAC,IAAI,CAAC;KACV,IAAI,CAAC,IAAI,CAAC;KACV,IAAI,CAAC,OAAO,CAAC;KACb,MAAM,CAAC,SAAS,CAAC;KACjB,MAAM,CAAC,SAAS,CAAC;KACjB,MAAM,CAAC,SAAS,CAAC;KACjB,MAAM,CAAC,SAAS,CAAC,CAAA;AAErB,qBAA4B,IAAY;IACrC,IAAI;QACD,OAAY,YAAY,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;KACvC;IAAC,OAAO,CAAC,EAAE;QACT,MAAM,IAAI,KAAK,CAAC,uBAAuB,GAAG,CAAC,CAAC,OAAO,CAAC,CAAA;KACtD;AACJ,CAAC;AAND,kCAMC;AAED,MAAM,WAAW,GAAG,IAAI,sBAAM,EAAE;KAC5B,SAAS,CAAC,KAAK,CAAC;KAChB,KAAK,CAAC,YAAY,CAAC;KACnB,MAAM,CAAC,MAAM,EAAE;IACb,MAAM,EAAE,YAAY;IACpB,QAAQ,EAAE,OAAO;CACnB,CAAC,CAAA;AAEL,MAAM,cAAc,GAAG,IAAI,sBAAM,EAAE;KAC/B,SAAS,CAAC,KAAK,CAAC;KAChB,KAAK,CAAC,OAAO,EAAE;IACb,IAAI,EAAE,WAAW;IACjB,SAAS,EAAE,C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a,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACpC,IAAI,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;QAEvB,IAAI,IAAI,GAAG,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,GAAG,EAAE,GAAG,KAAK,CAAC,MAAM,CAAC,CAAA,CAAC,gCAAgC;QACzF,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;QACnC,IAAI,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;QACzB,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC,CAAA;QACrC,MAAM,IAAI,CAAC,CAAA;QACX,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,KAAK,EAAE,MAAM,CAAC,CAAA;QACtC,MAAM,IAAI,CAAC,CAAA;QACX,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC,CAAA;QACrC,MAAM,IAAI,CAAC,CAAA;QACX,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;QACxC,MAAM,IAAI,CAAC,CAAA;QACX,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAA;QACzC,OAAO,IAAI,CAAC;IACf,CAAC;CACH;AAtED,wCAsEC"} \ No newline at end of file diff --git a/lib/test.js b/lib/test.js index b222bae..4ac5364 100644 --- a/lib/test.js +++ b/lib/test.js @@ -317,6 +317,18 @@ describe("parser", function () { let res = rr.serialize().toString("hex"); chai_1.assert.equal(res, should.replace(/\s/g, "").toLowerCase(), "Serialization not working properly"); }); + it("recource record constructor value assign", function () { + let should = "07 6578616D706C65 03 636f6D 00 0001 0001 00000640 0004 0A000001"; + let rr = new request_1.RecourceRecord({ + CLASS: 1, + NAME: "example.com", + TTL: 1600, + TYPE: 1, + RDATA: fromHex("0A 00 00 01") + }); + let res = rr.serialize().toString("hex"); + chai_1.assert.equal(res, should.replace(/\s/g, "").toLowerCase(), "Serialization not working properly"); + }); it("full response serialization", function () { let reqData = fromHex("E835 0100 0001 0000 0000 0000 07 6578616D706c65 03636F6D 00 0001 0001"); let should = "E835 8580 0001000100000000 076578616D706C6503636F6D0000010001 07 6578616D706C65 03 636F6D 00 0001 0001 0000 0640 0004 0A000001"; diff --git a/lib/test.js.map b/lib/test.js.map index df4f22a..fb8e33a 100644 --- a/lib/test.js.map +++ b/lib/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":["../src/test.ts"],"names":[],"mappings":";;AAAA,+BAAsC;AAEtC,uCAAkG;AAClG,mCAAuE;AAEvE,iBAAiB,IAAY;IAC1B,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC;AACtD,CAAC;AAED,QAAQ,CAAC,QAAQ,EAAE;IAChB,QAAQ,CAAC,QAAQ,EAAE;QAChB,QAAQ,CAAC,eAAe,EAAE;YACvB,IAAI,YAAY,GAAmB;gBAChC,EAAE,EAAE,CAAC;gBACL,EAAE,EAAE,CAAC;gBACL,MAAM,EAAE,CAAC;gBACT,EAAE,EAAE,CAAC;gBACL,EAAE,EAAE,CAAC;gBACL,EAAE,EAAE,CAAC;gBACL,EAAE,EAAE,CAAC;gBACL,CAAC,EAAE,CAAC;gBACJ,EAAE,EAAE,CAAC;gBACL,EAAE,EAAE,CAAC;gBACL,KAAK,EAAE,CAAC;gBACR,OAAO,EAAE,CAAC;gBACV,OAAO,EAAE,CAAC;gBACV,OAAO,EAAE,CAAC;gBACV,OAAO,EAAE,CAAC;aACZ,CAAA;YAED,IAAI,KAAK,GAAsE;gBAC5E;oBACG,IAAI,EAAE,kBAAkB;oBACxB,IAAI,EAAE,+BAA+B;oBACrC,MAAM,EAAE;wBACL,E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,mCAAmC,CAAC,CAAA;IACnH,CAAC,CAAC,CAAA;IAEF,4DAA4D;IAC5D,qGAAqG;IACrG,qCAAqC;IACrC,uDAAuD;IACvD,sCAAsC;IACtC,qBAAqB;IACrB,gCAAgC;IAChC,sBAAsB;IACtB,oBAAoB;IACpB,0CAA0C;IAC1C,iCAAiC;IACjC,4BAA4B;IAC5B,OAAO;IACP,KAAK;AACR,CAAC,CAAC,CAAA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"","sources":["../src/test.ts"],"names":[],"mappings":";;AAAA,+BAAsC;AAEtC,uCAAkG;AAClG,mCAAuE;AAEvE,iBAAiB,IAAY;IAC1B,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC;AACtD,CAAC;AAED,QAAQ,CAAC,QAAQ,EAAE;IAChB,QAAQ,CAAC,QAAQ,EAAE;QAChB,QAAQ,CAAC,eAAe,EAAE;YACvB,IAAI,YAAY,GAAmB;gBAChC,EAAE,EAAE,CAAC;gBACL,EAAE,EAAE,CAAC;gBACL,MAAM,EAAE,CAAC;gBACT,EAAE,EAAE,CAAC;gBACL,EAAE,EAAE,CAAC;gBACL,EAAE,EAAE,CAAC;gBACL,EAAE,EAAE,CAAC;gBACL,CAAC,EAAE,CAAC;gBACJ,EAAE,EAAE,CAAC;gBACL,EAAE,EAAE,CAAC;gBACL,KAAK,EAAE,CAAC;gBACR,OAAO,EAAE,CAAC;gBACV,OAAO,EAAE,CAAC;gBACV,OAAO,EAAE,CAAC;gBACV,OAAO,EAAE,CAAC;aACZ,CAAA;YAED,IAAI,KAAK,GAAsE;gBAC5E;oBACG,IAAI,EAAE,kBAAkB;oBACxB,IAAI,EAAE,+BAA+B;oBACrC,MAAM,EAAE;wBACL,EAAE,EAAE,CAAC;qBACP;iBACH;gBACD;oBACG,IAAI,EAAE,iCAAiC;oBACvC,IAAI,EAAE,+BAA+B;oBACrC,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AG,aAAa,CAAA;QACvB,EAAE,CAAC,GAAG,GAAG,IAAI,CAAA;QACb,EAAE,CAAC,IAAI,GAAG,CAAC,CAAA;QACX,EAAE,CAAC,KAAK,GAAG,OAAO,CAAC,aAAa,CAAC,CAAA;QACjC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;QACxB,IAAI,IAAI,GAAG,OAAO,CAAC,SAAS,EAAE,CAAA;QAC9B,aAAM,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,WAAW,EAAE,EAAE,mCAAmC,CAAC,CAAA;IACnH,CAAC,CAAC,CAAA;IAEF,4DAA4D;IAC5D,qGAAqG;IACrG,qCAAqC;IACrC,uDAAuD;IACvD,sCAAsC;IACtC,qBAAqB;IACrB,gCAAgC;IAChC,sBAAsB;IACtB,oBAAoB;IACpB,0CAA0C;IAC1C,iCAAiC;IACjC,4BAA4B;IAC5B,OAAO;IACP,KAAK;AACR,CAAC,CAAC,CAAA"} \ No newline at end of file diff --git a/src/request.ts b/src/request.ts index 2fea7ae..89cbc68 100644 --- a/src/request.ts +++ b/src/request.ts @@ -254,6 +254,14 @@ export class Question implements IMessageQuestion { } export class RecourceRecord implements MessageRecourceRecord { + constructor(data?: Partial) { + if (data) { + for (let key in data) { + this[key] = data[key]; + } + } + } + /** * This value can be set to identify if specific record is already set */ @@ -299,7 +307,9 @@ export class RecourceRecord implements MessageRecourceRecord { public serialize() { // TODO: Implement compression let name = serializeName(this.NAME); - let data = Buffer.alloc(name.length + 10 + this.RDLENGTH) // For TYPE, CLASS, TTL, RLENGTH + let rdata = this.RDATA; + + let data = Buffer.alloc(name.length + 10 + rdata.length) // For TYPE, CLASS, TTL, RLENGTH name.copy(data, 0, 0, name.length); let offset = name.length; data.writeUInt16BE(this.TYPE, offset) @@ -308,9 +318,9 @@ export class RecourceRecord implements MessageRecourceRecord { offset += 2 data.writeUInt32BE(this._TTL, offset) offset += 4 - data.writeUInt16BE(this.RDLENGTH, offset) + data.writeUInt16BE(rdata.length, offset) offset += 2 - this.RDATA.copy(data, offset, 0, this.RDLENGTH) + rdata.copy(data, offset, 0, rdata.length) return data; } } \ No newline at end of file diff --git a/src/test.ts b/src/test.ts index 4d0a4a3..7cc947d 100644 --- a/src/test.ts +++ b/src/test.ts @@ -327,6 +327,19 @@ describe("parser", function () { assert.equal(res, should.replace(/\s/g, "").toLowerCase(), "Serialization not working properly") }) + it("recource record constructor value assign", function () { + let should = "07 6578616D706C65 03 636f6D 00 0001 0001 00000640 0004 0A000001" + let rr = new RecourceRecord({ + CLASS: 1, + NAME: "example.com", + TTL: 1600, + TYPE: 1, + RDATA: fromHex("0A 00 00 01") + }) + let res = rr.serialize().toString("hex") + assert.equal(res, should.replace(/\s/g, "").toLowerCase(), "Serialization not working properly") + }) + it("full response serialization", function () { let reqData = fromHex("E835 0100 0001 0000 0000 0000 07 6578616D706c65 03636F6D 00 0001 0001"); let should = "E835 8580 0001000100000000 076578616D706C6503636F6D0000010001 07 6578616D706C65 03 636F6D 00 0001 0001 0000 0640 0004 0A000001"