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