*Add dist
This commit is contained in:
parent
c4498d812d
commit
16e94b5737
|
@ -0,0 +1,3 @@
|
|||
export * from "./types.js";
|
||||
export * from "./resolverModule.js";
|
||||
//# sourceMappingURL=index.d.ts.map
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,qBAAqB,CAAC"}
|
|
@ -0,0 +1,2 @@
|
|||
export * from "./types.js";
|
||||
export * from "./resolverModule.js";
|
|
@ -0,0 +1,13 @@
|
|||
import type { DNSResult, ResolverOptions } from "./types.js";
|
||||
export default interface ResolverModule {
|
||||
constructor(resolver: any): void;
|
||||
resolve(domain: string, options: ResolverOptions, bypassCache: boolean): Promise<DNSResult>;
|
||||
}
|
||||
export declare abstract class AbstractResolverModule {
|
||||
protected resolver: any;
|
||||
constructor(resolver: any);
|
||||
abstract resolve(input: string, options: ResolverOptions, force: boolean): Promise<DNSResult>;
|
||||
getSupportedTlds(): string[];
|
||||
isTldSupported(domain: string): boolean;
|
||||
}
|
||||
//# sourceMappingURL=resolverModule.d.ts.map
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"resolverModule.d.ts","sourceRoot":"","sources":["../src/resolverModule.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAG7D,MAAM,CAAC,OAAO,WAAW,cAAc;IACrC,WAAW,CAAC,QAAQ,EAAE,GAAG,GAAG,IAAI,CAAC;IAEjC,OAAO,CACL,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,eAAe,EACxB,WAAW,EAAE,OAAO,GACnB,OAAO,CAAC,SAAS,CAAC,CAAC;CACvB;AAED,8BAAsB,sBAAsB;IAC1C,SAAS,CAAC,QAAQ,EAAE,GAAG,CAAC;gBAEZ,QAAQ,EAAE,GAAG;IAIzB,QAAQ,CAAC,OAAO,CACd,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,eAAe,EACxB,KAAK,EAAE,OAAO,GACb,OAAO,CAAC,SAAS,CAAC;IAErB,gBAAgB,IAAI,MAAM,EAAE;IAI5B,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO;CAGxC"}
|
|
@ -0,0 +1,13 @@
|
|||
import { getTld } from "./util.js";
|
||||
export class AbstractResolverModule {
|
||||
resolver;
|
||||
constructor(resolver) {
|
||||
this.resolver = resolver;
|
||||
}
|
||||
getSupportedTlds() {
|
||||
return [];
|
||||
}
|
||||
isTldSupported(domain) {
|
||||
return this.getSupportedTlds().includes(getTld(domain));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
export interface ResolverOptions {
|
||||
type: any;
|
||||
customType?: string;
|
||||
records: any[];
|
||||
options: any;
|
||||
}
|
||||
export interface DNSResult {
|
||||
records: any[];
|
||||
error?: Error;
|
||||
}
|
||||
export interface DNSRecord {
|
||||
type: string;
|
||||
customType?: string;
|
||||
value: string;
|
||||
}
|
||||
declare const DNS_RECORD_TYPE: {
|
||||
A: string;
|
||||
CNAME: string;
|
||||
NS: string;
|
||||
CONTENT: string;
|
||||
TEXT: string;
|
||||
ALL: string;
|
||||
CUSTOM: string;
|
||||
};
|
||||
export { DNS_RECORD_TYPE };
|
||||
//# sourceMappingURL=types.d.ts.map
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,GAAG,CAAC;IACV,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,GAAG,EAAE,CAAC;IACf,OAAO,EAAE,GAAG,CAAC;CACd;AAED,MAAM,WAAW,SAAS;IACxB,OAAO,EAAE,GAAG,EAAE,CAAC;IACf,KAAK,CAAC,EAAE,KAAK,CAAC;CACf;AAED,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,QAAA,MAAM,eAAe;;;;;;;;CAQpB,CAAC;AAIF,OAAO,EAAE,eAAe,EAAE,CAAC"}
|
|
@ -0,0 +1,11 @@
|
|||
const DNS_RECORD_TYPE = {
|
||||
A: "A",
|
||||
CNAME: "CNAME",
|
||||
NS: "NS",
|
||||
CONTENT: "CONTENT",
|
||||
TEXT: "TEXT",
|
||||
ALL: "ALL",
|
||||
CUSTOM: "CUSTOM",
|
||||
};
|
||||
Object.freeze(DNS_RECORD_TYPE);
|
||||
export { DNS_RECORD_TYPE };
|
|
@ -0,0 +1,5 @@
|
|||
export declare function getTld(domain: string): string;
|
||||
export declare function getSld(domain: string): string;
|
||||
export declare function isIp(ip: string): boolean;
|
||||
export declare function isDomain(domain: string): boolean;
|
||||
//# sourceMappingURL=util.d.ts.map
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../src/util.ts"],"names":[],"mappings":"AAAA,wBAAgB,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAM7C;AAED,wBAAgB,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAS7C;AAED,wBAAgB,IAAI,CAAC,EAAE,EAAE,MAAM,WAI9B;AAED,wBAAgB,QAAQ,CAAC,MAAM,EAAE,MAAM,WAItC"}
|
|
@ -0,0 +1,21 @@
|
|||
export function getTld(domain) {
|
||||
if (domain.includes(".")) {
|
||||
domain = domain.split(".")[domain.split(".").length - 1];
|
||||
}
|
||||
return domain;
|
||||
}
|
||||
export function getSld(domain) {
|
||||
if (domain.includes(".")) {
|
||||
domain = domain
|
||||
.split(".")
|
||||
.slice(0, domain.split(".").length - 1)
|
||||
.join(".");
|
||||
}
|
||||
return domain;
|
||||
}
|
||||
export function isIp(ip) {
|
||||
return /^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/.test(ip);
|
||||
}
|
||||
export function isDomain(domain) {
|
||||
return /(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z0-9][a-z0-9-]{0,61}[a-z0-9]/.test(domain);
|
||||
}
|
Loading…
Reference in New Issue