Add index.js

This commit is contained in:
Peri "Space is wonderful" doqia 2025-01-01 17:36:35 -06:00
parent 7bf6b5a079
commit 2bad7e0532

30
index.js Normal file
View file

@ -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!!!!!