2022-07-20 11:11:06 +00:00
|
|
|
const DNS_MODULE = "AQBLKpieqOfKVRgMa8k45P4S_ILYgJmswVso4vT1qzoG-A";
|
|
|
|
let callModule, connectModule;
|
2022-07-21 17:22:02 +00:00
|
|
|
async function loadLibs() {
|
|
|
|
if (callModule && connectModule) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (typeof window !== "undefined" && window?.document) {
|
|
|
|
const pkg = (await import("libkernel"));
|
|
|
|
callModule = pkg.callModule;
|
|
|
|
connectModule = pkg.connectModule;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
const pkg = (await import("libkmodule"));
|
|
|
|
callModule = pkg.callModule;
|
|
|
|
connectModule = pkg.connectModule;
|
|
|
|
}
|
2022-07-20 11:11:06 +00:00
|
|
|
}
|
|
|
|
export async function resolve(domain, params, force = false) {
|
2022-07-21 17:22:02 +00:00
|
|
|
await loadLibs();
|
2022-07-20 11:11:06 +00:00
|
|
|
const [resp, err] = await callModule(DNS_MODULE, "resolve", { domain, params, force });
|
|
|
|
if (err) {
|
|
|
|
throw new Error(err);
|
|
|
|
}
|
|
|
|
return resp;
|
|
|
|
}
|