This repository has been archived on 2025-03-09. You can view files and clone it, but cannot push or open issues or pull requests.
httpmitm-old/handlers.js
2025-03-02 22:22:08 -05:00

37 lines
895 B
JavaScript

const net = require('net')
const https = require('https')
const proc = require('process')
const fs= require('fs');
/**
* @param {import('./proxy').ServerConfig} config
* @param {net.Socket} socket
*/
function expressHandlerFromSocket(config, socket) {
}
class MiniServer {
static pInitial = 3002;
internalServer;
expressApp;
port;
constructor(hand,cert, key, port = MiniServer.pInitial++) {
console.log(hand.toString());
console.debug("miniserver creating")
console.log(port)
this.internalServer = https.createServer({
cert: fs.readFileSync(cert),
key: fs.readFileSync(key),
}, hand);
this.internalServer.listen(port);
this.port = port;
}
}
function getMiniServer(hand, cert, key) {
return new MiniServer(hand, cert, key);
}
module.exports = {
getMiniServer
}