0.1.3 • Published 11 months ago

node-secure-dns v0.1.3

Weekly downloads
-
License
-
Repository
github
Last release
11 months ago

Node-Secure-DNS

Node-Secure-DNS is a library written in Node.js that resolves domain names using DNS over HTTPS (DoH). This allows for more secure DNS resolution in environments where DNS requests may be subject to tampering or monitoring.

English | 中文

Key Features

Supports custom DNS over HTTPS servers. Enables or disables the DoH feature. Handles the resolution of IPv4 and IPv6.

Installation

npm install node-secure-dns

How to use

import DohResolver from "node-secure-dns";

const dohResolver = new DohResolver();

// Set DoH Server
dohResolver.setDOHResolverServer([
  "https://cloudflare-dns.com/dns-query",
  "https://dns.google/resolve",
]);

// Enable DoH
dohResolver.setDOHEnable(true);

// Resolve hostname
const result = await dohResolver.resolver("example.com");
console.log(result); // Print out the resolution result

// Resolve URL
const resultUrl = await dohResolver.resolverUrl("http://example.com/path");
console.log(resultUrl); // Print out the resolved URL

// Resolve IPv6 URL
const resultUrl6 = await dohResolver.resolverUrl6("http://example.com/path");
console.log(resultUrl6); // Print out the resolved URL

Feedback

If you have any questions or suggestions, feel free to raise an Issue or Pull Request.

0.1.3

11 months ago

0.0.4

12 months ago