feat: add ready method to AbstractResolverModule

This commit is contained in:
Derrick Hammer 2023-07-15 04:29:02 -04:00
parent 17e840e859
commit 8be5af2f45
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 12 additions and 3 deletions

View File

@ -3,26 +3,33 @@ import { getTld, isPromise } from "./util.js";
declare class ResolverRegistry { declare class ResolverRegistry {
get resolvers(): Set<ResolverModule> | Promise<Set<ResolverModule>>; get resolvers(): Set<ResolverModule> | Promise<Set<ResolverModule>>;
resolve( resolve(
domain: string, domain: string,
options?: ResolverOptions, options?: ResolverOptions,
bypassCache?: boolean bypassCache?: boolean,
): Promise<DNSResult>; ): Promise<DNSResult>;
register(resolver: ResolverModule): void; register(resolver: ResolverModule): void;
clear(): void; clear(): void;
} }
export interface ResolverModule { export interface ResolverModule {
get resolver(): ResolverRegistry; get resolver(): ResolverRegistry;
set resolver(value: ResolverRegistry); set resolver(value: ResolverRegistry);
resolve( resolve(
domain: string, domain: string,
options: ResolverOptions, options: ResolverOptions,
bypassCache: boolean bypassCache: boolean,
): Promise<DNSResult>; ): Promise<DNSResult>;
getSupportedTlds(): string[]; getSupportedTlds(): string[];
getSupportedTlds(): Promise<string[]>; getSupportedTlds(): Promise<string[]>;
getSupportedTlds(): any; getSupportedTlds(): any;
} }
@ -45,7 +52,7 @@ export abstract class AbstractResolverModule {
abstract resolve( abstract resolve(
domain: string, domain: string,
options: ResolverOptions, options: ResolverOptions,
bypassCache: boolean bypassCache: boolean,
): Promise<DNSResult>; ): Promise<DNSResult>;
getSupportedTlds(): string[]; getSupportedTlds(): string[];
@ -66,4 +73,6 @@ export abstract class AbstractResolverModule {
return (supported as string[]).includes(getTld(domain)); return (supported as string[]).includes(getTld(domain));
} }
abstract ready(): Promise<void>;
} }