-
Notifications
You must be signed in to change notification settings - Fork 10
dWeb DNS Requests
Jared Rice Sr edited this page Jul 1, 2018
·
1 revision
dWeb Library For Making DNS Requests.
npm install @distdns/socket
const dWebDNS = require('@distdns/socket')
const dnsSocket = dWebDNS()
socket.query({
questions: [{
type: 'A',
name: 'google.com'
}]
}, 53, '8.8.8.8', (err, res) => {
console.log(err, res) // prints the A record for google.com
})
Create a new DNS socket instance. The options
object includes:
-
retries
Number: Number of total query attempts made duringtimeout
. Default: 5. -
socket
Object: A custom dGram socket. Default: A'udp4'
socket. -
timeout
Number: Total timeout in milliseconds after which a'timeout'
event is emitted. Default: 7500.
Emitted when a DNS query is received.
Emitted when a DNS response is received.
Send a DNS query. If host is omitted it defaults to localhost. When the remote replies the callback is called with (err, response, query)
and an response is emitted as well. If the query times out the callback is called with an error.
Returns the query id
Send a response to a query.
Cancel a query
Bind the underlying UDP socket to a specific port.
Destroy the socket.
Number of inflight queries.