kernel-dns-client/src/index.ts

29 lines
897 B
TypeScript
Raw Normal View History

2023-02-19 21:20:38 +00:00
import { Client, factory } from "@lumeweb/libkernel-universal";
2023-02-19 21:42:03 +00:00
import { DNS_RECORD_TYPE, ResolverOptions } from "@lumeweb/libresolver";
2023-02-19 21:20:38 +00:00
const MODULE = "PACYNuYbp_5hgCjMK16EGcytB9QCxDLe4_uitahwePdeaA";
2022-07-20 11:11:06 +00:00
2023-02-19 21:20:38 +00:00
export class DnsClient extends Client {
public async register(): Promise<void> {
return this.callModuleReturn("register");
2022-08-14 10:54:18 +00:00
}
2023-02-19 21:20:38 +00:00
public async clear(): Promise<void> {
return this.callModuleReturn("clear");
2022-08-14 10:54:18 +00:00
}
2023-02-19 21:35:19 +00:00
public async getResolvers(): Promise<string[]> {
2023-02-19 21:34:18 +00:00
return this.callModuleReturn("getResolvers");
2022-08-14 10:54:18 +00:00
}
2023-02-19 21:20:38 +00:00
public async ready(): Promise<void> {
return this.callModuleReturn("ready");
2022-08-18 23:45:31 +00:00
}
2023-02-19 21:42:03 +00:00
public async resolve(
domain: string,
options: ResolverOptions = { type: DNS_RECORD_TYPE.CONTENT },
bypassCache: boolean = false
): Promise<void> {
return this.callModuleReturn("ready");
}
2022-08-18 23:45:31 +00:00
}
2023-02-19 21:20:38 +00:00
export const createClient = factory<DnsClient>(DnsClient, MODULE);