Merge pull request #26407 from r3nya/node-dns-lookup

[node] Add dns.lookupService method
This commit is contained in:
Mine Starks
2018-06-13 08:59:26 -07:00
committed by GitHub
12 changed files with 63 additions and 0 deletions

View File

@@ -24,6 +24,7 @@
// Hoàng Văn Khải <https://github.com/KSXGitHub>
// Alexander T. <https://github.com/a-tarasyuk>
// Lishude <https://github.com/islishude>
// Andrew Makarov <https://github.com/r3nya>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/** inspector module types */
@@ -2540,6 +2541,12 @@ declare module "dns" {
export function __promisify__(hostname: string, options?: LookupOptions | number): Promise<{ address: string | LookupAddress[], family?: number }>;
}
export function lookupService(address: string, port: number, callback: (err: NodeJS.ErrnoException, hostname: string, service: string) => void): void;
export namespace lookupService {
export function __promisify__(address: string, port: number): Promise<{ hostname: string, service: string }>;
}
export interface ResolveOptions {
ttl: boolean;
}

View File

@@ -3114,6 +3114,12 @@ namespace dns_tests {
const _family: number | undefined = family;
});
dns.lookupService("127.0.0.1", 0, (err, hostname, service) => {
const _err: NodeJS.ErrnoException = err;
const _hostname: string = hostname;
const _service: string = service;
});
dns.resolve("nodejs.org", (err, addresses) => {
const _addresses: string[] = addresses;
});

View File

@@ -1450,6 +1450,8 @@ declare module "dns" {
export function lookup(hostname: string, options: LookupOptions, callback: (err: NodeJS.ErrnoException, address: string | LookupAddress[], family: number) => void): void;
export function lookup(hostname: string, callback: (err: NodeJS.ErrnoException, address: string, family: number) => void): void;
export function lookupService(address: string, port: number, callback: (err: NodeJS.ErrnoException, hostname: string, service: string) => void): void;
export interface MxRecord {
priority: number;
exchange: string;

View File

@@ -1184,6 +1184,12 @@ namespace dns_tests {
const _family: number | undefined = family;
});
dns.lookupService("127.0.0.1", 0, (err, hostname, service) => {
const _err: NodeJS.ErrnoException = err;
const _hostname: string = hostname;
const _service: string = service;
});
dns.resolve("nodejs.org", (err, addresses) => {
const _addresses: string[] = addresses;
});

View File

@@ -2062,6 +2062,8 @@ declare module "dns" {
export function lookup(hostname: string, options: LookupOptions, callback: (err: NodeJS.ErrnoException, address: string | LookupAddress[], family: number) => void): void;
export function lookup(hostname: string, callback: (err: NodeJS.ErrnoException, address: string, family: number) => void): void;
export function lookupService(address: string, port: number, callback: (err: NodeJS.ErrnoException, hostname: string, service: string) => void): void;
export interface MxRecord {
priority: number;
exchange: string;

View File

@@ -2395,6 +2395,12 @@ namespace dns_tests {
const _family: number | undefined = family;
});
dns.lookupService("127.0.0.1", 0, (err, hostname, service) => {
const _err: NodeJS.ErrnoException = err;
const _hostname: string = hostname;
const _service: string = service;
});
dns.resolve("nodejs.org", (err, addresses) => {
const _addresses: string[] = addresses;
});

View File

@@ -2105,6 +2105,8 @@ declare module "dns" {
export function lookup(hostname: string, options: LookupOptions, callback: (err: NodeJS.ErrnoException, address: string | LookupAddress[], family: number) => void): void;
export function lookup(hostname: string, callback: (err: NodeJS.ErrnoException, address: string, family: number) => void): void;
export function lookupService(address: string, port: number, callback: (err: NodeJS.ErrnoException, hostname: string, service: string) => void): void;
export interface ResolveOptions {
ttl: boolean;
}

View File

@@ -2386,6 +2386,12 @@ namespace dns_tests {
const _family: number | undefined = family;
});
dns.lookupService("127.0.0.1", 0, (err, hostname, service) => {
const _err: NodeJS.ErrnoException = err;
const _hostname: string = hostname;
const _service: string = service;
});
dns.resolve("nodejs.org", (err, addresses) => {
const _addresses: string[] = addresses;
});

View File

@@ -21,6 +21,7 @@
// Bruno Scheufler <https://github.com/brunoscheufler>
// Hoàng Văn Khải <https://github.com/KSXGitHub>
// Lishude <https://github.com/islishude>
// Andrew Makarov <https://github.com/r3nya>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.1
@@ -2444,6 +2445,12 @@ declare module "dns" {
export function __promisify__(hostname: string, options?: LookupOptions | number): Promise<{ address: string | LookupAddress[], family?: number }>;
}
export function lookupService(address: string, port: number, callback: (err: NodeJS.ErrnoException, hostname: string, service: string) => void): void;
export namespace lookupService {
export function __promisify__(address: string, port: number): Promise<{ hostname: string, service: string }>;
}
export interface ResolveOptions {
ttl: boolean;
}

View File

@@ -3075,6 +3075,12 @@ namespace dns_tests {
const _family: number | undefined = family;
});
dns.lookupService("127.0.0.1", 0, (err, hostname, service) => {
const _err: NodeJS.ErrnoException = err;
const _hostname: string = hostname;
const _service: string = service;
});
dns.resolve("nodejs.org", (err, addresses) => {
const _addresses: string[] = addresses;
});

View File

@@ -24,6 +24,7 @@
// Hoàng Văn Khải <https://github.com/KSXGitHub>
// Alexander T. <https://github.com/a-tarasyuk>
// Lishude <https://github.com/islishude>
// Andrew Makarov <https://github.com/r3nya>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/** inspector module types */
@@ -2525,6 +2526,12 @@ declare module "dns" {
export function __promisify__(hostname: string, options?: LookupOptions | number): Promise<{ address: string | LookupAddress[], family?: number }>;
}
export function lookupService(address: string, port: number, callback: (err: NodeJS.ErrnoException, hostname: string, service: string) => void): void;
export namespace lookupService {
export function __promisify__(address: string, port: number): Promise<{ hostname: string, service: string }>;
}
export interface ResolveOptions {
ttl: boolean;
}

View File

@@ -3108,6 +3108,12 @@ namespace dns_tests {
const _family: number | undefined = family;
});
dns.lookupService("127.0.0.1", 0, (err, hostname, service) => {
const _err: NodeJS.ErrnoException = err;
const _hostname: string = hostname;
const _service: string = service;
});
dns.resolve("nodejs.org", (err, addresses) => {
const _addresses: string[] = addresses;
});