@dnspect/doh-worker
TypeScript icon, indicating that this package has built-in type declarations

0.1.0 • Public • Published

DNS over HTTPS Worker

npm   Lint  

A TypeScript library for building DNS over HTTPS reverse proxies that make DNS servers speak DoH, using Cloudflare Workers.

Install

Add this package to your package.json by running this in the root of your project's directory:

npm install @dnspect/doh-worker

Usage

This package is designed to be used with Cloudflare Workers.

Build a DoH proxy:

import { handle } from '@dnspect/doh-workers';

export interface Env {}

export default {
  async fetch(req: Request, _env: Env, ctx: ExecutionContext): Promise<Response> {
    const url = new URL(req.url);
    if (url.pathname === '/favicon.ico') {
      return new Response(null, { status: 404 });
    }

    return handle(ctx, req, { hostname: '1.1.1.1', port: 53 });
  },
};

Package Sidebar

Install

npm i @dnspect/doh-worker

Weekly Downloads

2

Version

0.1.0

License

MIT

Unpacked Size

51.3 kB

Total Files

28

Last publish

Collaborators

  • hunts