Home > Uncategorized > Make #DNS queries using client side #Javascript using DNS-JS

Make #DNS queries using client side #Javascript using DNS-JS

what-is-dns

DNS is a very simple protocol, which runs over UDP port 53. It’s primary role is to determine the IP address that is related to a domain. So for example, DNS-JS.com resolves to 95.154.244.106, but it’s also used to determine what server handles the email for a given domain, and lots of other ‘glue’ that holds the internet together.

The issue is, you can’t make a low level packet requests using Javascript alone, so this library helps you make DNS requests using Browser-side javascript.

So, a simple example would be;

DNS.Query(“dns-js.com”,
DNS.QueryType.A,
function(data) {
console.log(data);
});

Which makes a DNS “A” type request for “dns-js.com”, and will return the result as a parameter to your callback function, in this case as “data”, and written to the console.

The full list of Query types are as follows;

A : Address Mapping record
NS : Name Server record
MD : A mail destination (OBSOLETE - use MX)
MF : A mail forwarder (OBSOLETE - use MX)
CNAME : Canonical Name record
SOA : Marks the start of a zone of authority
MB : A mailbox domain name (EXPERIMENTAL)
MG : A mail group member (EXPERIMENTAL)
MR : A mailbox rename domain name (EXPERIMENTAL)
NULL : A Null resource record (EXPERIMENTAL)
WKS : A well known service description
PTR : Reverse-lookup Pointer record
HINFO : Host information
MINFO : Mailbox or mail list information
MX : Mail exchanger record
TXT : Text Record 
RP : Responsible Person
AFSDB : AFS Data Base location
AAAA : IP Version 6 Address record
SRV : Service Location
SSHFP : A SSH Fingerprint resource record
RRSIG : RRSIG rfc3755
AXFR : DNS zone transfer request.
ANY : Generic any query 
URI : A Uniform Resource Identifier (URI) resource record
CAA : A certification authority authorization

and, you can see other demos at https://www.dns-js.com/

Advertisements
Categories: Uncategorized
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: