Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/alsotang/nslookup
https://github.com/alsotang/nslookup
Last synced: 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/alsotang/nslookup
- Owner: alsotang
- Created: 2015-08-05T03:59:35.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2017-05-17T08:17:08.000Z (over 7 years ago)
- Last Synced: 2024-08-08T15:39:01.578Z (5 months ago)
- Language: JavaScript
- Size: 5.86 KB
- Stars: 27
- Watchers: 3
- Forks: 8
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# nslookup
[![Build Status](https://travis-ci.org/alsotang/nslookup.svg?branch=master)](https://travis-ci.org/alsotang/nslookup)
## install
`npm install nslookup`
## quick example
```js
nslookup('fxck.it')
.server('8.8.8.8') // default is 8.8.8.8
.type('mx') // default is 'a'
.timeout(10 * 1000) // default is 3 * 1000 ms
.end(function (err, addrs) {
console.log(addrs); // => ['66.6.44.4']
});
```## API
### nslookup
`nslookup(domain)` and chain with methods
`nslookup(domain, function (err, addrs))`. Simply query `a` type and use `8.8.8.8`.
### .server(server)
String or Object
String: `.server(8.8.8.8)`
Object: `.server({ address: '8.8.8.8', port: 53, type: 'udp' })`
### .type(type)
here can be `mx` or `a` or `ns`
e.g.: `.type('ns')`
### .timeout(timeout)
default is 3 * 1000 ms.
if timeout, then the `NSLookupTimeoutError` error would be callback.
`.timeout(3 * 1000)`
### .end(callback)
`callback = function (err, addrs)`
`addrs` is an Array
### TODO