A simple Node.js package to fetch SSL, server and DNS information of a domain.
You can install the package using npm:
npm install domain-info-fetcher
import { fetchDomainInfo } from 'domain-info-fetcher';
async function main() {
const domainInfo = await fetchDomainInfo('example.com');
if (domainInfo) {
console.log('SSL Data:', domainInfo.sslData);
console.log('Server Data:', domainInfo.serverData);
console.log('DNS Data:', domainInfo.dnsData);
console.log('HTTP Status:', domainInfo.httpStatus);
} else {
console.error('Error fetching domain information');
}
}
main();
const { fetchDomainInfo } = require('domain-info-fetcher');
async function main() {
const domainInfo = await fetchDomainInfo('example.com');
if (domainInfo) {
console.log('SSL Data:', domainInfo.sslData);
console.log('Server Data:', domainInfo.serverData);
console.log('DNS Data:', domainInfo.dnsData);
console.log('HTTP Status:', domainInfo.httpStatus);
} else {
console.error('Error fetching domain information');
}
}
main();
Fetches the SSL, server and DNS information of the given domain.
Name | Type | Description |
---|---|---|
domain |
string | The domain to fetch the information for. |
Returns a promise that resolves to an object with the following properties:
Name | Description |
---|---|
sslData |
The SSL certificate data of the domain. |
serverData |
The server software used by the domain. (if available) |
dnsData |
The DNS records of the domain. |
httpStatus |
The HTTP status code of the domain. |
Returns undefined
if an error occurs while fetching the domain information.
The interface for the object returned by fetchDomainInfo
.
interface DomainInfo {
sslData: {
subject: { [key: string]: string | string[] };
issuer: { [key: string]: string | string[] };
valid: boolean;
validFrom: number;
validTo: number;
}
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;
}
Thank you for considering contributing to domain-info-fetcher! We welcome contributions from everyone, whether you're an experienced developer or just getting started with open source.
To contribute to this project, please follow these steps:
- Fork this repository to your own GitHub account.
- Clone your fork to your local machine.
- Create a new branch for your changes: git checkout -b my-branch-name.
- Make your changes and commit them with a descriptive message.
- Push your changes to your fork: git push -u origin my-branch-name.
- Open a pull request in this repository and describe the changes you made.
Please make sure to follow the existing code style as much as possible. We use TypeScript and adhere to the Airbnb JavaScript Style Guide with some minor modifications.
Please make sure to add appropriate tests for any new code you write, and ensure that all existing tests continue to pass. We use Jest as our testing framework.
Please make sure to update the README.md file with any necessary documentation for new features or changes to existing features.
This project adheres to the Contributor Covenant, a widely-used standard for community and open source projects. By participating in this project, you agree to abide by its code of conduct.
MIT