socket-function 0.54.0 → 0.55.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/webSocketServer.ts +4 -4
package/package.json
CHANGED
package/src/webSocketServer.ts
CHANGED
|
@@ -186,10 +186,10 @@ export async function startSocketServer(
|
|
|
186
186
|
|
|
187
187
|
let realServer = net.createServer(socket => {
|
|
188
188
|
//console.log("Received TCP connection from " + socket.remoteAddress);
|
|
189
|
-
const
|
|
189
|
+
const debug = socket.remoteAddress + ":" + socket.remotePort;
|
|
190
190
|
function handleTLSHello(buffer: Buffer, packetCount: number): void | "more" {
|
|
191
191
|
if (!SocketFunction.silent) {
|
|
192
|
-
console.log(`Received TCP header packet from ${
|
|
192
|
+
console.log(`Received TCP header packet from ${debug}, have ${buffer.length} bytes so far, ${packetCount} packets`);
|
|
193
193
|
}
|
|
194
194
|
// All HTTPS requests start with 22, and no HTTP requests start with 22,
|
|
195
195
|
// so we just need to read the first byte.
|
|
@@ -206,7 +206,7 @@ export async function startSocketServer(
|
|
|
206
206
|
console.log(`Received TCP connection with SNI ${JSON.stringify(sni)}`);
|
|
207
207
|
}
|
|
208
208
|
if (!sni) {
|
|
209
|
-
console.warn(`No SNI found in TLS hello from ${
|
|
209
|
+
console.warn(`No SNI found in TLS hello from ${debug}, using main server. Packets ${packetCount}`);
|
|
210
210
|
console.log(buffer.toString("base64"));
|
|
211
211
|
}
|
|
212
212
|
server = sniServers.get(sni) || mainHTTPSServer;
|
|
@@ -231,7 +231,7 @@ export async function startSocketServer(
|
|
|
231
231
|
}
|
|
232
232
|
getNextData();
|
|
233
233
|
socket.on("error", (e) => {
|
|
234
|
-
console.error(`Socket error for ${
|
|
234
|
+
console.error(`Socket error for ${debug}, ${e.stack}`);
|
|
235
235
|
});
|
|
236
236
|
});
|
|
237
237
|
|