Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

dns-query

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dns-query - npm Package Compare versions

Comparing version 0.11.1 to 0.11.2

2

common.d.ts

@@ -139,4 +139,4 @@ export class AbortError extends Error {

export function toEndpoint (opts: EndpointOpts): Endpoint;
export function toEndpoint (opts: EndpointOpts | string): Endpoint;
export function parseEndpoint (input: string): Endpoint;
export function reduceError (input: any): any;
{
"name": "dns-query",
"version": "0.11.1",
"version": "0.11.2",
"description": "Node & Browser tested, Non-JSON DNS over HTTPS fetching with minimal dependencies.",

@@ -5,0 +5,0 @@ "main": "index.js",

# dns-query
Node & Browser tested, Non-JSON DNS over HTTPS (and DNS) fetching with minimal dependencies.
Low-level DNS requests using JavaScript in the Browser and Node.js.
> DNS over HTTPS (DoH) is protocol designed for performing remote Domain Name System
> resolution over HTTPS. Requests are made of HTTP to increase user security and privacy.
> See [DNS over HTTPS](https://en.wikipedia.org/wiki/DNS_over_HTTPS) for more
> information.
```js
import { query } from 'dns-query'
This package provides simple function to make DoH queries both in node and the browser.
const { answers, rcode } = await query(
{ question: { type: 'TXT', name: 'google.com' } },
{ endpoints: ['1.1.1.1'] }
)
```
#### Why use it?
- You get the **same API both on Node.js and the Browser** _(and React-Native)_.
- You need DNS information not exposed through high-level APIs _(eg. [`ttl` for `TXT` entries](#dns-support))_.
- You want to **use [DNS-over-HTTPS][]** _(DoH)_ servers.
[DNS-over-HTTPS]: https://en.wikipedia.org/wiki/DNS_over_HTTPS
#### What is in the package?
- [DoH][DNS-over-HTTPS] implementation in Node.js and the browser.
- Low level implementation of classic DNS in Node.js.
- ESM modules, CommonJS modules and typescript definitions.
- A list of well-known DoH endpoints.
- A parser for compact definitions of DoH and DNS endpoints.
- A command line tool to run DNS requests.
## Contents

@@ -42,3 +61,3 @@

/* (optional) */
retry: 3, // retries if a given endpoint fails; -1 = infinite retries; 0 = no retry
retries: 3, // retries if a given endpoint fails; -1 = infinite retries; 0 = no retry
timeout: 4000, // (default=30000) timeout for single requests

@@ -154,3 +173,4 @@ signal, // An AbortSignal to abort the request

The npm package comes with the list that was/is current on the time of it's publication.
`await wellknown.data()` will try to automatically download the list from [the dns-query website][].
By default `await wellknown.data()` will try to automatically download the newest list from [the dns-query website][]
and fall back to the list at publication if downloading fails.

@@ -167,4 +187,4 @@ [the dns-query website]: https://martinheidegger.github.io/dns-query/resolvers.json

options = ['@cloudflare', '@google', '@opendns'] // Use specific named endpoints
options = ['https://cloudflare-dns.com/dns-query']) // You can also
options = [{ host: 'cloudflare-dns.com' }] // Specify using properties
options = ['https://cloudflare-dns.com/dns-query'] // For a convenient API, you can also define regular endpoints...
options = [{ host: 'cloudflare-dns.com' }] // ... and bypass the well-known entries.
options = (endpoint) => endpoint.protocol === 'https:' // Use a filter against the well-known endpoints

@@ -171,0 +191,0 @@ options = Promise.resolve('doh') // The endpoints can also be a promise

@@ -68,3 +68,3 @@ import { SingleQuestionPacket, RecordClass } from '@leichtgewicht/dns-packet';

export function validateResponse <R>(res: R): R;
export function combineTxt(inputs: Uint8Array[]): Uint8Array;
export function combineTXT(inputs: Uint8Array[]): Uint8Array;

@@ -71,0 +71,0 @@ export interface WellknownData {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc