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) { const ms = handlers.getMiniServer(function (req, res) {
// console.log(req); // console.log(req);
app(req, res); 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({ const socks = net.createConnection({
host: "127.0.0.1", host: "127.0.0.1",

View File

@ -15,9 +15,9 @@ class MiniServer {
expressApp; expressApp;
port; port;
constructor(hand,cert, key, port = MiniServer.pInitial++) { constructor(hand,cert, key, port = MiniServer.pInitial++) {
console.log(hand.toString()); //console.log(hand.toString());
console.debug("miniserver creating") //console.debug("miniserver creating")
console.log(port) //console.log(port)
this.internalServer = https.createServer({ this.internalServer = https.createServer({
cert: fs.readFileSync(cert), cert: fs.readFileSync(cert),
key: fs.readFileSync(key), 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; return configData;
} }
function getAllServerConfigs() { function getAllServerConfigs() {
@ -135,8 +135,9 @@ server.on('connection', (clientToProxySocket) => {
path = firstLine.split(' ')[1]; path = firstLine.split(' ')[1];
// console.log(serverAddress); // console.log(serverAddress);
} }
console.log(serverAddress); console.log("// HANDLING REQUEST \\\\");
console.log(isTLSConnection); console.log("Server Address: " + serverAddress);
console.log("Is TLS (HTTPS) connection: " + isTLSConnection);
var isFiltered = false; var isFiltered = false;
var using = null; var using = null;
Object.keys(serverCallbackMap).forEach((v)=>{ Object.keys(serverCallbackMap).forEach((v)=>{
@ -153,9 +154,9 @@ server.on('connection', (clientToProxySocket) => {
// console.log(isFiltered); // console.log(isFiltered);
} }
}) })
console.log(isFiltered); console.log("Is filtered? " + isFiltered + "\n\n");
if (isFiltered) { if (isFiltered) {
serverCallbackMap[using].proxy()(serverCallbackMap[using].config, clientToProxySocket); serverCallbackMap[using].proxy(serverCallbackMap[using].config, clientToProxySocket);
return; return;
} }
let proxyToServerSocket = net.createConnection({ let proxyToServerSocket = net.createConnection({
@ -165,7 +166,7 @@ server.on('connection', (clientToProxySocket) => {
// console.log('PROXY TO SERVER SET UP'); // console.log('PROXY TO SERVER SET UP');
if (isTLSConnection) { if (isTLSConnection) {
//Send Back OK to HTTPS CONNECT Request //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 { } else {
proxyToServerSocket.write(data); proxyToServerSocket.write(data);
} }
@ -194,7 +195,7 @@ server.on('error', (err) => {
server.on('close', () => { server.on('close', () => {
console.log('Client Disconnected'); console.log('Client Disconnected');
}); });
server.listen(8126, () => { server.listen(8126, '0.0.0.0', () => {
console.log('Server running at http://localhost:' + 8126); 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) //Source code below is for creating a mini server or a server that serves requests within memory.(or not)