From 1e8924d5ac8552e0fb71f62b3eee94651a146c05 Mon Sep 17 00:00:00 2001 From: Derrick Hammer Date: Sun, 9 Apr 2023 14:15:40 -0400 Subject: [PATCH] *add registerResolver method --- src/index.ts | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/src/index.ts b/src/index.ts index 01a2dbe..0d510e0 100644 --- a/src/index.ts +++ b/src/index.ts @@ -9,12 +9,6 @@ import { createModule, ResolverModule } from "./module.js"; const MODULE = "vAA-phmM1ztqu8zGBKF2nM3b8N_IQGWlB6J_doi2FhqS-A"; export class DnsClient extends Client { - public async register(): Promise { - return this.callModuleReturn("register"); - } - public async clear(): Promise { - return this.callModuleReturn("clear"); - } get resolvers(): Promise> { return this.callModuleReturn("getResolvers").then((resolvers: string[]) => { return new Set( @@ -24,6 +18,21 @@ export class DnsClient extends Client { ); }); } + + public async register(): Promise { + return this.callModuleReturn("register"); + } + + public async registerResolver(module: string): Promise { + const bag = await this.loadBound(module); + const ret = await bag.callModule("register"); + return ret[0]; + } + + public async clear(): Promise { + return this.callModuleReturn("clear"); + } + public async resolve( domain: string, options: ResolverOptions = { type: DNS_RECORD_TYPE.CONTENT },