2 // Supported getaddrinfo flags.
3 const ADDRCONFIG: number;
4 const V4MAPPED: number;
6 * If `dns.V4MAPPED` is specified, return resolved IPv6 addresses as
7 * well as IPv4 mapped IPv6 addresses.
11 interface LookupOptions {
18 interface LookupOneOptions extends LookupOptions {
22 interface LookupAllOptions extends LookupOptions {
26 interface LookupAddress {
31 function lookup(hostname: string, family: number, callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void): void;
32 function lookup(hostname: string, options: LookupOneOptions, callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void): void;
33 function lookup(hostname: string, options: LookupAllOptions, callback: (err: NodeJS.ErrnoException | null, addresses: LookupAddress[]) => void): void;
34 function lookup(hostname: string, options: LookupOptions, callback: (err: NodeJS.ErrnoException | null, address: string | LookupAddress[], family: number) => void): void;
35 function lookup(hostname: string, callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void): void;
37 // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
39 function __promisify__(hostname: string, options: LookupAllOptions): Promise<LookupAddress[]>;
40 function __promisify__(hostname: string, options?: LookupOneOptions | number): Promise<LookupAddress>;
41 function __promisify__(hostname: string, options: LookupOptions): Promise<LookupAddress | LookupAddress[]>;
44 function lookupService(address: string, port: number, callback: (err: NodeJS.ErrnoException | null, hostname: string, service: string) => void): void;
46 namespace lookupService {
47 function __promisify__(address: string, port: number): Promise<{ hostname: string, service: string }>;
50 interface ResolveOptions {
54 interface ResolveWithTtlOptions extends ResolveOptions {
58 interface RecordWithTtl {
63 /** @deprecated Use AnyARecord or AnyAaaaRecord instead. */
64 type AnyRecordWithTtl = AnyARecord | AnyAaaaRecord;
66 interface AnyARecord extends RecordWithTtl {
70 interface AnyAaaaRecord extends RecordWithTtl {
79 interface AnyMxRecord extends MxRecord {
83 interface NaptrRecord {
92 interface AnyNaptrRecord extends NaptrRecord {
106 interface AnySoaRecord extends SoaRecord {
110 interface SrvRecord {
117 interface AnySrvRecord extends SrvRecord {
121 interface AnyTxtRecord {
126 interface AnyNsRecord {
131 interface AnyPtrRecord {
136 interface AnyCnameRecord {
141 type AnyRecord = AnyARecord |
152 function resolve(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
153 function resolve(hostname: string, rrtype: "A", callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
154 function resolve(hostname: string, rrtype: "AAAA", callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
155 function resolve(hostname: string, rrtype: "ANY", callback: (err: NodeJS.ErrnoException | null, addresses: AnyRecord[]) => void): void;
156 function resolve(hostname: string, rrtype: "CNAME", callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
157 function resolve(hostname: string, rrtype: "MX", callback: (err: NodeJS.ErrnoException | null, addresses: MxRecord[]) => void): void;
158 function resolve(hostname: string, rrtype: "NAPTR", callback: (err: NodeJS.ErrnoException | null, addresses: NaptrRecord[]) => void): void;
159 function resolve(hostname: string, rrtype: "NS", callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
160 function resolve(hostname: string, rrtype: "PTR", callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
161 function resolve(hostname: string, rrtype: "SOA", callback: (err: NodeJS.ErrnoException | null, addresses: SoaRecord) => void): void;
162 function resolve(hostname: string, rrtype: "SRV", callback: (err: NodeJS.ErrnoException | null, addresses: SrvRecord[]) => void): void;
163 function resolve(hostname: string, rrtype: "TXT", callback: (err: NodeJS.ErrnoException | null, addresses: string[][]) => void): void;
167 callback: (err: NodeJS.ErrnoException | null, addresses: string[] | MxRecord[] | NaptrRecord[] | SoaRecord | SrvRecord[] | string[][] | AnyRecord[]) => void,
170 // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
172 function __promisify__(hostname: string, rrtype?: "A" | "AAAA" | "CNAME" | "NS" | "PTR"): Promise<string[]>;
173 function __promisify__(hostname: string, rrtype: "ANY"): Promise<AnyRecord[]>;
174 function __promisify__(hostname: string, rrtype: "MX"): Promise<MxRecord[]>;
175 function __promisify__(hostname: string, rrtype: "NAPTR"): Promise<NaptrRecord[]>;
176 function __promisify__(hostname: string, rrtype: "SOA"): Promise<SoaRecord>;
177 function __promisify__(hostname: string, rrtype: "SRV"): Promise<SrvRecord[]>;
178 function __promisify__(hostname: string, rrtype: "TXT"): Promise<string[][]>;
179 function __promisify__(hostname: string, rrtype: string): Promise<string[] | MxRecord[] | NaptrRecord[] | SoaRecord | SrvRecord[] | string[][] | AnyRecord[]>;
182 function resolve4(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
183 function resolve4(hostname: string, options: ResolveWithTtlOptions, callback: (err: NodeJS.ErrnoException | null, addresses: RecordWithTtl[]) => void): void;
184 function resolve4(hostname: string, options: ResolveOptions, callback: (err: NodeJS.ErrnoException | null, addresses: string[] | RecordWithTtl[]) => void): void;
186 // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
188 function __promisify__(hostname: string): Promise<string[]>;
189 function __promisify__(hostname: string, options: ResolveWithTtlOptions): Promise<RecordWithTtl[]>;
190 function __promisify__(hostname: string, options?: ResolveOptions): Promise<string[] | RecordWithTtl[]>;
193 function resolve6(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
194 function resolve6(hostname: string, options: ResolveWithTtlOptions, callback: (err: NodeJS.ErrnoException | null, addresses: RecordWithTtl[]) => void): void;
195 function resolve6(hostname: string, options: ResolveOptions, callback: (err: NodeJS.ErrnoException | null, addresses: string[] | RecordWithTtl[]) => void): void;
197 // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
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[]>;
204 function resolveCname(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
205 namespace resolveCname {
206 function __promisify__(hostname: string): Promise<string[]>;
209 function resolveMx(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: MxRecord[]) => void): void;
210 namespace resolveMx {
211 function __promisify__(hostname: string): Promise<MxRecord[]>;
214 function resolveNaptr(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: NaptrRecord[]) => void): void;
215 namespace resolveNaptr {
216 function __promisify__(hostname: string): Promise<NaptrRecord[]>;
219 function resolveNs(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
220 namespace resolveNs {
221 function __promisify__(hostname: string): Promise<string[]>;
224 function resolvePtr(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
225 namespace resolvePtr {
226 function __promisify__(hostname: string): Promise<string[]>;
229 function resolveSoa(hostname: string, callback: (err: NodeJS.ErrnoException | null, address: SoaRecord) => void): void;
230 namespace resolveSoa {
231 function __promisify__(hostname: string): Promise<SoaRecord>;
234 function resolveSrv(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: SrvRecord[]) => void): void;
235 namespace resolveSrv {
236 function __promisify__(hostname: string): Promise<SrvRecord[]>;
239 function resolveTxt(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[][]) => void): void;
240 namespace resolveTxt {
241 function __promisify__(hostname: string): Promise<string[][]>;
244 function resolveAny(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: AnyRecord[]) => void): void;
245 namespace resolveAny {
246 function __promisify__(hostname: string): Promise<AnyRecord[]>;
249 function reverse(ip: string, callback: (err: NodeJS.ErrnoException | null, hostnames: string[]) => void): void;
250 function setServers(servers: ReadonlyArray<string>): void;
251 function getServers(): string[];
254 const NODATA: string;
255 const FORMERR: string;
256 const SERVFAIL: string;
257 const NOTFOUND: string;
258 const NOTIMP: string;
259 const REFUSED: string;
260 const BADQUERY: string;
261 const BADNAME: string;
262 const BADFAMILY: string;
263 const BADRESP: string;
264 const CONNREFUSED: string;
265 const TIMEOUT: string;
269 const DESTRUCTION: string;
270 const BADSTR: string;
271 const BADFLAGS: string;
272 const NONAME: string;
273 const BADHINTS: string;
274 const NOTINITIALIZED: string;
275 const LOADIPHLPAPI: string;
276 const ADDRGETNETWORKPARAMS: string;
277 const CANCELLED: string;
280 getServers: typeof getServers;
281 setServers: typeof setServers;
282 resolve: typeof resolve;
283 resolve4: typeof resolve4;
284 resolve6: typeof resolve6;
285 resolveAny: typeof resolveAny;
286 resolveCname: typeof resolveCname;
287 resolveMx: typeof resolveMx;
288 resolveNaptr: typeof resolveNaptr;
289 resolveNs: typeof resolveNs;
290 resolvePtr: typeof resolvePtr;
291 resolveSoa: typeof resolveSoa;
292 resolveSrv: typeof resolveSrv;
293 resolveTxt: typeof resolveTxt;
294 reverse: typeof reverse;
299 function getServers(): string[];
301 function lookup(hostname: string, family: number): Promise<LookupAddress>;
302 function lookup(hostname: string, options: LookupOneOptions): Promise<LookupAddress>;
303 function lookup(hostname: string, options: LookupAllOptions): Promise<LookupAddress[]>;
304 function lookup(hostname: string, options: LookupOptions): Promise<LookupAddress | LookupAddress[]>;
305 function lookup(hostname: string): Promise<LookupAddress>;
307 function lookupService(address: string, port: number): Promise<{ hostname: string, service: string }>;
309 function resolve(hostname: string): Promise<string[]>;
310 function resolve(hostname: string, rrtype: "A"): Promise<string[]>;
311 function resolve(hostname: string, rrtype: "AAAA"): Promise<string[]>;
312 function resolve(hostname: string, rrtype: "ANY"): Promise<AnyRecord[]>;
313 function resolve(hostname: string, rrtype: "CNAME"): Promise<string[]>;
314 function resolve(hostname: string, rrtype: "MX"): Promise<MxRecord[]>;
315 function resolve(hostname: string, rrtype: "NAPTR"): Promise<NaptrRecord[]>;
316 function resolve(hostname: string, rrtype: "NS"): Promise<string[]>;
317 function resolve(hostname: string, rrtype: "PTR"): Promise<string[]>;
318 function resolve(hostname: string, rrtype: "SOA"): Promise<SoaRecord>;
319 function resolve(hostname: string, rrtype: "SRV"): Promise<SrvRecord[]>;
320 function resolve(hostname: string, rrtype: "TXT"): Promise<string[][]>;
321 function resolve(hostname: string, rrtype: string): Promise<string[] | MxRecord[] | NaptrRecord[] | SoaRecord | SrvRecord[] | string[][] | AnyRecord[]>;
323 function resolve4(hostname: string): Promise<string[]>;
324 function resolve4(hostname: string, options: ResolveWithTtlOptions): Promise<RecordWithTtl[]>;
325 function resolve4(hostname: string, options: ResolveOptions): Promise<string[] | RecordWithTtl[]>;
327 function resolve6(hostname: string): Promise<string[]>;
328 function resolve6(hostname: string, options: ResolveWithTtlOptions): Promise<RecordWithTtl[]>;
329 function resolve6(hostname: string, options: ResolveOptions): Promise<string[] | RecordWithTtl[]>;
331 function resolveAny(hostname: string): Promise<AnyRecord[]>;
333 function resolveCname(hostname: string): Promise<string[]>;
335 function resolveMx(hostname: string): Promise<MxRecord[]>;
337 function resolveNaptr(hostname: string): Promise<NaptrRecord[]>;
339 function resolveNs(hostname: string): Promise<string[]>;
341 function resolvePtr(hostname: string): Promise<string[]>;
343 function resolveSoa(hostname: string): Promise<SoaRecord>;
345 function resolveSrv(hostname: string): Promise<SrvRecord[]>;
347 function resolveTxt(hostname: string): Promise<string[][]>;
349 function reverse(ip: string): Promise<string[]>;
351 function setServers(servers: ReadonlyArray<string>): void;
354 getServers: typeof getServers;
355 resolve: typeof resolve;
356 resolve4: typeof resolve4;
357 resolve6: typeof resolve6;
358 resolveAny: typeof resolveAny;
359 resolveCname: typeof resolveCname;
360 resolveMx: typeof resolveMx;
361 resolveNaptr: typeof resolveNaptr;
362 resolveNs: typeof resolveNs;
363 resolvePtr: typeof resolvePtr;
364 resolveSoa: typeof resolveSoa;
365 resolveSrv: typeof resolveSrv;
366 resolveTxt: typeof resolveTxt;
367 reverse: typeof reverse;
368 setServers: typeof setServers;