socket-function 0.35.0 → 0.37.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 +2 -2
- package/src/forwardPort.ts +3 -0
- package/src/webSocketServer.ts +6 -0
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "socket-function",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.37.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",
|
|
7
7
|
"dependencies": {
|
|
8
8
|
"@types/pako": "^2.0.3",
|
|
9
9
|
"@types/ws": "^8.5.3",
|
|
10
|
-
"cbor-x": "^1.
|
|
10
|
+
"cbor-x": "^1.6.0",
|
|
11
11
|
"mobx": "^6.6.2",
|
|
12
12
|
"node-forge": "https://github.com/sliftist/forge#name",
|
|
13
13
|
"pako": "^2.1.0",
|
package/src/forwardPort.ts
CHANGED
|
@@ -11,6 +11,9 @@ export async function forwardPort(config: {
|
|
|
11
11
|
internalPort: number;
|
|
12
12
|
duration?: number;
|
|
13
13
|
}) {
|
|
14
|
+
// On linux, just return, the server probably doesn't require forwarding, and if it does,
|
|
15
|
+
// it probably this code probably won't work anyways.
|
|
16
|
+
if (os.platform() === "linux") return;
|
|
14
17
|
try {
|
|
15
18
|
const { externalPort, internalPort } = config;
|
|
16
19
|
let duration = config.duration ?? timeInHour;
|
package/src/webSocketServer.ts
CHANGED
|
@@ -67,6 +67,9 @@ export async function startSocketServer(
|
|
|
67
67
|
let httpServerPromise = new Promise<https.Server>(r => onHttpServer = r);
|
|
68
68
|
let lastOptions!: https.ServerOptions;
|
|
69
69
|
await watchOptions(value => {
|
|
70
|
+
// NOTE: If this is called a lot... STOP CALLING IT A LOT! Calling setSecureContext
|
|
71
|
+
// so frequently likely leaks memory!
|
|
72
|
+
console.log(`Updating websocket server options`);
|
|
70
73
|
lastOptions = {
|
|
71
74
|
...value,
|
|
72
75
|
ca: getTrustedCertificates(),
|
|
@@ -88,6 +91,9 @@ export async function startSocketServer(
|
|
|
88
91
|
}
|
|
89
92
|
|
|
90
93
|
watchTrustedCertificates(() => {
|
|
94
|
+
// NOTE: If this is called a lot... STOP CALLING IT A LOT! Calling setSecureContext
|
|
95
|
+
// so frequently likely leaks memory!
|
|
96
|
+
console.log(`Updating websocket server trusted certificates`);
|
|
91
97
|
lastOptions.ca = getTrustedCertificates();
|
|
92
98
|
httpsServer.setSecureContext(lastOptions);
|
|
93
99
|
});
|