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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "socket-function",
3
- "version": "0.54.0",
3
+ "version": "0.55.0",
4
4
  "main": "index.js",
5
5
  "license": "MIT",
6
6
  "note1": "note on node-forge fork, see https://github.com/digitalbazaar/forge/issues/744 for details",
@@ -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 remoteAddress = socket.remoteAddress;
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 ${remoteAddress}, have ${buffer.length} bytes so far, ${packetCount} packets`);
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 ${remoteAddress}, using main server. Packets ${packetCount}`);
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 ${remoteAddress}, ${e.stack}`);
234
+ console.error(`Socket error for ${debug}, ${e.stack}`);
235
235
  });
236
236
  });
237
237