Add index.js
This commit is contained in:
parent
7bf6b5a079
commit
2bad7e0532
1 changed files with 30 additions and 0 deletions
30
index.js
Normal file
30
index.js
Normal 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!!!!!
|
Loading…
Reference in a new issue