@encharm/cws 4.2.0 → 4.4.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/README.md +5 -7
- package/binding.gyp +2 -2
- package/dist/bindings/cws_darwin_arm64_node108.node +0 -0
- package/dist/bindings/cws_darwin_arm64_node115.node +0 -0
- package/dist/bindings/cws_darwin_arm64_node83.node +0 -0
- package/dist/bindings/cws_darwin_arm64_node93.node +0 -0
- package/dist/bindings/cws_darwin_x64_node108.node +0 -0
- package/dist/bindings/cws_darwin_x64_node115.node +0 -0
- package/dist/bindings/cws_darwin_x64_node83.node +0 -0
- package/dist/bindings/cws_darwin_x64_node93.node +0 -0
- package/dist/bindings/cws_linux_arm64_node108.node +0 -0
- package/dist/bindings/cws_linux_arm64_node115.node +0 -0
- package/dist/bindings/cws_linux_arm64_node83.node +0 -0
- package/dist/bindings/cws_linux_arm64_node93.node +0 -0
- package/dist/bindings/cws_linux_x64_node108.node +0 -0
- package/dist/bindings/cws_linux_x64_node115.node +0 -0
- package/dist/bindings/cws_linux_x64_node83.node +0 -0
- package/dist/bindings/cws_linux_x64_node93.node +0 -0
- package/dist/bindings/cws_win32_x64_node108.node +0 -0
- package/dist/bindings/cws_win32_x64_node115.node +0 -0
- package/dist/bindings/cws_win32_x64_node83.node +0 -0
- package/dist/bindings/cws_win32_x64_node93.node +0 -0
- package/dist/shared.js +2 -2
- package/package.json +5 -5
- package/src/Addon.cpp +4 -12
- package/src/Addon.h +55 -90
- package/src/Socket.h +1 -0
- package/src/cSNode.cpp +3 -8
- package/src/headers/20/acorn_version.h +6 -0
- package/src/headers/20/aliased_buffer-inl.h +243 -0
- package/src/headers/20/aliased_buffer.h +206 -0
- package/src/headers/20/aliased_struct-inl.h +54 -0
- package/src/headers/20/aliased_struct.h +63 -0
- package/src/headers/20/async_wrap-inl.h +93 -0
- package/src/headers/20/async_wrap.h +252 -0
- package/src/headers/20/base64-inl.h +193 -0
- package/src/headers/20/base64.h +53 -0
- package/src/headers/20/base64_version.h +6 -0
- package/src/headers/20/base_object-inl.h +316 -0
- package/src/headers/20/base_object.h +320 -0
- package/src/headers/20/base_object_types.h +73 -0
- package/src/headers/20/blob_serializer_deserializer-inl.h +361 -0
- package/src/headers/20/blob_serializer_deserializer.h +132 -0
- package/src/headers/20/callback_queue-inl.h +97 -0
- package/src/headers/20/callback_queue.h +79 -0
- package/src/headers/20/cares_wrap.h +524 -0
- package/src/headers/20/cjs_module_lexer_version.h +6 -0
- package/src/headers/20/cleanup_queue-inl.h +62 -0
- package/src/headers/20/cleanup_queue.h +85 -0
- package/src/headers/20/connect_wrap.h +26 -0
- package/src/headers/20/connection_wrap.h +29 -0
- package/src/headers/20/cppgc/DEPS +8 -0
- package/src/headers/20/cppgc/OWNERS +2 -0
- package/src/headers/20/cppgc/README.md +135 -0
- package/src/headers/20/cppgc/allocation.h +310 -0
- package/src/headers/20/cppgc/common.h +28 -0
- package/src/headers/20/cppgc/cross-thread-persistent.h +466 -0
- package/src/headers/20/cppgc/custom-space.h +97 -0
- package/src/headers/20/cppgc/default-platform.h +67 -0
- package/src/headers/20/cppgc/ephemeron-pair.h +30 -0
- package/src/headers/20/cppgc/explicit-management.h +100 -0
- package/src/headers/20/cppgc/garbage-collected.h +106 -0
- package/src/headers/20/cppgc/heap-consistency.h +309 -0
- package/src/headers/20/cppgc/heap-handle.h +48 -0
- package/src/headers/20/cppgc/heap-state.h +82 -0
- package/src/headers/20/cppgc/heap-statistics.h +120 -0
- package/src/headers/20/cppgc/heap.h +202 -0
- package/src/headers/20/cppgc/internal/api-constants.h +68 -0
- package/src/headers/20/cppgc/internal/atomic-entry-flag.h +48 -0
- package/src/headers/20/cppgc/internal/base-page-handle.h +45 -0
- package/src/headers/20/cppgc/internal/caged-heap-local-data.h +111 -0
- package/src/headers/20/cppgc/internal/caged-heap.h +61 -0
- package/src/headers/20/cppgc/internal/compiler-specific.h +38 -0
- package/src/headers/20/cppgc/internal/finalizer-trait.h +93 -0
- package/src/headers/20/cppgc/internal/gc-info.h +157 -0
- package/src/headers/20/cppgc/internal/logging.h +50 -0
- package/src/headers/20/cppgc/internal/member-storage.h +248 -0
- package/src/headers/20/cppgc/internal/name-trait.h +137 -0
- package/src/headers/20/cppgc/internal/persistent-node.h +214 -0
- package/src/headers/20/cppgc/internal/pointer-policies.h +243 -0
- package/src/headers/20/cppgc/internal/write-barrier.h +487 -0
- package/src/headers/20/cppgc/liveness-broker.h +78 -0
- package/src/headers/20/cppgc/macros.h +35 -0
- package/src/headers/20/cppgc/member.h +604 -0
- package/src/headers/20/cppgc/name-provider.h +65 -0
- package/src/headers/20/cppgc/object-size-trait.h +58 -0
- package/src/headers/20/cppgc/persistent.h +373 -0
- package/src/headers/20/cppgc/platform.h +158 -0
- package/src/headers/20/cppgc/prefinalizer.h +75 -0
- package/src/headers/20/cppgc/process-heap-statistics.h +36 -0
- package/src/headers/20/cppgc/sentinel-pointer.h +32 -0
- package/src/headers/20/cppgc/source-location.h +92 -0
- package/src/headers/20/cppgc/testing.h +106 -0
- package/src/headers/20/cppgc/trace-trait.h +120 -0
- package/src/headers/20/cppgc/type-traits.h +250 -0
- package/src/headers/20/cppgc/visitor.h +426 -0
- package/src/headers/20/crypto/crypto_clienthello.h +131 -0
- package/src/headers/20/crypto/crypto_context.h +160 -0
- package/src/headers/20/crypto/crypto_keys.h +416 -0
- package/src/headers/20/crypto/crypto_tls.h +295 -0
- package/src/headers/20/crypto/crypto_util.h +805 -0
- package/src/headers/20/crypto_clienthello.h +131 -0
- package/src/headers/20/debug_utils-inl.h +226 -0
- package/src/headers/20/debug_utils.h +188 -0
- package/src/headers/20/diagnosticfilename-inl.h +33 -0
- package/src/headers/20/encoding_binding.h +59 -0
- package/src/headers/20/env-inl.h +923 -0
- package/src/headers/20/env.h +1193 -0
- package/src/headers/20/env_properties.h +444 -0
- package/src/headers/20/handle_wrap.h +123 -0
- package/src/headers/20/histogram-inl.h +107 -0
- package/src/headers/20/histogram.h +240 -0
- package/src/headers/20/inspector_agent.h +144 -0
- package/src/headers/20/inspector_io.h +78 -0
- package/src/headers/20/inspector_profiler.h +149 -0
- package/src/headers/20/inspector_socket.h +60 -0
- package/src/headers/20/inspector_socket_server.h +110 -0
- package/src/headers/20/js_native_api.h +591 -0
- package/src/headers/20/js_native_api_types.h +168 -0
- package/src/headers/20/js_native_api_v8.h +426 -0
- package/src/headers/20/js_native_api_v8_internals.h +39 -0
- package/src/headers/20/js_stream.h +52 -0
- package/src/headers/20/json_parser.h +38 -0
- package/src/headers/20/json_utils.h +172 -0
- package/src/headers/20/memory_tracker-inl.h +356 -0
- package/src/headers/20/memory_tracker.h +289 -0
- package/src/headers/20/module_wrap.h +117 -0
- package/src/headers/20/node.h +1514 -0
- package/src/headers/20/node_api.h +260 -0
- package/src/headers/20/node_api_internals.h +42 -0
- package/src/headers/20/node_api_types.h +52 -0
- package/src/headers/20/node_binding.h +142 -0
- package/src/headers/20/node_blob.h +159 -0
- package/src/headers/20/node_bob-inl.h +36 -0
- package/src/headers/20/node_bob.h +107 -0
- package/src/headers/20/node_buffer.h +92 -0
- package/src/headers/20/node_builtins.h +197 -0
- package/src/headers/20/node_constants.h +79 -0
- package/src/headers/20/node_context_data.h +98 -0
- package/src/headers/20/node_contextify.h +182 -0
- package/src/headers/20/node_crypto.h +56 -0
- package/src/headers/20/node_dir.h +52 -0
- package/src/headers/20/node_dotenv.h +37 -0
- package/src/headers/20/node_errors.h +313 -0
- package/src/headers/20/node_exit_code.h +54 -0
- package/src/headers/20/node_external_reference.h +172 -0
- package/src/headers/20/node_file-inl.h +357 -0
- package/src/headers/20/node_file.h +524 -0
- package/src/headers/20/node_http2.h +1146 -0
- package/src/headers/20/node_http2_state.h +147 -0
- package/src/headers/20/node_http_common-inl.h +201 -0
- package/src/headers/20/node_http_common.h +532 -0
- package/src/headers/20/node_i18n.h +145 -0
- package/src/headers/20/node_internals.h +443 -0
- package/src/headers/20/node_main_instance.h +67 -0
- package/src/headers/20/node_mem-inl.h +112 -0
- package/src/headers/20/node_mem.h +45 -0
- package/src/headers/20/node_messaging.h +377 -0
- package/src/headers/20/node_metadata.h +138 -0
- package/src/headers/20/node_mutex.h +323 -0
- package/src/headers/20/node_object_wrap.h +132 -0
- package/src/headers/20/node_options-inl.h +478 -0
- package/src/headers/20/node_options.h +538 -0
- package/src/headers/20/node_perf.h +166 -0
- package/src/headers/20/node_perf_common.h +98 -0
- package/src/headers/20/node_platform.h +195 -0
- package/src/headers/20/node_process-inl.h +26 -0
- package/src/headers/20/node_process.h +99 -0
- package/src/headers/20/node_realm-inl.h +139 -0
- package/src/headers/20/node_realm.h +184 -0
- package/src/headers/20/node_report.h +42 -0
- package/src/headers/20/node_revert.h +82 -0
- package/src/headers/20/node_root_certs.h +3443 -0
- package/src/headers/20/node_sea.h +56 -0
- package/src/headers/20/node_shadow_realm.h +46 -0
- package/src/headers/20/node_snapshot_builder.h +54 -0
- package/src/headers/20/node_snapshotable.h +164 -0
- package/src/headers/20/node_sockaddr-inl.h +266 -0
- package/src/headers/20/node_sockaddr.h +405 -0
- package/src/headers/20/node_stat_watcher.h +73 -0
- package/src/headers/20/node_threadsafe_cow-inl.h +54 -0
- package/src/headers/20/node_threadsafe_cow.h +105 -0
- package/src/headers/20/node_union_bytes.h +81 -0
- package/src/headers/20/node_url.h +92 -0
- package/src/headers/20/node_v8.h +77 -0
- package/src/headers/20/node_v8_platform-inl.h +205 -0
- package/src/headers/20/node_version.h +109 -0
- package/src/headers/20/node_wasi.h +184 -0
- package/src/headers/20/node_wasm_web_api.h +55 -0
- package/src/headers/20/node_watchdog.h +154 -0
- package/src/headers/20/node_worker.h +151 -0
- package/src/headers/20/permission/child_process_permission.h +28 -0
- package/src/headers/20/permission/fs_permission.h +152 -0
- package/src/headers/20/permission/permission.h +71 -0
- package/src/headers/20/permission/permission_base.h +49 -0
- package/src/headers/20/permission/worker_permission.h +28 -0
- package/src/headers/20/pipe_wrap.h +80 -0
- package/src/headers/20/req_wrap-inl.h +171 -0
- package/src/headers/20/req_wrap.h +77 -0
- package/src/headers/20/spawn_sync.h +242 -0
- package/src/headers/20/stream_base-inl.h +173 -0
- package/src/headers/20/stream_base.h +469 -0
- package/src/headers/20/stream_pipe.h +76 -0
- package/src/headers/20/stream_wrap.h +131 -0
- package/src/headers/20/string_bytes.h +120 -0
- package/src/headers/20/string_decoder-inl.h +37 -0
- package/src/headers/20/string_decoder.h +50 -0
- package/src/headers/20/string_search.h +638 -0
- package/src/headers/20/tcp_wrap.h +105 -0
- package/src/headers/20/threadpoolwork-inl.h +70 -0
- package/src/headers/20/timer_wrap-inl.h +32 -0
- package/src/headers/20/timer_wrap.h +85 -0
- package/src/headers/20/timers.h +70 -0
- package/src/headers/20/tracing/agent.h +195 -0
- package/src/headers/20/tracing/trace_event.h +720 -0
- package/src/headers/20/tracing/trace_event_common.h +1109 -0
- package/src/headers/20/tty_wrap.h +65 -0
- package/src/headers/20/udp_wrap.h +227 -0
- package/src/headers/20/undici_version.h +6 -0
- package/src/headers/20/util-inl.h +623 -0
- package/src/headers/20/util.h +988 -0
- package/src/headers/20/v8-cppgc.h +245 -0
- package/src/headers/20/v8-fast-api-calls.h +957 -0
- package/dist/bindings/cws_darwin_64.node +0 -0
- package/dist/bindings/cws_darwin_72.node +0 -0
- package/dist/bindings/cws_darwin_79.node +0 -0
- package/dist/bindings/cws_darwin_83.node +0 -0
- package/dist/bindings/cws_darwin_93.node +0 -0
- package/dist/bindings/cws_linux_108.node +0 -0
- package/dist/bindings/cws_linux_64.node +0 -0
- package/dist/bindings/cws_linux_72.node +0 -0
- package/dist/bindings/cws_linux_79.node +0 -0
- package/dist/bindings/cws_linux_83.node +0 -0
- package/dist/bindings/cws_linux_93.node +0 -0
- package/dist/bindings/cws_win32_64.node +0 -0
- package/dist/bindings/cws_win32_72.node +0 -0
- package/dist/bindings/cws_win32_79.node +0 -0
- package/dist/bindings/cws_win32_83.node +0 -0
- package/dist/bindings/cws_win32_93.node +0 -0
package/README.md
CHANGED
|
@@ -12,13 +12,11 @@
|
|
|
12
12
|
|
|
13
13
|
This table is true if you run ssl directly with `cws` (`Node.js`). In case if you use proxy for example `nginx`, `cws` can be run on bigger coverage.
|
|
14
14
|
|
|
15
|
-
|
|
|
16
|
-
|
|
17
|
-
| 4.
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
| 2.0.0 | >=10.0 | X | >=12.16 | >=13.9 | X | X |
|
|
21
|
-
| 1.6.0 | >=10.0 | >=11.0 | >=12.0 & <12.16 | >=13.9 | X | X |
|
|
15
|
+
| cWS Version | Node 14 | Node 16 | Node 18 | Node 20 |
|
|
16
|
+
|-------------|----------|---------|-------------------|
|
|
17
|
+
| 4.4.x | X | X | X | X |
|
|
18
|
+
|
|
19
|
+
Node <14 are supported with @clusterws/cws.
|
|
22
20
|
|
|
23
21
|
## Documentation
|
|
24
22
|
|
package/binding.gyp
CHANGED
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
'outputs': [
|
|
65
65
|
'cws'
|
|
66
66
|
],
|
|
67
|
-
'action': ['cp', '<@(PRODUCT_DIR)/cws.node', 'dist/bindings/cws_<!@(node -p process.platform)_<!@(node -p process.versions.modules).node']
|
|
67
|
+
'action': ['cp', '<@(PRODUCT_DIR)/cws.node', 'dist/bindings/cws_<!@(node -p process.platform)_<!@(node -p process.arch)_node<!@(node -p process.versions.modules).node']
|
|
68
68
|
}
|
|
69
69
|
]}
|
|
70
70
|
],
|
|
@@ -78,7 +78,7 @@
|
|
|
78
78
|
'outputs': [
|
|
79
79
|
'cws'
|
|
80
80
|
],
|
|
81
|
-
'action': ['copy', '<@(PRODUCT_DIR)/cws.node', '
|
|
81
|
+
'action': ['copy', '<@(PRODUCT_DIR)/cws.node', 'cws_<!@(node -p process.platform)_<!@(node -p process.arch)_node<!@(node -p process.versions.modules).node']
|
|
82
82
|
}
|
|
83
83
|
]}
|
|
84
84
|
]
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/dist/shared.js
CHANGED
|
@@ -12,10 +12,10 @@ exports.SLIDING_DEFLATE_WINDOW = 16;
|
|
|
12
12
|
exports.DEFAULT_PAYLOAD_LIMIT = 16777216;
|
|
13
13
|
exports.native = (() => {
|
|
14
14
|
try {
|
|
15
|
-
return require(`../dist/bindings/cws_${process.platform}_${process.versions.modules}`);
|
|
15
|
+
return require(`../dist/bindings/cws_${process.platform}_${process.arch}_node${process.versions.modules}`);
|
|
16
16
|
}
|
|
17
17
|
catch (err) {
|
|
18
|
-
err.message = err.message + ` check './node_modules/@
|
|
18
|
+
err.message = err.message + ` check './node_modules/@encharm/cws/build_log.txt' for post install build logs`;
|
|
19
19
|
throw err;
|
|
20
20
|
}
|
|
21
21
|
})();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
{
|
|
2
2
|
"name": "@encharm/cws",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.4.0",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"types": "./dist/index.d.ts",
|
|
6
6
|
"description": "cWS - fast C++ WebSocket implementation for Node.js",
|
|
@@ -30,12 +30,12 @@
|
|
|
30
30
|
"@types/node": "^13.11.1",
|
|
31
31
|
"chai": "^4.2.0",
|
|
32
32
|
"mocha": "^7.1.1",
|
|
33
|
-
"nyc": "^15.0
|
|
33
|
+
"nyc": "^15.1.0",
|
|
34
34
|
"rimraf": "^3.0.2",
|
|
35
35
|
"ts-node": "^8.8.2",
|
|
36
|
-
"tslint": "^6.1.1",
|
|
37
36
|
"tslint-eslint-rules": "^5.4.0",
|
|
38
|
-
"typescript": "^3.8.3"
|
|
37
|
+
"typescript": "^3.8.3",
|
|
38
|
+
"ws": "^8.8.0"
|
|
39
39
|
},
|
|
40
40
|
"nyc": {
|
|
41
41
|
"all": true,
|
package/src/Addon.cpp
CHANGED
|
@@ -4,18 +4,10 @@
|
|
|
4
4
|
|
|
5
5
|
void Initialize(Local<Object> exports) {
|
|
6
6
|
Isolate *isolate = exports->GetIsolate();
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
exports->Set(isolate->GetCurrentContext(), String::NewFromUtf8(isolate, "client").ToLocalChecked(),
|
|
12
|
-
Namespace<cWS::CLIENT>(isolate).object);
|
|
13
|
-
#else
|
|
14
|
-
exports->Set(String::NewFromUtf8(isolate, "server"),
|
|
15
|
-
Namespace<cWS::SERVER>(isolate).object);
|
|
16
|
-
exports->Set(String::NewFromUtf8(isolate, "client"),
|
|
17
|
-
Namespace<cWS::CLIENT>(isolate).object);
|
|
18
|
-
#endif
|
|
7
|
+
exports->Set(isolate->GetCurrentContext(), String::NewFromUtf8(isolate, "server").ToLocalChecked(),
|
|
8
|
+
Namespace<cWS::SERVER>(isolate).object);
|
|
9
|
+
exports->Set(isolate->GetCurrentContext(), String::NewFromUtf8(isolate, "client").ToLocalChecked(),
|
|
10
|
+
Namespace<cWS::CLIENT>(isolate).object);
|
|
19
11
|
|
|
20
12
|
NODE_SET_METHOD(exports, "getSSLContext", getSSLContext);
|
|
21
13
|
NODE_SET_METHOD(exports, "getBufferedAmount", getBufferedAmount<cWS::SERVER>);
|
package/src/Addon.h
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
#define NODE_API_DEFAULT_MODULE_API_VERSION 115
|
|
2
|
+
|
|
1
3
|
#include <node.h>
|
|
2
4
|
#include <node_buffer.h>
|
|
3
5
|
#include <openssl/bio.h>
|
|
@@ -5,23 +7,10 @@
|
|
|
5
7
|
#include <uv.h>
|
|
6
8
|
#include <cstring>
|
|
7
9
|
|
|
10
|
+
// TODO: remove below
|
|
8
11
|
#if NODE_MAJOR_VERSION>=10
|
|
9
12
|
#define NODE_WANT_INTERNALS 1
|
|
10
13
|
|
|
11
|
-
#if NODE_MAJOR_VERSION==10
|
|
12
|
-
#include "headers/10/tls_wrap.h"
|
|
13
|
-
#endif
|
|
14
|
-
|
|
15
|
-
#if NODE_MAJOR_VERSION==12
|
|
16
|
-
#include "headers/12/tls_wrap.h"
|
|
17
|
-
#include "headers/12/base_object-inl.h"
|
|
18
|
-
#endif
|
|
19
|
-
|
|
20
|
-
#if NODE_MAJOR_VERSION==13
|
|
21
|
-
#include "headers/13/tls_wrap.h"
|
|
22
|
-
#include "headers/13/base_object-inl.h"
|
|
23
|
-
#endif
|
|
24
|
-
|
|
25
14
|
#if NODE_MAJOR_VERSION==14
|
|
26
15
|
#include "headers/14/tls_wrap.h"
|
|
27
16
|
#include "headers/14/base_object-inl.h"
|
|
@@ -37,8 +26,15 @@
|
|
|
37
26
|
#include "headers/18/base_object-inl.h"
|
|
38
27
|
#endif
|
|
39
28
|
|
|
29
|
+
#if NODE_MAJOR_VERSION==20
|
|
30
|
+
#include "headers/20/crypto/crypto_tls.h"
|
|
31
|
+
#include "headers/20/base_object-inl.h"
|
|
32
|
+
#endif
|
|
33
|
+
|
|
34
|
+
#include <tcp_wrap.h>
|
|
35
|
+
|
|
40
36
|
using BaseObject = node::BaseObject;
|
|
41
|
-
#if NODE_MAJOR_VERSION==16 || NODE_MAJOR_VERSION==18
|
|
37
|
+
#if NODE_MAJOR_VERSION==16 || NODE_MAJOR_VERSION==18 || NODE_MAJOR_VERSION==20
|
|
42
38
|
using TLSWrap = node::crypto::TLSWrap;
|
|
43
39
|
#else
|
|
44
40
|
using TLSWrap = node::TLSWrap;
|
|
@@ -59,32 +55,15 @@ public:
|
|
|
59
55
|
|
|
60
56
|
// Fix windows not resolved symbol issue
|
|
61
57
|
#if defined(_MSC_VER)
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
}
|
|
72
|
-
#else
|
|
73
|
-
[[noreturn]] void node::Assert(const char* const (*args)[4]) {
|
|
74
|
-
auto filename = (*args)[0];
|
|
75
|
-
auto linenum = (*args)[1];
|
|
76
|
-
auto message = (*args)[2];
|
|
77
|
-
auto function = (*args)[3];
|
|
78
|
-
char name[1024];
|
|
79
|
-
char title[1024] = "Node.js";
|
|
80
|
-
uv_get_process_title(title, sizeof(title));
|
|
81
|
-
snprintf(name, sizeof(name), "%s[%d]", title, uv_os_getpid());
|
|
82
|
-
fprintf(stderr, "%s: %s:%s:%s%s Assertion `%s' failed.\n",
|
|
83
|
-
name, filename, linenum, function, *function ? ":" : "", message);
|
|
84
|
-
fflush(stderr);
|
|
85
|
-
ABORT_NO_BACKTRACE();
|
|
86
|
-
}
|
|
87
|
-
#endif
|
|
58
|
+
[[noreturn]] void node::Assert(const node::AssertionInfo& info) {
|
|
59
|
+
char name[1024];
|
|
60
|
+
char title[1024] = "Node.js";
|
|
61
|
+
uv_get_process_title(title, sizeof(title));
|
|
62
|
+
snprintf(name, sizeof(name), "%s[%d]", title, uv_os_getpid());
|
|
63
|
+
fprintf(stderr, "%s: Assertion failed.\n", name);
|
|
64
|
+
fflush(stderr);
|
|
65
|
+
ABORT_NO_BACKTRACE();
|
|
66
|
+
}
|
|
88
67
|
#endif
|
|
89
68
|
|
|
90
69
|
#undef NODE_WANT_INTERNALS
|
|
@@ -130,10 +109,10 @@ class NativeString {
|
|
|
130
109
|
} else if (value->IsTypedArray()) {
|
|
131
110
|
Local<ArrayBufferView> arrayBufferView =
|
|
132
111
|
Local<ArrayBufferView>::Cast(value);
|
|
133
|
-
#if NODE_MAJOR_VERSION
|
|
134
|
-
std::shared_ptr<v8::BackingStore> contents = arrayBufferView->Buffer()->GetBackingStore();
|
|
112
|
+
#if NODE_MAJOR_VERSION >= 18
|
|
135
113
|
length = arrayBufferView->ByteLength();
|
|
136
|
-
|
|
114
|
+
auto store = arrayBufferView->Buffer()->GetBackingStore();
|
|
115
|
+
data = reinterpret_cast<char*>(store->Data());
|
|
137
116
|
#else
|
|
138
117
|
ArrayBuffer::Contents contents = arrayBufferView->Buffer()->GetContents();
|
|
139
118
|
length = contents.ByteLength();
|
|
@@ -141,10 +120,10 @@ class NativeString {
|
|
|
141
120
|
#endif
|
|
142
121
|
} else if (value->IsArrayBuffer()) {
|
|
143
122
|
Local<ArrayBuffer> arrayBuffer = Local<ArrayBuffer>::Cast(value);
|
|
144
|
-
#if NODE_MAJOR_VERSION
|
|
145
|
-
std::shared_ptr<v8::BackingStore> contents = arrayBuffer->GetBackingStore();
|
|
123
|
+
#if NODE_MAJOR_VERSION >= 18
|
|
146
124
|
length = arrayBuffer->ByteLength();
|
|
147
|
-
|
|
125
|
+
auto store = arrayBuffer->GetBackingStore();
|
|
126
|
+
data = reinterpret_cast<char*>(store->Data());
|
|
148
127
|
#else
|
|
149
128
|
ArrayBuffer::Contents contents = arrayBuffer->GetContents();
|
|
150
129
|
length = contents.ByteLength();
|
|
@@ -212,11 +191,7 @@ inline Local<Value> wrapMessage(const char *message, size_t length,
|
|
|
212
191
|
return (Local<Value>)v8::ArrayBuffer::New(isolate, std::move(backing));
|
|
213
192
|
}
|
|
214
193
|
|
|
215
|
-
|
|
216
|
-
return (Local<Value>)String::NewFromUtf8(isolate, message, NewStringType::kNormal, length).ToLocalChecked();
|
|
217
|
-
#else
|
|
218
|
-
return (Local<Value>)String::NewFromUtf8(isolate, message, String::kNormalString, length);
|
|
219
|
-
#endif
|
|
194
|
+
return (Local<Value>)String::NewFromUtf8(isolate, message, NewStringType::kNormal, length).ToLocalChecked();
|
|
220
195
|
}
|
|
221
196
|
|
|
222
197
|
template <bool isServer>
|
|
@@ -271,28 +246,26 @@ void getAddress(const FunctionCallbackInfo<Value> &args) {
|
|
|
271
246
|
unwrapSocket<isServer>(args[0].As<External>())->getAddress();
|
|
272
247
|
Local<Array> array = Array::New(args.GetIsolate(), 3);
|
|
273
248
|
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
array->Set(args.GetIsolate()->GetCurrentContext(), 2, String::NewFromUtf8(args.GetIsolate(), address.family).ToLocalChecked());
|
|
278
|
-
#else
|
|
279
|
-
array->Set(0, Integer::New(args.GetIsolate(), address.port));
|
|
280
|
-
array->Set(1, String::NewFromUtf8(args.GetIsolate(), address.address));
|
|
281
|
-
array->Set(2, String::NewFromUtf8(args.GetIsolate(), address.family));
|
|
282
|
-
#endif
|
|
249
|
+
array->Set(args.GetIsolate()->GetCurrentContext(), 0, Integer::New(args.GetIsolate(), address.port));
|
|
250
|
+
array->Set(args.GetIsolate()->GetCurrentContext(), 1, String::NewFromUtf8(args.GetIsolate(), address.address).ToLocalChecked());
|
|
251
|
+
array->Set(args.GetIsolate()->GetCurrentContext(), 2, String::NewFromUtf8(args.GetIsolate(), address.family).ToLocalChecked());
|
|
283
252
|
|
|
284
253
|
args.GetReturnValue().Set(array);
|
|
285
254
|
}
|
|
286
255
|
|
|
287
256
|
uv_handle_t *getTcpHandle(void *handleWrap) {
|
|
288
|
-
volatile char *memory = (volatile char *)handleWrap;
|
|
289
|
-
for (volatile uv_handle_t *tcpHandle = (volatile uv_handle_t *)memory;
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
}
|
|
295
|
-
return (uv_handle_t *)memory;
|
|
257
|
+
// volatile char *memory = (volatile char *)handleWrap;
|
|
258
|
+
// for (volatile uv_handle_t *tcpHandle = (volatile uv_handle_t *)memory;
|
|
259
|
+
// tcpHandle->type != UV_TCP || tcpHandle->data != handleWrap ||
|
|
260
|
+
// tcpHandle->loop != uv_default_loop();
|
|
261
|
+
// tcpHandle = (volatile uv_handle_t *)memory) {
|
|
262
|
+
// memory++;
|
|
263
|
+
// }
|
|
264
|
+
// return (uv_handle_t *)memory;
|
|
265
|
+
|
|
266
|
+
// TODO? above is the old @clusterws/cWS code. Is the above needed for TLS handles?
|
|
267
|
+
// Below is the proper way to get the handle in a type-safe way.
|
|
268
|
+
return static_cast<node::TCPWrap*>(handleWrap)->GetHandle();
|
|
296
269
|
}
|
|
297
270
|
|
|
298
271
|
struct SendCallbackData {
|
|
@@ -372,6 +345,10 @@ void upgrade(const FunctionCallbackInfo<Value> &args) {
|
|
|
372
345
|
delete ticket;
|
|
373
346
|
}
|
|
374
347
|
|
|
348
|
+
constexpr uint16_t kDefaultCppGCEmebdderID = 0x90de;
|
|
349
|
+
// https://github.com/nodejs/node/blob/22f383dcd529d6bf790856db614a35fea78e825f/src/env.cc#L506
|
|
350
|
+
|
|
351
|
+
|
|
375
352
|
void transfer(const FunctionCallbackInfo<Value> &args) {
|
|
376
353
|
// (_handle.fd OR _handle), SSL
|
|
377
354
|
uv_handle_t *handle = nullptr;
|
|
@@ -379,9 +356,11 @@ void transfer(const FunctionCallbackInfo<Value> &args) {
|
|
|
379
356
|
if (args[0]->IsObject()) {
|
|
380
357
|
Isolate* isolate = args.GetIsolate();
|
|
381
358
|
Local<Context> context = isolate->GetCurrentContext();
|
|
359
|
+
auto arg_0 = args[0]->ToObject(context).ToLocalChecked();
|
|
360
|
+
auto field_to_get = arg_0->InternalFieldCount() > 3 ? 1 : 0;
|
|
382
361
|
|
|
383
362
|
uv_fileno((handle = getTcpHandle(
|
|
384
|
-
|
|
363
|
+
arg_0->GetAlignedPointerFromInternalField(field_to_get))),
|
|
385
364
|
(uv_os_fd_t *)&ticket->fd);
|
|
386
365
|
} else {
|
|
387
366
|
ticket->fd = args[0].As<Integer>()->Value();
|
|
@@ -637,13 +616,8 @@ void getSSLContext(const FunctionCallbackInfo<Value> &args) {
|
|
|
637
616
|
Isolate* isolate = args.GetIsolate();
|
|
638
617
|
if(args.Length() < 1 || !args[0]->IsObject()){
|
|
639
618
|
|
|
640
|
-
|
|
641
|
-
isolate
|
|
642
|
-
String::NewFromUtf8(isolate, "Error: One object expected").ToLocalChecked()));
|
|
643
|
-
#else
|
|
644
|
-
isolate->ThrowException(Exception::TypeError(
|
|
645
|
-
String::NewFromUtf8(isolate, "Error: One object expected")));
|
|
646
|
-
#endif
|
|
619
|
+
isolate->ThrowException(Exception::TypeError(
|
|
620
|
+
String::NewFromUtf8(isolate, "Error: One object expected").ToLocalChecked()));
|
|
647
621
|
|
|
648
622
|
return;
|
|
649
623
|
}
|
|
@@ -651,14 +625,9 @@ void getSSLContext(const FunctionCallbackInfo<Value> &args) {
|
|
|
651
625
|
Local<Context> context = isolate->GetCurrentContext();
|
|
652
626
|
Local<Object> obj = args[0]->ToObject(context).ToLocalChecked();
|
|
653
627
|
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
#else
|
|
658
|
-
TLSWrapSSLGetter* tw;
|
|
659
|
-
ASSIGN_OR_RETURN_UNWRAP(&tw, obj);
|
|
660
|
-
tw->setSSL(args);
|
|
661
|
-
#endif
|
|
628
|
+
TLSWrapSSLGetter* tw;
|
|
629
|
+
ASSIGN_OR_RETURN_UNWRAP(&tw, obj);
|
|
630
|
+
tw->setSSL(args);
|
|
662
631
|
}
|
|
663
632
|
|
|
664
633
|
void setNoop(const FunctionCallbackInfo<Value> &args) {
|
|
@@ -705,10 +674,6 @@ struct Namespace {
|
|
|
705
674
|
NODE_SET_METHOD(group, "terminate", terminateGroup<isServer>);
|
|
706
675
|
NODE_SET_METHOD(group, "broadcast", broadcast<isServer>);
|
|
707
676
|
|
|
708
|
-
|
|
709
|
-
object->Set(isolate->GetCurrentContext(), String::NewFromUtf8(isolate, "group").ToLocalChecked(), group);
|
|
710
|
-
#else
|
|
711
|
-
object->Set(String::NewFromUtf8(isolate, "group"), group);
|
|
712
|
-
#endif
|
|
677
|
+
object->Set(isolate->GetCurrentContext(), String::NewFromUtf8(isolate, "group").ToLocalChecked(), group);
|
|
713
678
|
}
|
|
714
679
|
};
|
package/src/Socket.h
CHANGED
|
@@ -407,6 +407,7 @@ protected:
|
|
|
407
407
|
}
|
|
408
408
|
}
|
|
409
409
|
} else {
|
|
410
|
+
printf("Enqueue\n");
|
|
410
411
|
Queue::Message *messagePtr = allocMessage(estimatedLength - sizeof(Queue::Message));
|
|
411
412
|
messagePtr->length = T::transform(message, (char *) messagePtr->data, length, transformData);
|
|
412
413
|
messagePtr->callback = callback;
|
package/src/cSNode.cpp
CHANGED
|
@@ -56,14 +56,9 @@ Node::Node(int recvLength, int prePadding, int postPadding, bool useDefaultLoop)
|
|
|
56
56
|
nodeData->preAlloc[i] = nullptr;
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
SSL_CTX_set_max_proto_version(nodeData->clientContext, TLS1_2_VERSION);
|
|
63
|
-
#else
|
|
64
|
-
nodeData->clientContext = SSL_CTX_new(SSLv23_client_method());
|
|
65
|
-
SSL_CTX_set_options(nodeData->clientContext, SSL_OP_NO_SSLv3);
|
|
66
|
-
#endif
|
|
59
|
+
nodeData->clientContext = SSL_CTX_new(TLS_method());
|
|
60
|
+
SSL_CTX_set_min_proto_version(nodeData->clientContext, TLS1_VERSION);
|
|
61
|
+
SSL_CTX_set_max_proto_version(nodeData->clientContext, TLS1_2_VERSION);
|
|
67
62
|
}
|
|
68
63
|
|
|
69
64
|
void Node::run() {
|