*Update dist
This commit is contained in:
parent
aa3502bf71
commit
223da6b2f0
|
@ -4,7 +4,7 @@ export interface ResolverOptions {
|
||||||
options?: any;
|
options?: any;
|
||||||
}
|
}
|
||||||
export interface DNSResult {
|
export interface DNSResult {
|
||||||
records: any[];
|
records: DNSRecord[];
|
||||||
error?: Error;
|
error?: Error;
|
||||||
}
|
}
|
||||||
export interface DNSRecord {
|
export interface DNSRecord {
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,GAAG,CAAC;CACf;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;AACD,QAAA,MAAM,eAAe;;;;;;;;;CASpB,CAAC;AAIF,OAAO,EAAE,eAAe,EAAE,CAAC"}
|
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,GAAG,CAAC;CACf;AAED,MAAM,WAAW,SAAS;IACxB,OAAO,EAAE,SAAS,EAAE,CAAC;IACrB,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;AACD,QAAA,MAAM,eAAe;;;;;;;;;CASpB,CAAC;AAIF,OAAO,EAAE,eAAe,EAAE,CAAC"}
|
|
@ -1,5 +1,9 @@
|
||||||
|
import { DNSRecord, DNSResult } from "./types.js";
|
||||||
export declare function getTld(domain: string): string;
|
export declare function getTld(domain: string): string;
|
||||||
export declare function getSld(domain: string): string;
|
export declare function getSld(domain: string): string;
|
||||||
export declare function isIp(ip: string): boolean;
|
export declare function isIp(ip: string): boolean;
|
||||||
export declare function isDomain(domain: string): boolean;
|
export declare function isDomain(domain: string): boolean;
|
||||||
|
export declare function resolverEmptyResponse(): DNSResult;
|
||||||
|
export declare function resolverError(e: Error | string): DNSResult;
|
||||||
|
export declare function resolveSuccess(records: DNSRecord[]): DNSResult;
|
||||||
//# sourceMappingURL=util.d.ts.map
|
//# sourceMappingURL=util.d.ts.map
|
||||||
|
|
|
@ -1 +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"}
|
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../src/util.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAElD,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;AACD,wBAAgB,qBAAqB,IAAI,SAAS,CAIjD;AAED,wBAAgB,aAAa,CAAC,CAAC,EAAE,KAAK,GAAG,MAAM,GAAG,SAAS,CAQ1D;AAED,wBAAgB,cAAc,CAAC,OAAO,EAAE,SAAS,EAAE,GAAG,SAAS,CAI9D"}
|
|
@ -19,3 +19,22 @@ export function isIp(ip) {
|
||||||
export function isDomain(domain) {
|
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);
|
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);
|
||||||
}
|
}
|
||||||
|
export function resolverEmptyResponse() {
|
||||||
|
return {
|
||||||
|
records: [],
|
||||||
|
};
|
||||||
|
}
|
||||||
|
export function resolverError(e) {
|
||||||
|
if (!(e instanceof Error)) {
|
||||||
|
e = new Error(e);
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
records: [],
|
||||||
|
error: e,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
export function resolveSuccess(records) {
|
||||||
|
return {
|
||||||
|
records,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue