dns-over-https

0.1.0 • Public • Published

dns-over-https

Build Status npm version Download Total

Resolve DNS records via the Google Public DNS HTTPS API

Google Public DNS docs

Installation

yarn add dns-over-https

Usage

import resolveRecord from 'dns-over-https';
import caw from 'caw';
 
(async () => {
  const a = await resolveRecord('google.com'); // resolves for A records
 
  const aaaa = await resolveRecord('google.com', 'AAAA'); // resolves for AAAA records
 
  const txt = await resolveRecord('google.com', 'TXT', {
    disableDNSSEC: true,
    EDNSClientSubnet: '0.0.0.0/0',
 
    // allows you to pass additional request headers
    headers: {
      'user-agent': 'custom'
    },
 
    // allows you to pass additional request options
    requestOptions: {
      agent: caw({ protocol: 'https' }) // enables proxy support
    }
  });
})();

Package Sidebar

Install

npm i dns-over-https

Weekly Downloads

4

Version

0.1.0

License

MIT

Last publish

Collaborators

  • buschtoens