1 | declare module 'dns' {
|
2 | import * as dnsPromises from "dns/promises";
|
3 |
|
4 |
|
5 | export const ADDRCONFIG: number;
|
6 | export const V4MAPPED: number;
|
7 | |
8 |
|
9 |
|
10 |
|
11 | export const ALL: number;
|
12 |
|
13 | export interface LookupOptions {
|
14 | family?: number;
|
15 | hints?: number;
|
16 | all?: boolean;
|
17 | verbatim?: boolean;
|
18 | }
|
19 |
|
20 | export interface LookupOneOptions extends LookupOptions {
|
21 | all?: false;
|
22 | }
|
23 |
|
24 | export interface LookupAllOptions extends LookupOptions {
|
25 | all: true;
|
26 | }
|
27 |
|
28 | export interface LookupAddress {
|
29 | address: string;
|
30 | family: number;
|
31 | }
|
32 |
|
33 | export function lookup(hostname: string, family: number, callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void): void;
|
34 | export function lookup(hostname: string, options: LookupOneOptions, callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void): void;
|
35 | export function lookup(hostname: string, options: LookupAllOptions, callback: (err: NodeJS.ErrnoException | null, addresses: LookupAddress[]) => void): void;
|
36 | export function lookup(hostname: string, options: LookupOptions, callback: (err: NodeJS.ErrnoException | null, address: string | LookupAddress[], family: number) => void): void;
|
37 | export function lookup(hostname: string, callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void): void;
|
38 |
|
39 |
|
40 | export namespace lookup {
|
41 | function __promisify__(hostname: string, options: LookupAllOptions): Promise<LookupAddress[]>;
|
42 | function __promisify__(hostname: string, options?: LookupOneOptions | number): Promise<LookupAddress>;
|
43 | function __promisify__(hostname: string, options: LookupOptions): Promise<LookupAddress | LookupAddress[]>;
|
44 | }
|
45 |
|
46 | export function lookupService(address: string, port: number, callback: (err: NodeJS.ErrnoException | null, hostname: string, service: string) => void): void;
|
47 |
|
48 | export namespace lookupService {
|
49 | function __promisify__(address: string, port: number): Promise<{ hostname: string, service: string }>;
|
50 | }
|
51 |
|
52 | export interface ResolveOptions {
|
53 | ttl: boolean;
|
54 | }
|
55 |
|
56 | export interface ResolveWithTtlOptions extends ResolveOptions {
|
57 | ttl: true;
|
58 | }
|
59 |
|
60 | export interface RecordWithTtl {
|
61 | address: string;
|
62 | ttl: number;
|
63 | }
|
64 |
|
65 |
|
66 | export type AnyRecordWithTtl = AnyARecord | AnyAaaaRecord;
|
67 |
|
68 | export interface AnyARecord extends RecordWithTtl {
|
69 | type: "A";
|
70 | }
|
71 |
|
72 | export interface AnyAaaaRecord extends RecordWithTtl {
|
73 | type: "AAAA";
|
74 | }
|
75 |
|
76 | export interface CaaRecord {
|
77 | critial: number;
|
78 | issue?: string;
|
79 | issuewild?: string;
|
80 | iodef?: string;
|
81 | contactemail?: string;
|
82 | contactphone?: string;
|
83 | }
|
84 |
|
85 | export interface MxRecord {
|
86 | priority: number;
|
87 | exchange: string;
|
88 | }
|
89 |
|
90 | export interface AnyMxRecord extends MxRecord {
|
91 | type: "MX";
|
92 | }
|
93 |
|
94 | export interface NaptrRecord {
|
95 | flags: string;
|
96 | service: string;
|
97 | regexp: string;
|
98 | replacement: string;
|
99 | order: number;
|
100 | preference: number;
|
101 | }
|
102 |
|
103 | export interface AnyNaptrRecord extends NaptrRecord {
|
104 | type: "NAPTR";
|
105 | }
|
106 |
|
107 | export interface SoaRecord {
|
108 | nsname: string;
|
109 | hostmaster: string;
|
110 | serial: number;
|
111 | refresh: number;
|
112 | retry: number;
|
113 | expire: number;
|
114 | minttl: number;
|
115 | }
|
116 |
|
117 | export interface AnySoaRecord extends SoaRecord {
|
118 | type: "SOA";
|
119 | }
|
120 |
|
121 | export interface SrvRecord {
|
122 | priority: number;
|
123 | weight: number;
|
124 | port: number;
|
125 | name: string;
|
126 | }
|
127 |
|
128 | export interface AnySrvRecord extends SrvRecord {
|
129 | type: "SRV";
|
130 | }
|
131 |
|
132 | export interface AnyTxtRecord {
|
133 | type: "TXT";
|
134 | entries: string[];
|
135 | }
|
136 |
|
137 | export interface AnyNsRecord {
|
138 | type: "NS";
|
139 | value: string;
|
140 | }
|
141 |
|
142 | export interface AnyPtrRecord {
|
143 | type: "PTR";
|
144 | value: string;
|
145 | }
|
146 |
|
147 | export interface AnyCnameRecord {
|
148 | type: "CNAME";
|
149 | value: string;
|
150 | }
|
151 |
|
152 | export type AnyRecord = AnyARecord |
|
153 | AnyAaaaRecord |
|
154 | AnyCnameRecord |
|
155 | AnyMxRecord |
|
156 | AnyNaptrRecord |
|
157 | AnyNsRecord |
|
158 | AnyPtrRecord |
|
159 | AnySoaRecord |
|
160 | AnySrvRecord |
|
161 | AnyTxtRecord;
|
162 |
|
163 | export function resolve(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
|
164 | export function resolve(hostname: string, rrtype: "A", callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
|
165 | export function resolve(hostname: string, rrtype: "AAAA", callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
|
166 | export function resolve(hostname: string, rrtype: "ANY", callback: (err: NodeJS.ErrnoException | null, addresses: AnyRecord[]) => void): void;
|
167 | export function resolve(hostname: string, rrtype: "CNAME", callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
|
168 | export function resolve(hostname: string, rrtype: "MX", callback: (err: NodeJS.ErrnoException | null, addresses: MxRecord[]) => void): void;
|
169 | export function resolve(hostname: string, rrtype: "NAPTR", callback: (err: NodeJS.ErrnoException | null, addresses: NaptrRecord[]) => void): void;
|
170 | export function resolve(hostname: string, rrtype: "NS", callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
|
171 | export function resolve(hostname: string, rrtype: "PTR", callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
|
172 | export function resolve(hostname: string, rrtype: "SOA", callback: (err: NodeJS.ErrnoException | null, addresses: SoaRecord) => void): void;
|
173 | export function resolve(hostname: string, rrtype: "SRV", callback: (err: NodeJS.ErrnoException | null, addresses: SrvRecord[]) => void): void;
|
174 | export function resolve(hostname: string, rrtype: "TXT", callback: (err: NodeJS.ErrnoException | null, addresses: string[][]) => void): void;
|
175 | export function resolve(
|
176 | hostname: string,
|
177 | rrtype: string,
|
178 | callback: (err: NodeJS.ErrnoException | null, addresses: string[] | MxRecord[] | NaptrRecord[] | SoaRecord | SrvRecord[] | string[][] | AnyRecord[]) => void,
|
179 | ): void;
|
180 |
|
181 |
|
182 | export namespace resolve {
|
183 | function __promisify__(hostname: string, rrtype?: "A" | "AAAA" | "CNAME" | "NS" | "PTR"): Promise<string[]>;
|
184 | function __promisify__(hostname: string, rrtype: "ANY"): Promise<AnyRecord[]>;
|
185 | function __promisify__(hostname: string, rrtype: "MX"): Promise<MxRecord[]>;
|
186 | function __promisify__(hostname: string, rrtype: "NAPTR"): Promise<NaptrRecord[]>;
|
187 | function __promisify__(hostname: string, rrtype: "SOA"): Promise<SoaRecord>;
|
188 | function __promisify__(hostname: string, rrtype: "SRV"): Promise<SrvRecord[]>;
|
189 | function __promisify__(hostname: string, rrtype: "TXT"): Promise<string[][]>;
|
190 | function __promisify__(hostname: string, rrtype: string): Promise<string[] | MxRecord[] | NaptrRecord[] | SoaRecord | SrvRecord[] | string[][] | AnyRecord[]>;
|
191 | }
|
192 |
|
193 | export function resolve4(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
|
194 | export function resolve4(hostname: string, options: ResolveWithTtlOptions, callback: (err: NodeJS.ErrnoException | null, addresses: RecordWithTtl[]) => void): void;
|
195 | export function resolve4(hostname: string, options: ResolveOptions, callback: (err: NodeJS.ErrnoException | null, addresses: string[] | RecordWithTtl[]) => void): void;
|
196 |
|
197 |
|
198 | export namespace resolve4 {
|
199 | function __promisify__(hostname: string): Promise<string[]>;
|
200 | function __promisify__(hostname: string, options: ResolveWithTtlOptions): Promise<RecordWithTtl[]>;
|
201 | function __promisify__(hostname: string, options?: ResolveOptions): Promise<string[] | RecordWithTtl[]>;
|
202 | }
|
203 |
|
204 | export function resolve6(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
|
205 | export function resolve6(hostname: string, options: ResolveWithTtlOptions, callback: (err: NodeJS.ErrnoException | null, addresses: RecordWithTtl[]) => void): void;
|
206 | export function resolve6(hostname: string, options: ResolveOptions, callback: (err: NodeJS.ErrnoException | null, addresses: string[] | RecordWithTtl[]) => void): void;
|
207 |
|
208 |
|
209 | export namespace resolve6 {
|
210 | function __promisify__(hostname: string): Promise<string[]>;
|
211 | function __promisify__(hostname: string, options: ResolveWithTtlOptions): Promise<RecordWithTtl[]>;
|
212 | function __promisify__(hostname: string, options?: ResolveOptions): Promise<string[] | RecordWithTtl[]>;
|
213 | }
|
214 |
|
215 | export function resolveCname(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
|
216 | export namespace resolveCname {
|
217 | function __promisify__(hostname: string): Promise<string[]>;
|
218 | }
|
219 |
|
220 | export function resolveCaa(hostname: string, callback: (err: NodeJS.ErrnoException | null, records: CaaRecord[]) => void): void;
|
221 | export namespace resolveCaa {
|
222 | function __promisify__(hostname: string): Promise<CaaRecord[]>;
|
223 | }
|
224 |
|
225 | export function resolveMx(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: MxRecord[]) => void): void;
|
226 | export namespace resolveMx {
|
227 | function __promisify__(hostname: string): Promise<MxRecord[]>;
|
228 | }
|
229 |
|
230 | export function resolveNaptr(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: NaptrRecord[]) => void): void;
|
231 | export namespace resolveNaptr {
|
232 | function __promisify__(hostname: string): Promise<NaptrRecord[]>;
|
233 | }
|
234 |
|
235 | export function resolveNs(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
|
236 | export namespace resolveNs {
|
237 | function __promisify__(hostname: string): Promise<string[]>;
|
238 | }
|
239 |
|
240 | export function resolvePtr(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
|
241 | export namespace resolvePtr {
|
242 | function __promisify__(hostname: string): Promise<string[]>;
|
243 | }
|
244 |
|
245 | export function resolveSoa(hostname: string, callback: (err: NodeJS.ErrnoException | null, address: SoaRecord) => void): void;
|
246 | export namespace resolveSoa {
|
247 | function __promisify__(hostname: string): Promise<SoaRecord>;
|
248 | }
|
249 |
|
250 | export function resolveSrv(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: SrvRecord[]) => void): void;
|
251 | export namespace resolveSrv {
|
252 | function __promisify__(hostname: string): Promise<SrvRecord[]>;
|
253 | }
|
254 |
|
255 | export function resolveTxt(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[][]) => void): void;
|
256 | export namespace resolveTxt {
|
257 | function __promisify__(hostname: string): Promise<string[][]>;
|
258 | }
|
259 |
|
260 | export function resolveAny(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: AnyRecord[]) => void): void;
|
261 | export namespace resolveAny {
|
262 | function __promisify__(hostname: string): Promise<AnyRecord[]>;
|
263 | }
|
264 |
|
265 | export function reverse(ip: string, callback: (err: NodeJS.ErrnoException | null, hostnames: string[]) => void): void;
|
266 | export function setServers(servers: ReadonlyArray<string>): void;
|
267 | export function getServers(): string[];
|
268 |
|
269 |
|
270 | export const NODATA: string;
|
271 | export const FORMERR: string;
|
272 | export const SERVFAIL: string;
|
273 | export const NOTFOUND: string;
|
274 | export const NOTIMP: string;
|
275 | export const REFUSED: string;
|
276 | export const BADQUERY: string;
|
277 | export const BADNAME: string;
|
278 | export const BADFAMILY: string;
|
279 | export const BADRESP: string;
|
280 | export const CONNREFUSED: string;
|
281 | export const TIMEOUT: string;
|
282 | export const EOF: string;
|
283 | export const FILE: string;
|
284 | export const NOMEM: string;
|
285 | export const DESTRUCTION: string;
|
286 | export const BADSTR: string;
|
287 | export const BADFLAGS: string;
|
288 | export const NONAME: string;
|
289 | export const BADHINTS: string;
|
290 | export const NOTINITIALIZED: string;
|
291 | export const LOADIPHLPAPI: string;
|
292 | export const ADDRGETNETWORKPARAMS: string;
|
293 | export const CANCELLED: string;
|
294 |
|
295 | export interface ResolverOptions {
|
296 | timeout?: number;
|
297 | }
|
298 |
|
299 | export class Resolver {
|
300 | constructor(options?: ResolverOptions);
|
301 |
|
302 | cancel(): void;
|
303 | getServers: typeof getServers;
|
304 | resolve: typeof resolve;
|
305 | resolve4: typeof resolve4;
|
306 | resolve6: typeof resolve6;
|
307 | resolveAny: typeof resolveAny;
|
308 | resolveCname: typeof resolveCname;
|
309 | resolveMx: typeof resolveMx;
|
310 | resolveNaptr: typeof resolveNaptr;
|
311 | resolveNs: typeof resolveNs;
|
312 | resolvePtr: typeof resolvePtr;
|
313 | resolveSoa: typeof resolveSoa;
|
314 | resolveSrv: typeof resolveSrv;
|
315 | resolveTxt: typeof resolveTxt;
|
316 | reverse: typeof reverse;
|
317 | setLocalAddress(ipv4?: string, ipv6?: string): void;
|
318 | setServers: typeof setServers;
|
319 | }
|
320 |
|
321 | export { dnsPromises as promises };
|
322 | }
|