Compare commits
46 Commits
v0.0.1
...
v0.0.2-dev
Author | SHA1 | Date |
---|---|---|
semantic-release-bot | 4bb0959bf1 | |
Derrick Hammer | c762506f13 | |
Derrick Hammer | c9c7bfe498 | |
Derrick Hammer | f1bbbf540d | |
Derrick Hammer | 1e8924d5ac | |
Derrick Hammer | 7c3da38a15 | |
Derrick Hammer | 360beb9d69 | |
Derrick Hammer | c21e6910de | |
Derrick Hammer | 44cdff4665 | |
Derrick Hammer | 614dc20900 | |
Derrick Hammer | f01738940f | |
Derrick Hammer | 8bd4e71424 | |
Derrick Hammer | 248d99f9ba | |
Derrick Hammer | b094b6ffe5 | |
Derrick Hammer | cf6435ef1e | |
Derrick Hammer | 827505438d | |
Derrick Hammer | 2bf62cbd3e | |
Derrick Hammer | dd1b25aa30 | |
Derrick Hammer | f6a7322347 | |
Derrick Hammer | 10e01f44fa | |
Derrick Hammer | 27dba64c45 | |
Derrick Hammer | d2735c5470 | |
Derrick Hammer | 63cec2129f | |
Derrick Hammer | a0800a0feb | |
Derrick Hammer | 5838b30141 | |
Derrick Hammer | 69638955f1 | |
Derrick Hammer | 63cf33e617 | |
Derrick Hammer | b856cf16d2 | |
Derrick Hammer | 221ebe70c0 | |
Derrick Hammer | e3697e8f5d | |
Derrick Hammer | 096da60801 | |
Derrick Hammer | 91b1c89bc4 | |
Derrick Hammer | 3f96c6d1de | |
Derrick Hammer | 5a2c703afe | |
Derrick Hammer | 19caf515d5 | |
Derrick Hammer | 2f0e1fa4b8 | |
Derrick Hammer | 109ac99045 | |
Derrick Hammer | 32e2edaf6b | |
Derrick Hammer | f3fb63d2b8 | |
Derrick Hammer | b3942d8df8 | |
Derrick Hammer | 52821f43b6 | |
Derrick Hammer | 1ba24bee76 | |
Derrick Hammer | 47dc0be026 | |
Derrick Hammer | ac9cc4cf0d | |
Derrick Hammer | 25cefe8485 | |
Derrick Hammer | d3be614120 |
|
@ -0,0 +1,13 @@
|
|||
name: Build/Publish
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- develop
|
||||
- develop-*
|
||||
|
||||
jobs:
|
||||
main:
|
||||
uses: lumeweb/github-node-deploy-workflow/.github/workflows/main.yml@master
|
||||
secrets: inherit
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"preset": [
|
||||
"@lumeweb/node-library-preset"
|
||||
]
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
## [0.0.2-develop.1](https://git.lumeweb.com/LumeWeb/kernel-dns-client/compare/v0.0.1...v0.0.2-develop.1) (2023-07-05)
|
||||
|
||||
|
||||
### Reverts
|
||||
|
||||
* Revert "*Update register to use loadBound" ([b856cf1](https://git.lumeweb.com/LumeWeb/kernel-dns-client/commit/b856cf16d2e4e70b9e4e6d6ff6d6f4351a68177e))
|
2
LICENSE
2
LICENSE
|
@ -1,6 +1,6 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) 2022 Lume Web
|
||||
Copyright (c) 2022 Hammer Technologies LLC
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,30 @@
|
|||
{
|
||||
"name": "@lumeweb/kernel-dns-client",
|
||||
"version": "0.0.2-develop.1",
|
||||
"type": "module",
|
||||
"main": "lib/index.js",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "gitea@git.lumeweb.com:LumeWeb/kernel-dns-client.git"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@lumeweb/node-library-preset": "^0.2.7",
|
||||
"presetter": "*"
|
||||
},
|
||||
"readme": "ERROR: No README data found!",
|
||||
"scripts": {
|
||||
"prepare": "presetter bootstrap",
|
||||
"build": "run build",
|
||||
"semantic-release": "semantic-release"
|
||||
},
|
||||
"dependencies": {
|
||||
"@lumeweb/libkernel": "^0.1.0-develop.14",
|
||||
"@lumeweb/libresolver": "^0.0.2-develop.1"
|
||||
},
|
||||
"files": [
|
||||
"lib"
|
||||
],
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,46 @@
|
|||
import { Client, factory } from "@lumeweb/libkernel/module";
|
||||
import {
|
||||
DNS_RECORD_TYPE,
|
||||
DNSResult,
|
||||
ResolverOptions,
|
||||
} from "@lumeweb/libresolver";
|
||||
import { createModule, ResolverModule } from "./module.js";
|
||||
|
||||
const MODULE = "zduJC2T9pCyTnrYvEacy64LAufhjfpQdpz5sweUgDdGqy4u18LK6yvKLqM";
|
||||
|
||||
export class DnsClient extends Client {
|
||||
get resolvers(): Promise<Set<ResolverModule>> {
|
||||
return this.callModuleReturn("getResolvers").then((resolvers: string[]) => {
|
||||
return new Set(
|
||||
resolvers.map((resolver: string): ResolverModule => {
|
||||
return createModule(resolver, this);
|
||||
}),
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
public async register(): Promise<void> {
|
||||
return this.callModuleReturn("register");
|
||||
}
|
||||
|
||||
public async registerResolver(module: string): Promise<void> {
|
||||
const bag = await this.getBound(module);
|
||||
const ret = await bag.callModule("register");
|
||||
return ret[0];
|
||||
}
|
||||
|
||||
public async clear(): Promise<void> {
|
||||
return this.callModuleReturn("clear");
|
||||
}
|
||||
|
||||
public async resolve(
|
||||
domain: string,
|
||||
options: ResolverOptions = { type: DNS_RECORD_TYPE.CONTENT },
|
||||
bypassCache: boolean = false,
|
||||
): Promise<DNSResult> {
|
||||
return this.callModuleReturn("resolve", { domain, options, bypassCache });
|
||||
}
|
||||
}
|
||||
|
||||
export const createClient = factory<DnsClient>(DnsClient, MODULE);
|
||||
export * from "./module.js";
|
|
@ -0,0 +1,52 @@
|
|||
import { Client, factory } from "@lumeweb/libkernel/module";
|
||||
import { DnsClient } from "./index.js";
|
||||
import {
|
||||
DNSResult,
|
||||
resolverError,
|
||||
ResolverOptions,
|
||||
} from "@lumeweb/libresolver";
|
||||
|
||||
export class ResolverModule extends Client {
|
||||
private domain: string;
|
||||
|
||||
constructor(module: string, domain: string, resolver?: DnsClient) {
|
||||
super(module);
|
||||
this._resolver = resolver;
|
||||
this.domain = domain;
|
||||
}
|
||||
|
||||
private _resolver?: DnsClient;
|
||||
|
||||
get resolver(): DnsClient {
|
||||
return this._resolver as DnsClient;
|
||||
}
|
||||
|
||||
set resolver(value: DnsClient) {
|
||||
this._resolver = value;
|
||||
}
|
||||
|
||||
async resolve(
|
||||
domain: string,
|
||||
options: ResolverOptions,
|
||||
bypassCache: boolean,
|
||||
): Promise<DNSResult> {
|
||||
try {
|
||||
return this.callModuleReturn("resolve", {
|
||||
domain,
|
||||
options,
|
||||
bypassCache,
|
||||
});
|
||||
} catch (e) {
|
||||
return resolverError(e as Error);
|
||||
}
|
||||
}
|
||||
async getSupportedTlds(): Promise<string[]> {
|
||||
return this.callModuleReturn("getSupportedTlds");
|
||||
}
|
||||
}
|
||||
|
||||
export const createModule = (
|
||||
module: string,
|
||||
client: DnsClient,
|
||||
): ResolverModule =>
|
||||
factory<ResolverModule>(ResolverModule, module)(module, client);
|
Loading…
Reference in New Issue