fix m.google.com

This commit is contained in:
kxtzownsu 2025-03-06 19:54:31 +00:00
parent 1b7dae82a8
commit 504ccc6c3e
3 changed files with 13 additions and 12 deletions

View File

@ -118,7 +118,7 @@ function proxy(config, sock) {
const ms = handlers.getMiniServer(function (req, res) {
// console.log(req);
app(req, res);
}, path.resolve(__dirname, "public", "google.com.pem"), path.resolve(__dirname, "public", "google.com.key"))
}, path.resolve(__dirname, "public", "m.google.com.pem"), path.resolve(__dirname, "public", "m.google.com.key"))
const socks = net.createConnection({
host: "127.0.0.1",

View File

@ -15,9 +15,9 @@ class MiniServer {
expressApp;
port;
constructor(hand,cert, key, port = MiniServer.pInitial++) {
console.log(hand.toString());
console.debug("miniserver creating")
console.log(port)
//console.log(hand.toString());
//console.debug("miniserver creating")
//console.log(port)
this.internalServer = https.createServer({
cert: fs.readFileSync(cert),
key: fs.readFileSync(key),

View File

@ -80,7 +80,7 @@ function readServerConfig(address, config) {
}
const configData = {filter: defaultServerFilterGetter, proxy: defaultServerProxyGetter, config};
const configData = {filter: defaultServerFilterGetter(), proxy: defaultServerProxyGetter(), config};
return configData;
}
function getAllServerConfigs() {
@ -135,8 +135,9 @@ server.on('connection', (clientToProxySocket) => {
path = firstLine.split(' ')[1];
// console.log(serverAddress);
}
console.log(serverAddress);
console.log(isTLSConnection);
console.log("// HANDLING REQUEST \\\\");
console.log("Server Address: " + serverAddress);
console.log("Is TLS (HTTPS) connection: " + isTLSConnection);
var isFiltered = false;
var using = null;
Object.keys(serverCallbackMap).forEach((v)=>{
@ -153,9 +154,9 @@ server.on('connection', (clientToProxySocket) => {
// console.log(isFiltered);
}
})
console.log(isFiltered);
console.log("Is filtered? " + isFiltered + "\n\n");
if (isFiltered) {
serverCallbackMap[using].proxy()(serverCallbackMap[using].config, clientToProxySocket);
serverCallbackMap[using].proxy(serverCallbackMap[using].config, clientToProxySocket);
return;
}
let proxyToServerSocket = net.createConnection({
@ -165,7 +166,7 @@ server.on('connection', (clientToProxySocket) => {
// console.log('PROXY TO SERVER SET UP');
if (isTLSConnection) {
//Send Back OK to HTTPS CONNECT Request
clientToProxySocket.write('HTTP/1.1 200 OK\r\n\n');
clientToProxySocket.write('HTTP/1.1 200 Connection Established\r\n\r\n');
} else {
proxyToServerSocket.write(data);
}
@ -194,7 +195,7 @@ server.on('error', (err) => {
server.on('close', () => {
console.log('Client Disconnected');
});
server.listen(8126, () => {
console.log('Server running at http://localhost:' + 8126);
server.listen(8126, '0.0.0.0', () => {
console.log('Server running at http://0.0.0.0:' + 8126);
});
//Source code below is for creating a mini server or a server that serves requests within memory.(or not)