Changing some class privacy settings

This commit is contained in:
Fabian Stamm 2018-05-13 19:27:40 +02:00
parent f8868c7a22
commit eb4ae29f7e
5 changed files with 6 additions and 10 deletions

4
lib/request.d.ts vendored
View File

@ -102,7 +102,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);
send(): void; send(): void;
private serialize(truncate?, rcode?); serialize(truncate?: boolean, rcode?: 0 | 1 | 2 | 3 | 4 | 5): Buffer;
private serializeHeader(); private serializeHeader();
private serializeQuestion(question); private serializeQuestion(question);
private serializeResourceRecord(record); private serializeResourceRecord(record);
@ -114,7 +114,7 @@ export declare class RecourceRecord implements MessageRecourceRecord {
TYPE: number; TYPE: number;
private _CLASS; private _CLASS;
CLASS: number; CLASS: number;
_TTL: number; private _TTL;
TTL: number; TTL: number;
RDATA: Buffer; RDATA: Buffer;
readonly RDLENGTH: number; readonly RDLENGTH: number;

View File

@ -265,14 +265,12 @@ class Request {
let data = Buffer.alloc(length); let data = Buffer.alloc(length);
let offset = 0; let offset = 0;
parts.forEach(e => { parts.forEach(e => {
console.log(e.length);
data.writeUInt8(e.length, offset); data.writeUInt8(e.length, offset);
offset++; offset++;
data.write(e, offset, e.length); data.write(e, offset, e.length);
offset += e.length; offset += e.length;
}); });
data.writeUInt8(0, offset); data.writeUInt8(0, offset);
console.log("name |", data.toString("hex"), length);
return data; return data;
} }
} }

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,6 @@
{ {
"name": "nodename-core", "name": "nodename-core",
"version": "0.1.2", "version": "0.1.3",
"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>",

View File

@ -197,7 +197,7 @@ export class Request implements Message {
this.sendCallback(this.serialize()); this.sendCallback(this.serialize());
} }
private serialize(truncate: boolean = false, rcode: 0 | 1 | 2 | 3 | 4 | 5 = 0) { serialize(truncate: boolean = false, rcode: 0 | 1 | 2 | 3 | 4 | 5 = 0) {
this._header.AA = 1; this._header.AA = 1;
this._header.ANCOUNT = this.answers.length; this._header.ANCOUNT = this.answers.length;
this._header.ARCOUNT = this.additionals.length; this._header.ARCOUNT = this.additionals.length;
@ -315,14 +315,12 @@ export class Request implements Message {
let data = Buffer.alloc(length); let data = Buffer.alloc(length);
let offset = 0; let offset = 0;
parts.forEach(e => { parts.forEach(e => {
console.log(e.length);
data.writeUInt8(e.length, offset) data.writeUInt8(e.length, offset)
offset++ offset++
data.write(e, offset, e.length) data.write(e, offset, e.length)
offset += e.length offset += e.length
}) })
data.writeUInt8(0, offset); data.writeUInt8(0, offset);
console.log("name |", data.toString("hex"), length)
return data; return data;
} }
} }
@ -349,7 +347,7 @@ export class RecourceRecord implements MessageRecourceRecord {
return this._CLASS; return this._CLASS;
} }
_TTL: number; private _TTL: number;
set TTL(value) { set TTL(value) {
if (value < 0 || value > 4294967295) throw new TypeError("TTL Range: 0 - 4.294.967.295") if (value < 0 || value > 4294967295) throw new TypeError("TTL Range: 0 - 4.294.967.295")
} }