2018-05-13 10:07:43 +00:00
|
|
|
/// <reference types="node" />
|
2018-05-17 08:01:56 +00:00
|
|
|
import { IMessage, IMessageHeader, IMessageQuestion, MessageRecourceRecord, ErrorCodes } from "./types";
|
|
|
|
export declare function parseHeader(data: Buffer): IMessageHeader;
|
|
|
|
export declare function parseQuestions(count: number, packet: Buffer): IMessageQuestion[];
|
|
|
|
export declare function serializeName(name: string): Buffer;
|
|
|
|
export declare class Request implements IMessage {
|
2018-05-13 10:07:43 +00:00
|
|
|
private sendCallback;
|
2018-05-17 08:01:56 +00:00
|
|
|
private max_size;
|
2018-05-13 20:36:06 +00:00
|
|
|
private _header;
|
2018-05-17 08:01:56 +00:00
|
|
|
readonly header: Header;
|
2018-05-13 20:36:06 +00:00
|
|
|
private _questions;
|
2018-05-17 08:01:56 +00:00
|
|
|
readonly questions: Question[];
|
2018-05-13 10:07:43 +00:00
|
|
|
answers: RecourceRecord[];
|
|
|
|
authorities: RecourceRecord[];
|
|
|
|
additionals: RecourceRecord[];
|
2018-05-17 08:01:56 +00:00
|
|
|
constructor(packet: Buffer, sendCallback: (packet: Buffer) => any, max_size?: number);
|
2018-05-13 18:32:55 +00:00
|
|
|
error(error: ErrorCodes): void;
|
2018-05-13 20:34:20 +00:00
|
|
|
noRecursion(): void;
|
2018-05-13 10:07:43 +00:00
|
|
|
send(): void;
|
2018-05-17 08:01:56 +00:00
|
|
|
serialize(): Buffer;
|
|
|
|
}
|
|
|
|
export declare class Header implements IMessageHeader {
|
|
|
|
ID: number;
|
|
|
|
QR: 0 | 1;
|
|
|
|
OPCODE: number;
|
|
|
|
AA: 0 | 1;
|
|
|
|
TC: 0 | 1;
|
|
|
|
RD: 0 | 1;
|
|
|
|
RA: 0 | 1;
|
|
|
|
Z: 0 | 1;
|
|
|
|
AD: 0 | 1;
|
|
|
|
CD: 0 | 1;
|
|
|
|
RCODE: ErrorCodes;
|
|
|
|
QDCOUNT: number;
|
|
|
|
ANCOUNT: number;
|
|
|
|
NSCOUNT: number;
|
|
|
|
ARCOUNT: number;
|
|
|
|
constructor(header: IMessageHeader);
|
|
|
|
serialize(): Buffer;
|
|
|
|
}
|
|
|
|
export declare class Question implements IMessageQuestion {
|
|
|
|
QNAME: string;
|
|
|
|
QTYPE: number;
|
|
|
|
QCLASS: number;
|
|
|
|
constructor(question: IMessageQuestion);
|
|
|
|
serialize(): Buffer;
|
2018-05-13 10:07:43 +00:00
|
|
|
}
|
|
|
|
export declare class RecourceRecord implements MessageRecourceRecord {
|
2018-05-14 10:06:51 +00:00
|
|
|
/**
|
|
|
|
* This value can be set to identify if specific record is already set
|
|
|
|
*/
|
|
|
|
Identifier: string;
|
2018-05-13 10:07:43 +00:00
|
|
|
NAME: string;
|
|
|
|
private _TYPE;
|
|
|
|
TYPE: number;
|
|
|
|
private _CLASS;
|
|
|
|
CLASS: number;
|
2018-05-13 17:27:40 +00:00
|
|
|
private _TTL;
|
2018-05-13 10:07:43 +00:00
|
|
|
TTL: number;
|
|
|
|
RDATA: Buffer;
|
|
|
|
readonly RDLENGTH: number;
|
2018-05-17 08:01:56 +00:00
|
|
|
serialize(): Buffer;
|
2018-05-13 10:07:43 +00:00
|
|
|
}
|