A TypeScript library for building DNS over HTTPS reverse proxies that make DNS servers speak DoH using Cloudflare Workers.
Add this package to your package.json by running this in the root of your project's directory:
npm install @dnspect/doh-workerThis package is designed to be used with Cloudflare Workers.
Build a DoH proxy:
import { handle } from '@dnspect/doh-worker';
export interface Env {}
export default {
async fetch(req: Request, _env: Env, ctx: ExecutionContext): Promise<Response> {
const url = new URL(req.url);
if (ur.pathname === '/dns-query') {
return handle(ctx, req, { hostname: '1.1.1.1', port: 53 });
}
return new Response(null, { status: 404 });
},
};