feat: add ready method to AbstractResolverModule
This commit is contained in:
parent
17e840e859
commit
8be5af2f45
|
@ -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>;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue