From 2bad7e0532d509ac206cde32b83172e6e1a9cc05 Mon Sep 17 00:00:00 2001 From: pq Date: Wed, 1 Jan 2025 17:36:35 -0600 Subject: [PATCH] Add index.js --- index.js | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 index.js diff --git a/index.js b/index.js new file mode 100644 index 0000000..e9c2185 --- /dev/null +++ b/index.js @@ -0,0 +1,30 @@ +const express = require('express'); +const proxy = require('express-http-proxy'); +const q = require('quickielog'); +const app = express(); + +var port = 3000; +if ("QDOH_WEB_PORT" in process.env) { + port = process.env.QDOH_WEB_PORT; +} + +var dns_server = "https://dns.quad9.net/dns-query"; +if ("QDOH_DNS_SERVER" in process.env) { + dns_server = process.env.QDOH_DNS_SERVER; +} + +app.use( + "/", + proxy( + dns_server, + {parseReqBody: false} + ) +); + +var logger = new q.Logger("QuickieDoH", false); +app.listen(port, () => { + q.log(logger, "INFO", `Quickie DoH will forward DoH requests to ${dns_server}`); + q.log(logger, "INFO", `Quickie DoH is ready to receive requests at http://127.0.0.1:${port}/dns-query`); +}); + +// MIKU MIKU BEAM!!!!! \ No newline at end of file