New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

fdoh

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fdoh - npm Package Compare versions

Comparing version 1.0.0 to 1.1.0

LICENSE

45

lib/fdoh.js

@@ -1,8 +0,14 @@

const Pkg = require('./../package.json');
require('es6-promise').polyfill();
require('isomorphic-fetch');
const IsIP = require('is-ip');
const Url = require ('url');
const Dohdec = require('dohdec');
const Fetch = require('node-fetch');
const Pkg = require('./../package.json');
const IsIP = require('is-ip');
const Url = require ('url');
const Qs = require('querystring');
const Fetch = fetch;
const CT_TYPE = 'application/dns-json';
const USER_AGENT = `${Pkg.name} v${Pkg.version}`;
const TYPES = {

@@ -14,3 +20,4 @@ DNS_PROVIDERS: {

DNS_OVER_HTTPS: {
GOOGLE: 'https://dns.google.com/resolve'
GOOGLE: 'https://dns.google.com/resolve',
CLOUDFLARE: 'https://cloudflare-dns.com/dns-query'
}

@@ -28,2 +35,23 @@ };

getDns () {
return async (name, opts) => {
opts = Object.assign({}, {
rrtype: 'A',
url: TYPES.DNS_OVER_HTTPS.CLOUDFLARE,
name: Qs.escape(name)
}, opts);
opts.rrtype = opts.rrtype.toUpperCase();
const lookup = await fetch(
`${opts.url}?ct=${CT_TYPE}&name=${opts.name}&type=${opts.rrtype}`, {
headers: {
'User-Agent': USER_AGENT
}
});
return lookup.json();
};
}
set () {

@@ -44,5 +72,6 @@ let ctx = this;

const getDns = ctx.getDns();
const _dnsRequest = (provider === TYPES.DNS_PROVIDERS.CLOUDFLARE) ?
await Dohdec(_url.hostname) :
await Dohdec(_url.hostname, {
await getDns(_url.hostname) :
await getDns(_url.hostname, {
url: TYPES.DNS_OVER_HTTPS[TYPES.DNS_PROVIDERS.GOOGLE]

@@ -49,0 +78,0 @@ });

9

package.json
{
"name": "fdoh",
"version": "1.0.0",
"version": "1.1.0",
"description": "Fetch DNS over HTTPS",

@@ -33,4 +33,7 @@ "main": "index.js",

"dependencies": {
"dohdec": "^1.0.0",
"is-ip": "^2.0.0"
"es6-promise": "^4.2.4",
"is-ip": "^2.0.0",
"isomorphic-fetch": "^2.2.1",
"querystring": "^0.2.0",
"url": "^0.11.0"
},

@@ -37,0 +40,0 @@ "devDependencies": {

@@ -9,3 +9,3 @@ # FDOH

The point of this utility is to be able to utilize node-fetch with your DNS queries running over HTTPS from Cloudflare [1.1.1.1](https://1.1.1.1) or Google DNS over HTTPS.
The point of this utility is to be able to utilize fetch with your DNS queries running over HTTPS from Cloudflare [1.1.1.1](https://1.1.1.1) or Google DNS over HTTPS.

@@ -39,6 +39,1 @@ ### Fetch Example

### Dependencies
- [dohdec](https://github.com/hildjj/dohdec)
- [is-ip](https://github.com/sindresorhus/is-ip)
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