New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

jsdns

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jsdns

A simple DNS module for looking up hostnames + the total time taking to lookup the address in ms.

latest
npmnpm
Version
0.0.4
Version published
Maintainers
1
Created
Source

JSdns

npm version

What?

JSdns is a simple client-side DNS resolver. Supply it with a hostname and it will resolve it to its IPv4 address and FQDN along with the amount of time it took in milliseconds (ms).

Why?

I'm new to the world of JavaScript, learning more and more each day. I'm currently a Jnr DevOps Engineer and this is a way for me to learn and also provide a practical module to use.

How?

  • Install JSdns by running:
npm install jsdns --save
  • Whatever host you want to lookup (google.co.uk for example), change the 'host' variable inside of the ' ' quotes.
...
var host = 'www.google.co.uk'; //This is the host you want to look up.
...
  • The output should be pretty readable. IP addresses and hostnames are clearly indicated as seen below:
1 Jan 00:01:01 - IPv4 Address: 216.58.214.3  
1 Jan 00:01:01 - Reverse Lookup for 216.58.214.3: ["lhr26s05-in-f3.1e100.net","lhr26s05-in-f3.1e100.net"]  
1 Jan 00:01:01 - DNS Lookup of www.google.co.uk took 24ms 
  • JSdns now uses dnscache to wrap the dns module methods and provide a caching layer in between. The settings can be adjusted to suit your needs:
var dns = require('dns');
var util = require('util');
    dnscache = require('dnscache')({
        "enable": true,
        "ttl": 300,
        "cachesize": 1000
});
...

Keywords

DNS

FAQs

Package last updated on 25 Aug 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts