Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kazu69/domain-info
Simple domain information tool
https://github.com/kazu69/domain-info
domain nodejs punycode whois
Last synced: 19 days ago
JSON representation
Simple domain information tool
- Host: GitHub
- URL: https://github.com/kazu69/domain-info
- Owner: kazu69
- Created: 2015-12-29T02:58:04.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2023-01-05T16:13:38.000Z (almost 2 years ago)
- Last Synced: 2024-10-12T17:58:16.800Z (25 days ago)
- Topics: domain, nodejs, punycode, whois
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/domain-info
- Size: 1.05 MB
- Stars: 14
- Watchers: 4
- Forks: 4
- Open Issues: 14
-
Metadata Files:
- Readme: Readme.md
Awesome Lists containing this project
README
# domain-info
[![Build Status](https://travis-ci.org/kazu69/domain-info.svg?branch=master)](https://travis-ci.org/kazu69/domain-info)
Simple domain infomation client.
## install
```sh
npm install domain-info
```## Usage
```js
const domain = require('domain-info');
const callback = (error, data) => {
console.log(data);
}domain.groper('github.com', { type: ['A'] }, callback);
// data = { A:
// [ { name: 'github.com',
// type: 1,
// class: 1,
// ttl: 20,
// address: '192.30.252.130' } ]
// }
```This module return Promise object without callback function.
```js
const domain = require('domain-info');let promise = domain.groper('github.com', { type: ['A'] });
promise.then(data => {
// data = { A:
// [ { name: 'github.com',
// type: 1,
// class: 1,
// ttl: 20,
// address: '192.30.252.130' } ]
// }
});
```## API
### groper(domain, [type, option, callback])
Dig command.
Option is [node-dns](https://github.com/tjfontaine/node-dns#request) Request method option.
```type``` is resource record type like ```A```, ```MX```.```js
const domain = require('domain-info');
domain.groper(
'example.com',
['A', 'NS', 'MX'],
{
server: { address: '8.8.8.8', port: 53, type: 'udp' },
timeout: 1000
},
callback
);
```### reverse(ip_address, [callback])
Reverse DNS lookup.
```js
const domain = require('domain-info');
domain.reverse('8.8.8.8', (error, data) => {
// data => [ 'google-public-dns-a.google.com' ]
});
```### whois(domain, [option, callback])
Whois command.
Option has `server`, `port`, `recordType` properties.
server has default value `TLD.whois-servers.net`.
port has default value `43`
recordType has default value `domain````js
const options = {
server: 'com.whois-servers.net',
port: 43,
recordType: 'domain'
}
const domain = require('domain-info');
domain.whois('example.com', (error, data) => {
// data has whois results.
});
```### punycode(ascii_or_unicode)
Convert ascii domain to uicode.
Also convert unicode domain to ascii in reverse.```js
const domain = require('domain-info');domain.punycode('日本語.jp');
// => xn--wgv71a119e.jpdomain.punycode('xn--wgv71a119e.jp');
// => 日本語.jp
```### whois(domain, [options, callback])
Whois
```js
const domain = require('domain-info');
domain.whois('a.ns.apple.com', (error, data) => {
console.log(data);
});
```## Related
[domain-info-cli](https://www.npmjs.com/package/domain-info-cli)
## License
MIT © kazu69