UNPKG

domain-info-fetcher

Version:

A powerful TypeScript/JavaScript tool for comprehensive domain analysis, featuring detailed WHOIS data with registration dates, registrars, and domain status. Offers SSL certificate extraction (with PEM support), DNS records, and server details. Includes

59 lines (58 loc) 1.8 kB
import * as dns from "dns"; import type { WhoisData } from "./src/whois"; interface SslData { subject: { [key: string]: string | string[]; }; issuer: { [key: string]: string | string[]; }; valid: boolean; validFrom: number; validTo: number; certificate?: string; intermediateCertificate?: string; rootCertificate?: string; details?: { issuer: string; subject: string; validFrom: Date; validTo: Date; }; } interface DomainInfo { sslData: SslData; serverData: string | undefined; dnsData: { A: string[]; CNAME: string | null; TXT: string[]; MX: Array<{ exchange: string; priority: number; }>; NS: string[]; SOA: dns.SoaRecord | null; } | undefined; httpStatus: number | undefined; whoisData?: WhoisData; } export interface RequestOptions { /** Timeout in milliseconds for HTTP requests */ timeout?: number; /** Custom headers to include in HTTP requests */ headers?: Record<string, string>; /** Whether to follow redirects in HTTP requests */ followRedirects?: boolean; /** Maximum number of redirects to follow */ maxRedirects?: number; } /** * Fetches SSL, server, and DNS data for the given domain. * @param domain The domain to fetch the information for. * @param options Optional request configuration * @returns A Promise that resolves to an object containing the SSL, server, and DNS data. */ export declare function fetchDomainInfo(domain: string, options?: RequestOptions): Promise<DomainInfo | undefined>; export type { WhoisData } from "./src/whois"; export { formatDomain, extractSubdomain, getRootDomain, checkDomain, dateToTimestamp, } from "./src/utils";