Add args for production

This commit is contained in:
Wildan M 2021-09-20 20:11:57 +07:00
commit ca79e88b46
3 changed files with 11 additions and 9 deletions

6
app.js
View file

@ -4,14 +4,16 @@ const https = require("https");
const app = require("./index.js");
const listener = require("./src/client.js");
const { SniPrepare, SniListener } = require("./src/sni.js");
const port80 = (process.argv.length >= 2 ? parseInt(process.argv[2]) : 0) || 80;
const port443 = (process.argv.length >= 3 ? parseInt(process.argv[3]) : 0) || 443;
const main = async () => {
await SniPrepare();
const httpsServer = https.createServer({
SNICallback: SniListener,
}, listener);
httpsServer.listen(443);
app.listen(80);
httpsServer.listen(port443);
app.listen(port80);
};
main().catch((err) => {