youzanyun-devtool-worker
Version:
- web - ws - proxy
26 lines (25 loc) • 793 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
const https_1 = tslib_1.__importDefault(require("https"));
class HttpsServer {
constructor({ httpsPort, key, cert }) {
this.httpsPort = httpsPort;
this.key = key;
this.cert = cert;
}
async start(requestListener) {
let httpsProxyServer = https_1.default.createServer({
key: this.key,
cert: this.cert
});
httpsProxyServer.on('request', requestListener);
httpsProxyServer.on('error', (err) => {
console.log(err);
});
httpsProxyServer.listen(this.httpsPort, "0.0.0.0");
console.log(`proxy https: ${this.httpsPort}`);
}
}
exports.default = HttpsServer;
;