socket-function 0.72.0 → 0.74.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/SocketFunction.ts +12 -0
- package/package.json +1 -1
- package/src/webSocketServer.ts +7 -4
- package/time/trueTimeShim.ts +0 -1
package/SocketFunction.ts
CHANGED
|
@@ -419,6 +419,9 @@ export class SocketFunction {
|
|
|
419
419
|
if (isNode()) {
|
|
420
420
|
throw new Error("Cannot get browser nodeId on server");
|
|
421
421
|
}
|
|
422
|
+
if (globalThis.BOOTED_EDGE_NODE) {
|
|
423
|
+
return globalThis.BOOTED_EDGE_NODE.host;
|
|
424
|
+
}
|
|
422
425
|
return SocketFunction.connect({ address: location.hostname, port: +location.port || 443 });
|
|
423
426
|
}
|
|
424
427
|
|
|
@@ -431,6 +434,15 @@ export class SocketFunction {
|
|
|
431
434
|
}
|
|
432
435
|
|
|
433
436
|
|
|
437
|
+
declare global {
|
|
438
|
+
var BOOTED_EDGE_NODE: EdgeNodeConfig | undefined;
|
|
439
|
+
}
|
|
440
|
+
type EdgeNodeConfig = {
|
|
441
|
+
// EX: 127-0-0-1.example.com:3334
|
|
442
|
+
host: string;
|
|
443
|
+
};
|
|
444
|
+
|
|
445
|
+
|
|
434
446
|
let socketContextSeqNum = 1;
|
|
435
447
|
|
|
436
448
|
export function _setSocketContext<T>(
|
package/package.json
CHANGED
package/src/webSocketServer.ts
CHANGED
|
@@ -214,11 +214,14 @@ export async function startSocketServer(
|
|
|
214
214
|
console.warn(`No SNI found in TLS hello from ${debug}, using main server. Packets ${packetCount}`);
|
|
215
215
|
console.log(buffer.toString("base64"));
|
|
216
216
|
}
|
|
217
|
-
|
|
218
|
-
sni = sni.split(".").slice(-2).join(".");
|
|
219
|
-
}
|
|
217
|
+
|
|
220
218
|
if (!sniServers.has(sni)) {
|
|
221
|
-
|
|
219
|
+
if (sni) {
|
|
220
|
+
sni = sni.split(".").slice(-2).join(".");
|
|
221
|
+
}
|
|
222
|
+
if (!sniServers.has(sni)) {
|
|
223
|
+
console.warn(`No SNI server found for ${sni}, using main server.`);
|
|
224
|
+
}
|
|
222
225
|
}
|
|
223
226
|
server = sniServers.get(sni) || mainHTTPSServer;
|
|
224
227
|
}
|