node-datachannel 0.5.0-dev → 0.5.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/CMakeLists.txt +1 -1
- package/examples/electron-demo/package-lock.json +164 -419
- package/examples/electron-demo/package.json +2 -2
- package/lib/index.d.ts +5 -0
- package/lib/index.js +33 -2
- package/package.json +1 -5
- package/polyfill/RTCDtlsTransport.js +30 -12
- package/polyfill/RTCIceCandidate.js +1 -1
- package/polyfill/RTCIceTransport.js +48 -21
- package/polyfill/RTCPeerConnection.js +46 -23
- package/polyfill/RTCSctpTransport.js +33 -14
- package/src/peer-connection-wrapper.cpp +50 -0
- package/src/peer-connection-wrapper.h +2 -0
- package/test/connectivity.js +1 -1
- package/test/polyfill-connectivity.js +2 -1
- package/test/test.js +2 -2
- package/examples/build/Dockerfile +0 -30
- package/examples/build/README.md +0 -24
- package/node_modules/base64-js/LICENSE +0 -21
- package/node_modules/base64-js/README.md +0 -34
- package/node_modules/base64-js/base64js.min.js +0 -1
- package/node_modules/base64-js/index.d.ts +0 -3
- package/node_modules/base64-js/index.js +0 -150
- package/node_modules/base64-js/package.json +0 -47
- package/node_modules/buffer/AUTHORS.md +0 -70
- package/node_modules/buffer/LICENSE +0 -21
- package/node_modules/buffer/README.md +0 -410
- package/node_modules/buffer/index.d.ts +0 -186
- package/node_modules/buffer/index.js +0 -1817
- package/node_modules/buffer/package.json +0 -96
- package/node_modules/chownr/LICENSE +0 -15
- package/node_modules/chownr/README.md +0 -3
- package/node_modules/chownr/chownr.js +0 -167
- package/node_modules/chownr/package.json +0 -29
- package/node_modules/decompress-response/index.d.ts +0 -22
- package/node_modules/decompress-response/index.js +0 -58
- package/node_modules/decompress-response/license +0 -9
- package/node_modules/decompress-response/package.json +0 -56
- package/node_modules/decompress-response/readme.md +0 -48
- package/node_modules/deep-extend/CHANGELOG.md +0 -46
- package/node_modules/deep-extend/LICENSE +0 -20
- package/node_modules/deep-extend/README.md +0 -91
- package/node_modules/deep-extend/index.js +0 -1
- package/node_modules/deep-extend/lib/deep-extend.js +0 -150
- package/node_modules/deep-extend/package.json +0 -62
- package/node_modules/detect-libc/LICENSE +0 -201
- package/node_modules/detect-libc/README.md +0 -163
- package/node_modules/detect-libc/index.d.ts +0 -14
- package/node_modules/detect-libc/lib/detect-libc.js +0 -279
- package/node_modules/detect-libc/lib/filesystem.js +0 -41
- package/node_modules/detect-libc/lib/process.js +0 -19
- package/node_modules/detect-libc/package.json +0 -40
- package/node_modules/end-of-stream/LICENSE +0 -21
- package/node_modules/end-of-stream/README.md +0 -54
- package/node_modules/end-of-stream/index.js +0 -94
- package/node_modules/end-of-stream/package.json +0 -37
- package/node_modules/expand-template/.travis.yml +0 -6
- package/node_modules/expand-template/LICENSE +0 -21
- package/node_modules/expand-template/README.md +0 -43
- package/node_modules/expand-template/index.js +0 -26
- package/node_modules/expand-template/package.json +0 -29
- package/node_modules/expand-template/test.js +0 -67
- package/node_modules/fs-constants/LICENSE +0 -21
- package/node_modules/fs-constants/README.md +0 -26
- package/node_modules/fs-constants/browser.js +0 -1
- package/node_modules/fs-constants/index.js +0 -1
- package/node_modules/fs-constants/package.json +0 -19
- package/node_modules/github-from-package/.travis.yml +0 -4
- package/node_modules/github-from-package/LICENSE +0 -18
- package/node_modules/github-from-package/example/package.json +0 -8
- package/node_modules/github-from-package/example/url.js +0 -3
- package/node_modules/github-from-package/index.js +0 -17
- package/node_modules/github-from-package/package.json +0 -30
- package/node_modules/github-from-package/readme.markdown +0 -53
- package/node_modules/github-from-package/test/a.json +0 -8
- package/node_modules/github-from-package/test/b.json +0 -5
- package/node_modules/github-from-package/test/c.json +0 -5
- package/node_modules/github-from-package/test/d.json +0 -7
- package/node_modules/github-from-package/test/e.json +0 -5
- package/node_modules/github-from-package/test/url.js +0 -19
- package/node_modules/ieee754/LICENSE +0 -11
- package/node_modules/ieee754/README.md +0 -51
- package/node_modules/ieee754/index.d.ts +0 -10
- package/node_modules/ieee754/index.js +0 -85
- package/node_modules/ieee754/package.json +0 -52
- package/node_modules/inherits/LICENSE +0 -16
- package/node_modules/inherits/README.md +0 -42
- package/node_modules/inherits/inherits.js +0 -9
- package/node_modules/inherits/inherits_browser.js +0 -27
- package/node_modules/inherits/package.json +0 -29
- package/node_modules/ini/LICENSE +0 -15
- package/node_modules/ini/README.md +0 -102
- package/node_modules/ini/ini.js +0 -206
- package/node_modules/ini/package.json +0 -33
- package/node_modules/mimic-response/index.d.ts +0 -17
- package/node_modules/mimic-response/index.js +0 -77
- package/node_modules/mimic-response/license +0 -9
- package/node_modules/mimic-response/package.json +0 -42
- package/node_modules/mimic-response/readme.md +0 -78
- package/node_modules/minimist/.eslintrc +0 -29
- package/node_modules/minimist/.github/FUNDING.yml +0 -12
- package/node_modules/minimist/.nycrc +0 -14
- package/node_modules/minimist/CHANGELOG.md +0 -298
- package/node_modules/minimist/LICENSE +0 -18
- package/node_modules/minimist/README.md +0 -121
- package/node_modules/minimist/example/parse.js +0 -4
- package/node_modules/minimist/index.js +0 -263
- package/node_modules/minimist/package.json +0 -75
- package/node_modules/minimist/test/all_bool.js +0 -34
- package/node_modules/minimist/test/bool.js +0 -177
- package/node_modules/minimist/test/dash.js +0 -43
- package/node_modules/minimist/test/default_bool.js +0 -37
- package/node_modules/minimist/test/dotted.js +0 -24
- package/node_modules/minimist/test/kv_short.js +0 -32
- package/node_modules/minimist/test/long.js +0 -33
- package/node_modules/minimist/test/num.js +0 -38
- package/node_modules/minimist/test/parse.js +0 -209
- package/node_modules/minimist/test/parse_modified.js +0 -11
- package/node_modules/minimist/test/proto.js +0 -64
- package/node_modules/minimist/test/short.js +0 -69
- package/node_modules/minimist/test/stop_early.js +0 -17
- package/node_modules/minimist/test/unknown.js +0 -104
- package/node_modules/minimist/test/whitespace.js +0 -10
- package/node_modules/mkdirp-classic/LICENSE +0 -21
- package/node_modules/mkdirp-classic/README.md +0 -18
- package/node_modules/mkdirp-classic/index.js +0 -98
- package/node_modules/mkdirp-classic/package.json +0 -18
- package/node_modules/napi-build-utils/LICENSE +0 -21
- package/node_modules/napi-build-utils/README.md +0 -48
- package/node_modules/napi-build-utils/index.js +0 -213
- package/node_modules/napi-build-utils/index.md +0 -81
- package/node_modules/napi-build-utils/package.json +0 -41
- package/node_modules/node-abi/LICENSE +0 -21
- package/node_modules/node-abi/README.md +0 -52
- package/node_modules/node-abi/abi_registry.json +0 -276
- package/node_modules/node-abi/index.js +0 -179
- package/node_modules/node-abi/package.json +0 -41
- package/node_modules/once/LICENSE +0 -15
- package/node_modules/once/README.md +0 -79
- package/node_modules/once/once.js +0 -42
- package/node_modules/once/package.json +0 -33
- package/node_modules/prebuild-install/CHANGELOG.md +0 -116
- package/node_modules/prebuild-install/CONTRIBUTING.md +0 -6
- package/node_modules/prebuild-install/LICENSE +0 -21
- package/node_modules/prebuild-install/README.md +0 -163
- package/node_modules/prebuild-install/asset.js +0 -44
- package/node_modules/prebuild-install/bin.js +0 -78
- package/node_modules/prebuild-install/download.js +0 -142
- package/node_modules/prebuild-install/error.js +0 -14
- package/node_modules/prebuild-install/help.txt +0 -16
- package/node_modules/prebuild-install/index.js +0 -1
- package/node_modules/prebuild-install/log.js +0 -33
- package/node_modules/prebuild-install/package.json +0 -67
- package/node_modules/prebuild-install/proxy.js +0 -35
- package/node_modules/prebuild-install/rc.js +0 -64
- package/node_modules/prebuild-install/util.js +0 -143
- package/node_modules/pump/.travis.yml +0 -5
- package/node_modules/pump/LICENSE +0 -21
- package/node_modules/pump/README.md +0 -65
- package/node_modules/pump/index.js +0 -82
- package/node_modules/pump/package.json +0 -24
- package/node_modules/pump/test-browser.js +0 -66
- package/node_modules/pump/test-node.js +0 -53
- package/node_modules/rc/LICENSE.APACHE2 +0 -15
- package/node_modules/rc/LICENSE.BSD +0 -26
- package/node_modules/rc/LICENSE.MIT +0 -24
- package/node_modules/rc/README.md +0 -227
- package/node_modules/rc/browser.js +0 -7
- package/node_modules/rc/cli.js +0 -4
- package/node_modules/rc/index.js +0 -53
- package/node_modules/rc/lib/utils.js +0 -104
- package/node_modules/rc/node_modules/strip-json-comments/index.js +0 -70
- package/node_modules/rc/node_modules/strip-json-comments/license +0 -21
- package/node_modules/rc/node_modules/strip-json-comments/package.json +0 -42
- package/node_modules/rc/node_modules/strip-json-comments/readme.md +0 -64
- package/node_modules/rc/package.json +0 -29
- package/node_modules/rc/test/ini.js +0 -16
- package/node_modules/rc/test/nested-env-vars.js +0 -50
- package/node_modules/rc/test/test.js +0 -59
- package/node_modules/safe-buffer/LICENSE +0 -21
- package/node_modules/safe-buffer/README.md +0 -584
- package/node_modules/safe-buffer/index.d.ts +0 -187
- package/node_modules/safe-buffer/index.js +0 -65
- package/node_modules/safe-buffer/package.json +0 -51
- package/node_modules/semver/LICENSE +0 -15
- package/node_modules/semver/README.md +0 -637
- package/node_modules/semver/bin/semver.js +0 -197
- package/node_modules/semver/classes/comparator.js +0 -141
- package/node_modules/semver/classes/index.js +0 -5
- package/node_modules/semver/classes/range.js +0 -539
- package/node_modules/semver/classes/semver.js +0 -302
- package/node_modules/semver/functions/clean.js +0 -6
- package/node_modules/semver/functions/cmp.js +0 -52
- package/node_modules/semver/functions/coerce.js +0 -52
- package/node_modules/semver/functions/compare-build.js +0 -7
- package/node_modules/semver/functions/compare-loose.js +0 -3
- package/node_modules/semver/functions/compare.js +0 -5
- package/node_modules/semver/functions/diff.js +0 -65
- package/node_modules/semver/functions/eq.js +0 -3
- package/node_modules/semver/functions/gt.js +0 -3
- package/node_modules/semver/functions/gte.js +0 -3
- package/node_modules/semver/functions/inc.js +0 -19
- package/node_modules/semver/functions/lt.js +0 -3
- package/node_modules/semver/functions/lte.js +0 -3
- package/node_modules/semver/functions/major.js +0 -3
- package/node_modules/semver/functions/minor.js +0 -3
- package/node_modules/semver/functions/neq.js +0 -3
- package/node_modules/semver/functions/parse.js +0 -16
- package/node_modules/semver/functions/patch.js +0 -3
- package/node_modules/semver/functions/prerelease.js +0 -6
- package/node_modules/semver/functions/rcompare.js +0 -3
- package/node_modules/semver/functions/rsort.js +0 -3
- package/node_modules/semver/functions/satisfies.js +0 -10
- package/node_modules/semver/functions/sort.js +0 -3
- package/node_modules/semver/functions/valid.js +0 -6
- package/node_modules/semver/index.js +0 -89
- package/node_modules/semver/internal/constants.js +0 -35
- package/node_modules/semver/internal/debug.js +0 -9
- package/node_modules/semver/internal/identifiers.js +0 -23
- package/node_modules/semver/internal/parse-options.js +0 -15
- package/node_modules/semver/internal/re.js +0 -212
- package/node_modules/semver/node_modules/lru-cache/LICENSE +0 -15
- package/node_modules/semver/node_modules/lru-cache/README.md +0 -166
- package/node_modules/semver/node_modules/lru-cache/index.js +0 -334
- package/node_modules/semver/node_modules/lru-cache/package.json +0 -34
- package/node_modules/semver/node_modules/yallist/LICENSE +0 -15
- package/node_modules/semver/node_modules/yallist/README.md +0 -204
- package/node_modules/semver/node_modules/yallist/iterator.js +0 -8
- package/node_modules/semver/node_modules/yallist/package.json +0 -29
- package/node_modules/semver/node_modules/yallist/yallist.js +0 -426
- package/node_modules/semver/package.json +0 -87
- package/node_modules/semver/preload.js +0 -2
- package/node_modules/semver/range.bnf +0 -16
- package/node_modules/semver/ranges/gtr.js +0 -4
- package/node_modules/semver/ranges/intersects.js +0 -7
- package/node_modules/semver/ranges/ltr.js +0 -4
- package/node_modules/semver/ranges/max-satisfying.js +0 -25
- package/node_modules/semver/ranges/min-satisfying.js +0 -24
- package/node_modules/semver/ranges/min-version.js +0 -61
- package/node_modules/semver/ranges/outside.js +0 -80
- package/node_modules/semver/ranges/simplify.js +0 -47
- package/node_modules/semver/ranges/subset.js +0 -247
- package/node_modules/semver/ranges/to-comparators.js +0 -8
- package/node_modules/semver/ranges/valid.js +0 -11
- package/node_modules/simple-concat/.travis.yml +0 -3
- package/node_modules/simple-concat/LICENSE +0 -20
- package/node_modules/simple-concat/README.md +0 -44
- package/node_modules/simple-concat/index.js +0 -15
- package/node_modules/simple-concat/package.json +0 -47
- package/node_modules/simple-concat/test/basic.js +0 -41
- package/node_modules/simple-get/.github/dependabot.yml +0 -15
- package/node_modules/simple-get/.github/workflows/ci.yml +0 -23
- package/node_modules/simple-get/LICENSE +0 -20
- package/node_modules/simple-get/README.md +0 -333
- package/node_modules/simple-get/index.js +0 -108
- package/node_modules/simple-get/package.json +0 -67
- package/node_modules/tar-fs/.travis.yml +0 -6
- package/node_modules/tar-fs/LICENSE +0 -21
- package/node_modules/tar-fs/README.md +0 -165
- package/node_modules/tar-fs/index.js +0 -351
- package/node_modules/tar-fs/node_modules/bl/.travis.yml +0 -17
- package/node_modules/tar-fs/node_modules/bl/BufferList.js +0 -396
- package/node_modules/tar-fs/node_modules/bl/LICENSE.md +0 -13
- package/node_modules/tar-fs/node_modules/bl/README.md +0 -247
- package/node_modules/tar-fs/node_modules/bl/bl.js +0 -84
- package/node_modules/tar-fs/node_modules/bl/package.json +0 -37
- package/node_modules/tar-fs/node_modules/bl/test/convert.js +0 -21
- package/node_modules/tar-fs/node_modules/bl/test/indexOf.js +0 -492
- package/node_modules/tar-fs/node_modules/bl/test/isBufferList.js +0 -32
- package/node_modules/tar-fs/node_modules/bl/test/test.js +0 -869
- package/node_modules/tar-fs/node_modules/readable-stream/CONTRIBUTING.md +0 -38
- package/node_modules/tar-fs/node_modules/readable-stream/GOVERNANCE.md +0 -136
- package/node_modules/tar-fs/node_modules/readable-stream/LICENSE +0 -47
- package/node_modules/tar-fs/node_modules/readable-stream/README.md +0 -106
- package/node_modules/tar-fs/node_modules/readable-stream/errors-browser.js +0 -127
- package/node_modules/tar-fs/node_modules/readable-stream/errors.js +0 -116
- package/node_modules/tar-fs/node_modules/readable-stream/experimentalWarning.js +0 -17
- package/node_modules/tar-fs/node_modules/readable-stream/lib/_stream_duplex.js +0 -126
- package/node_modules/tar-fs/node_modules/readable-stream/lib/_stream_passthrough.js +0 -37
- package/node_modules/tar-fs/node_modules/readable-stream/lib/_stream_readable.js +0 -1027
- package/node_modules/tar-fs/node_modules/readable-stream/lib/_stream_transform.js +0 -190
- package/node_modules/tar-fs/node_modules/readable-stream/lib/_stream_writable.js +0 -641
- package/node_modules/tar-fs/node_modules/readable-stream/lib/internal/streams/async_iterator.js +0 -180
- package/node_modules/tar-fs/node_modules/readable-stream/lib/internal/streams/buffer_list.js +0 -183
- package/node_modules/tar-fs/node_modules/readable-stream/lib/internal/streams/destroy.js +0 -96
- package/node_modules/tar-fs/node_modules/readable-stream/lib/internal/streams/end-of-stream.js +0 -86
- package/node_modules/tar-fs/node_modules/readable-stream/lib/internal/streams/from-browser.js +0 -3
- package/node_modules/tar-fs/node_modules/readable-stream/lib/internal/streams/from.js +0 -52
- package/node_modules/tar-fs/node_modules/readable-stream/lib/internal/streams/pipeline.js +0 -86
- package/node_modules/tar-fs/node_modules/readable-stream/lib/internal/streams/state.js +0 -22
- package/node_modules/tar-fs/node_modules/readable-stream/lib/internal/streams/stream-browser.js +0 -1
- package/node_modules/tar-fs/node_modules/readable-stream/lib/internal/streams/stream.js +0 -1
- package/node_modules/tar-fs/node_modules/readable-stream/package.json +0 -68
- package/node_modules/tar-fs/node_modules/readable-stream/readable-browser.js +0 -9
- package/node_modules/tar-fs/node_modules/readable-stream/readable.js +0 -16
- package/node_modules/tar-fs/node_modules/string_decoder/LICENSE +0 -48
- package/node_modules/tar-fs/node_modules/string_decoder/README.md +0 -47
- package/node_modules/tar-fs/node_modules/string_decoder/lib/string_decoder.js +0 -296
- package/node_modules/tar-fs/node_modules/string_decoder/package.json +0 -34
- package/node_modules/tar-fs/node_modules/tar-stream/LICENSE +0 -21
- package/node_modules/tar-fs/node_modules/tar-stream/README.md +0 -168
- package/node_modules/tar-fs/node_modules/tar-stream/extract.js +0 -257
- package/node_modules/tar-fs/node_modules/tar-stream/headers.js +0 -295
- package/node_modules/tar-fs/node_modules/tar-stream/index.js +0 -2
- package/node_modules/tar-fs/node_modules/tar-stream/pack.js +0 -255
- package/node_modules/tar-fs/node_modules/tar-stream/package.json +0 -58
- package/node_modules/tar-fs/node_modules/tar-stream/sandbox.js +0 -11
- package/node_modules/tar-fs/package.json +0 -41
- package/node_modules/tar-fs/test/fixtures/a/hello.txt +0 -1
- package/node_modules/tar-fs/test/fixtures/b/a/test.txt +0 -1
- package/node_modules/tar-fs/test/fixtures/d/file1 +0 -0
- package/node_modules/tar-fs/test/fixtures/d/file2 +0 -0
- package/node_modules/tar-fs/test/fixtures/d/sub-dir/file5 +0 -0
- package/node_modules/tar-fs/test/fixtures/d/sub-files/file3 +0 -0
- package/node_modules/tar-fs/test/fixtures/d/sub-files/file4 +0 -0
- package/node_modules/tar-fs/test/fixtures/e/directory/.ignore +0 -0
- package/node_modules/tar-fs/test/fixtures/e/file +0 -0
- package/node_modules/tar-fs/test/fixtures/invalid.tar +0 -0
- package/node_modules/tar-fs/test/index.js +0 -346
- package/node_modules/tunnel-agent/LICENSE +0 -55
- package/node_modules/tunnel-agent/README.md +0 -4
- package/node_modules/tunnel-agent/index.js +0 -244
- package/node_modules/tunnel-agent/package.json +0 -22
- package/node_modules/util-deprecate/History.md +0 -16
- package/node_modules/util-deprecate/LICENSE +0 -24
- package/node_modules/util-deprecate/README.md +0 -53
- package/node_modules/util-deprecate/browser.js +0 -67
- package/node_modules/util-deprecate/node.js +0 -6
- package/node_modules/util-deprecate/package.json +0 -27
- package/node_modules/wrappy/LICENSE +0 -15
- package/node_modules/wrappy/README.md +0 -36
- package/node_modules/wrappy/package.json +0 -29
- package/node_modules/wrappy/wrappy.js +0 -33
|
@@ -28,13 +28,13 @@
|
|
|
28
28
|
"@electron/rebuild": "^3.3.0",
|
|
29
29
|
"@vercel/webpack-asset-relocator-loader": "^1.7.3",
|
|
30
30
|
"css-loader": "^6.8.1",
|
|
31
|
-
"electron": "26.2.
|
|
31
|
+
"electron": "26.2.4",
|
|
32
32
|
"node-loader": "^2.0.0",
|
|
33
33
|
"style-loader": "^3.3.3"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"electron-squirrel-startup": "^1.0.0",
|
|
37
|
-
"node-datachannel": "0.5.0"
|
|
37
|
+
"node-datachannel": "0.5.0-dev"
|
|
38
38
|
},
|
|
39
39
|
"cmake-js": {
|
|
40
40
|
"runtime": "electron",
|
package/lib/index.d.ts
CHANGED
|
@@ -98,6 +98,9 @@ export interface SelectedCandidateInfo {
|
|
|
98
98
|
port: number;
|
|
99
99
|
type: string;
|
|
100
100
|
transportType: string;
|
|
101
|
+
candidate: string;
|
|
102
|
+
mid: string;
|
|
103
|
+
priority: number;
|
|
101
104
|
}
|
|
102
105
|
|
|
103
106
|
// Must be same as rtc enum class Direction
|
|
@@ -232,6 +235,8 @@ export class PeerConnection {
|
|
|
232
235
|
bytesReceived(): number;
|
|
233
236
|
rtt(): number;
|
|
234
237
|
getSelectedCandidatePair(): { local: SelectedCandidateInfo; remote: SelectedCandidateInfo } | null;
|
|
238
|
+
maxDataChannelId(): number;
|
|
239
|
+
maxMessageSize(): number;
|
|
235
240
|
}
|
|
236
241
|
|
|
237
242
|
export class DataChannelStream extends stream.Duplex {
|
package/lib/index.js
CHANGED
|
@@ -3,6 +3,37 @@ import { createRequire } from 'module';
|
|
|
3
3
|
const require = createRequire(import.meta.url);
|
|
4
4
|
|
|
5
5
|
const nodeDataChannel = require('../build/Release/node_datachannel.node');
|
|
6
|
+
import DataChannelStream from './datachannel-stream.js';
|
|
6
7
|
|
|
7
|
-
|
|
8
|
-
|
|
8
|
+
const {
|
|
9
|
+
initLogger,
|
|
10
|
+
cleanup,
|
|
11
|
+
preload,
|
|
12
|
+
setSctpSettings,
|
|
13
|
+
RtcpReceivingSession,
|
|
14
|
+
Track,
|
|
15
|
+
Video,
|
|
16
|
+
Audio,
|
|
17
|
+
DataChannel,
|
|
18
|
+
PeerConnection,
|
|
19
|
+
} = nodeDataChannel;
|
|
20
|
+
|
|
21
|
+
export {
|
|
22
|
+
initLogger,
|
|
23
|
+
cleanup,
|
|
24
|
+
preload,
|
|
25
|
+
setSctpSettings,
|
|
26
|
+
RtcpReceivingSession,
|
|
27
|
+
Track,
|
|
28
|
+
Video,
|
|
29
|
+
Audio,
|
|
30
|
+
DataChannel,
|
|
31
|
+
PeerConnection,
|
|
32
|
+
// Extra exports
|
|
33
|
+
DataChannelStream,
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export default {
|
|
37
|
+
...nodeDataChannel,
|
|
38
|
+
DataChannelStream,
|
|
39
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "node-datachannel",
|
|
3
|
-
"version": "0.5.0
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "libdatachannel node bindings",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -60,7 +60,6 @@
|
|
|
60
60
|
}
|
|
61
61
|
],
|
|
62
62
|
"license": "MPL 2.0",
|
|
63
|
-
"gypfile": true,
|
|
64
63
|
"bugs": {
|
|
65
64
|
"url": "https://github.com/murat-dogan/node-datachannel/issues"
|
|
66
65
|
},
|
|
@@ -79,9 +78,6 @@
|
|
|
79
78
|
"prettier": "^2.8.8",
|
|
80
79
|
"typescript": "^4.6.3"
|
|
81
80
|
},
|
|
82
|
-
"bundledDependencies": [
|
|
83
|
-
"prebuild-install"
|
|
84
|
-
],
|
|
85
81
|
"dependencies": {
|
|
86
82
|
"node-domexception": "^2.0.1",
|
|
87
83
|
"prebuild-install": "^7.0.1"
|
|
@@ -1,12 +1,29 @@
|
|
|
1
|
+
import RTCIceTransport from './RTCIceTransport.js';
|
|
2
|
+
|
|
1
3
|
export default class _RTCDtlsTransport extends EventTarget {
|
|
4
|
+
#pc = null;
|
|
5
|
+
#extraFunctions = null;
|
|
2
6
|
#iceTransport = null;
|
|
3
|
-
#state = null;
|
|
4
7
|
|
|
5
|
-
onerror =
|
|
6
|
-
onstatechange =
|
|
8
|
+
onerror = null;
|
|
9
|
+
onstatechange = null;
|
|
7
10
|
|
|
8
|
-
constructor() {
|
|
11
|
+
constructor({ pc, extraFunctions }) {
|
|
9
12
|
super();
|
|
13
|
+
this.#pc = pc;
|
|
14
|
+
this.#extraFunctions = extraFunctions;
|
|
15
|
+
|
|
16
|
+
this.#iceTransport = new RTCIceTransport({ pc, extraFunctions });
|
|
17
|
+
|
|
18
|
+
// forward peerConnection events
|
|
19
|
+
this.#pc.addEventListener('connectionstatechange', () => {
|
|
20
|
+
this.dispatchEvent(new Event('statechange'));
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
// forward events to properties
|
|
24
|
+
this.addEventListener('statechange', (e) => {
|
|
25
|
+
if (this.onstatechange) this.onstatechange(e);
|
|
26
|
+
});
|
|
10
27
|
}
|
|
11
28
|
|
|
12
29
|
get iceTransport() {
|
|
@@ -14,16 +31,17 @@ export default class _RTCDtlsTransport extends EventTarget {
|
|
|
14
31
|
}
|
|
15
32
|
|
|
16
33
|
get state() {
|
|
17
|
-
|
|
34
|
+
// reduce state from new, connecting, connected, disconnected, failed, closed, unknown
|
|
35
|
+
// to RTCDtlsTRansport states new, connecting, connected, closed, failed
|
|
36
|
+
let state = this.#pc ? this.#pc.connectionState : 'new';
|
|
37
|
+
if (state === 'disconnected' || state === 'unknown') {
|
|
38
|
+
state = 'closed';
|
|
39
|
+
}
|
|
40
|
+
return state;
|
|
18
41
|
}
|
|
19
42
|
|
|
20
43
|
getRemoteCertificates() {
|
|
21
|
-
|
|
44
|
+
// TODO: implement
|
|
45
|
+
return new ArrayBuffer(0);
|
|
22
46
|
}
|
|
23
47
|
}
|
|
24
|
-
|
|
25
|
-
function createEmptyFunction() {
|
|
26
|
-
return () => {
|
|
27
|
-
/** */
|
|
28
|
-
};
|
|
29
|
-
}
|
|
@@ -34,7 +34,7 @@ export default class _RTCIceCandidate {
|
|
|
34
34
|
if (candidate) {
|
|
35
35
|
const fields = candidate.split(' ');
|
|
36
36
|
this.#foundation = fields[0];
|
|
37
|
-
this.#component = fields[1];
|
|
37
|
+
this.#component = fields[1] == '1' ? 'rtp' : 'rtcp';
|
|
38
38
|
this.#protocol = fields[2];
|
|
39
39
|
this.#priority = parseInt(fields[3], 10);
|
|
40
40
|
this.#ip = fields[4];
|
|
@@ -1,34 +1,56 @@
|
|
|
1
|
+
import RTCIceCandidate from './RTCIceCandidate.js';
|
|
2
|
+
|
|
1
3
|
export default class _RTCIceTransport extends EventTarget {
|
|
2
|
-
#
|
|
3
|
-
#
|
|
4
|
-
#role = null;
|
|
5
|
-
#state = null;
|
|
4
|
+
#pc = null;
|
|
5
|
+
#extraFunctions = null;
|
|
6
6
|
|
|
7
|
-
ongatheringstatechange =
|
|
8
|
-
onselectedcandidatepairchange =
|
|
9
|
-
onstatechange =
|
|
7
|
+
ongatheringstatechange = null;
|
|
8
|
+
onselectedcandidatepairchange = null;
|
|
9
|
+
onstatechange = null;
|
|
10
10
|
|
|
11
|
-
constructor() {
|
|
11
|
+
constructor({ pc, extraFunctions }) {
|
|
12
12
|
super();
|
|
13
|
+
this.#pc = pc;
|
|
14
|
+
this.#extraFunctions = extraFunctions;
|
|
15
|
+
|
|
16
|
+
// forward peerConnection events
|
|
17
|
+
this.#pc.addEventListener('icegatheringstatechange', () => {
|
|
18
|
+
this.dispatchEvent(new Event('gatheringstatechange'));
|
|
19
|
+
});
|
|
20
|
+
this.#pc.addEventListener('iceconnectionstatechange', () => {
|
|
21
|
+
console.log('*********');
|
|
22
|
+
this.dispatchEvent(new Event('statechange'));
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
// forward events to properties
|
|
26
|
+
this.addEventListener('gatheringstatechange', (e) => {
|
|
27
|
+
if (this.ongatheringstatechange) this.ongatheringstatechange(e);
|
|
28
|
+
});
|
|
29
|
+
this.addEventListener('statechange', (e) => {
|
|
30
|
+
if (this.onstatechange) this.onstatechange(e);
|
|
31
|
+
});
|
|
13
32
|
}
|
|
14
33
|
|
|
15
34
|
get component() {
|
|
16
|
-
|
|
35
|
+
let cp = this.getSelectedCandidatePair();
|
|
36
|
+
if (!cp) return null;
|
|
37
|
+
return cp.local.component;
|
|
17
38
|
}
|
|
18
39
|
|
|
19
40
|
get gatheringState() {
|
|
20
|
-
return this.#
|
|
41
|
+
return this.#pc ? this.#pc.iceGatheringState : 'new';
|
|
21
42
|
}
|
|
22
43
|
|
|
23
44
|
get role() {
|
|
24
|
-
return this.#
|
|
45
|
+
return this.#pc.localDescription.type == 'offer' ? 'controlling' : 'controlled';
|
|
25
46
|
}
|
|
26
47
|
|
|
27
48
|
get state() {
|
|
28
|
-
return this.#
|
|
49
|
+
return this.#pc ? this.#pc.iceConnectionState : 'new';
|
|
29
50
|
}
|
|
51
|
+
|
|
30
52
|
getLocalCandidates() {
|
|
31
|
-
|
|
53
|
+
return this.#pc ? this.#extraFunctions.localCandidates() : [];
|
|
32
54
|
}
|
|
33
55
|
|
|
34
56
|
getLocalParameters() {
|
|
@@ -36,7 +58,7 @@ export default class _RTCIceTransport extends EventTarget {
|
|
|
36
58
|
}
|
|
37
59
|
|
|
38
60
|
getRemoteCandidates() {
|
|
39
|
-
|
|
61
|
+
return this.#pc ? this.#extraFunctions.remoteCandidates() : [];
|
|
40
62
|
}
|
|
41
63
|
|
|
42
64
|
getRemoteParameters() {
|
|
@@ -44,12 +66,17 @@ export default class _RTCIceTransport extends EventTarget {
|
|
|
44
66
|
}
|
|
45
67
|
|
|
46
68
|
getSelectedCandidatePair() {
|
|
47
|
-
|
|
69
|
+
let cp = this.#extraFunctions.selectedCandidatePair();
|
|
70
|
+
if (!cp) return null;
|
|
71
|
+
return {
|
|
72
|
+
local: new RTCIceCandidate({
|
|
73
|
+
candidate: cp.local.candidate,
|
|
74
|
+
sdpMid: cp.local.mid,
|
|
75
|
+
}),
|
|
76
|
+
remote: new RTCIceCandidate({
|
|
77
|
+
candidate: cp.remote.candidate,
|
|
78
|
+
sdpMid: cp.remote.mid,
|
|
79
|
+
}),
|
|
80
|
+
};
|
|
48
81
|
}
|
|
49
82
|
}
|
|
50
|
-
|
|
51
|
-
function createEmptyFunction() {
|
|
52
|
-
return () => {
|
|
53
|
-
/** */
|
|
54
|
-
};
|
|
55
|
-
}
|
|
@@ -3,6 +3,7 @@ import RTCSessionDescription from './RTCSessionDescription.js';
|
|
|
3
3
|
import RTCDataChannel from './RTCDataChannel.js';
|
|
4
4
|
import RTCIceCandidate from './RTCIceCandidate.js';
|
|
5
5
|
import { RTCDataChannelEvent, RTCPeerConnectionIceEvent } from './Events.js';
|
|
6
|
+
import RTCSctpTransport from './RTCSctpTransport.js';
|
|
6
7
|
import DOMException from 'node-domexception';
|
|
7
8
|
|
|
8
9
|
export default class _RTCPeerConnection extends EventTarget {
|
|
@@ -14,6 +15,9 @@ export default class _RTCPeerConnection extends EventTarget {
|
|
|
14
15
|
#canTrickleIceCandidates;
|
|
15
16
|
#sctp;
|
|
16
17
|
|
|
18
|
+
#localCandidates = [];
|
|
19
|
+
#remoteCandidates = [];
|
|
20
|
+
|
|
17
21
|
onconnectionstatechange;
|
|
18
22
|
ondatachannel;
|
|
19
23
|
onicecandidate;
|
|
@@ -32,29 +36,23 @@ export default class _RTCPeerConnection extends EventTarget {
|
|
|
32
36
|
this.#localAnswer = createDeferredPromise();
|
|
33
37
|
this.#dataChannels = new Set();
|
|
34
38
|
this.#canTrickleIceCandidates = null;
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
});
|
|
53
|
-
})
|
|
54
|
-
.flat(),
|
|
55
|
-
iceTransportPolicy: init ? init.iceTransportPolicy : undefined,
|
|
56
|
-
},
|
|
57
|
-
);
|
|
39
|
+
|
|
40
|
+
this.#peerConnection = new NodeDataChannel.PeerConnection(init?.peerIdentity ?? `peer-${getRandomString(7)}`, {
|
|
41
|
+
...init,
|
|
42
|
+
iceServers: init?.iceServers
|
|
43
|
+
?.map((server) => {
|
|
44
|
+
const urls = Array.isArray(server.urls) ? server.urls : [server.urls];
|
|
45
|
+
|
|
46
|
+
return urls.map((url) => {
|
|
47
|
+
if (server.username && server.credential) {
|
|
48
|
+
const [protocol, rest] = url.split(/:(.*)/);
|
|
49
|
+
return `${protocol}:${server.username}:${server.credential}@${rest}`;
|
|
50
|
+
}
|
|
51
|
+
return url;
|
|
52
|
+
});
|
|
53
|
+
})
|
|
54
|
+
.flat(),
|
|
55
|
+
});
|
|
58
56
|
|
|
59
57
|
// forward peerConnection events
|
|
60
58
|
this.#peerConnection.onStateChange(() => {
|
|
@@ -95,6 +93,7 @@ export default class _RTCPeerConnection extends EventTarget {
|
|
|
95
93
|
return;
|
|
96
94
|
}
|
|
97
95
|
|
|
96
|
+
this.#localCandidates.push(new RTCIceCandidate({ candidate, sdpMid }));
|
|
98
97
|
this.dispatchEvent(new RTCPeerConnectionIceEvent(new RTCIceCandidate({ candidate, sdpMid })));
|
|
99
98
|
});
|
|
100
99
|
|
|
@@ -117,6 +116,27 @@ export default class _RTCPeerConnection extends EventTarget {
|
|
|
117
116
|
this.addEventListener('icecandidate', (e) => {
|
|
118
117
|
if (this.onicecandidate) this.onicecandidate(e);
|
|
119
118
|
});
|
|
119
|
+
|
|
120
|
+
this.#sctp = new RTCSctpTransport({
|
|
121
|
+
pc: this,
|
|
122
|
+
extraFunctions: {
|
|
123
|
+
maxDataChannelId: () => {
|
|
124
|
+
return this.#peerConnection.maxDataChannelId();
|
|
125
|
+
},
|
|
126
|
+
maxMessageSize: () => {
|
|
127
|
+
return this.#peerConnection.maxMessageSize();
|
|
128
|
+
},
|
|
129
|
+
localCandidates: () => {
|
|
130
|
+
return this.#localCandidates;
|
|
131
|
+
},
|
|
132
|
+
remoteCandidates: () => {
|
|
133
|
+
return this.#remoteCandidates;
|
|
134
|
+
},
|
|
135
|
+
selectedCandidatePair: () => {
|
|
136
|
+
return this.#peerConnection.getSelectedCandidatePair();
|
|
137
|
+
},
|
|
138
|
+
},
|
|
139
|
+
});
|
|
120
140
|
}
|
|
121
141
|
|
|
122
142
|
get canTrickleIceCandidates() {
|
|
@@ -176,6 +196,9 @@ export default class _RTCPeerConnection extends EventTarget {
|
|
|
176
196
|
throw new DOMException('Candidate invalid');
|
|
177
197
|
}
|
|
178
198
|
|
|
199
|
+
this.#remoteCandidates.push(
|
|
200
|
+
new RTCIceCandidate({ candidate: candidate.candidate, sdpMid: candidate.sdpMid || '0' }),
|
|
201
|
+
);
|
|
179
202
|
this.#peerConnection.addRemoteCandidate(candidate.candidate, candidate.sdpMid || '0');
|
|
180
203
|
}
|
|
181
204
|
|
|
@@ -1,34 +1,53 @@
|
|
|
1
|
+
import RTCDtlsTransport from './RTCDtlsTransport.js';
|
|
2
|
+
|
|
1
3
|
export default class _RTCSctpTransport extends EventTarget {
|
|
2
|
-
#
|
|
3
|
-
#
|
|
4
|
-
#state = null;
|
|
4
|
+
#pc = null;
|
|
5
|
+
#extraFunctions = null;
|
|
5
6
|
#transport = null;
|
|
6
7
|
|
|
7
|
-
onstatechange =
|
|
8
|
+
onstatechange = null;
|
|
8
9
|
|
|
9
|
-
constructor(
|
|
10
|
+
constructor({ pc, extraFunctions }) {
|
|
10
11
|
super();
|
|
12
|
+
this.#pc = pc;
|
|
13
|
+
this.#extraFunctions = extraFunctions;
|
|
14
|
+
|
|
15
|
+
this.#transport = new RTCDtlsTransport({ pc, extraFunctions });
|
|
16
|
+
|
|
17
|
+
// forward peerConnection events
|
|
18
|
+
this.#pc.addEventListener('connectionstatechange', () => {
|
|
19
|
+
this.dispatchEvent(new Event('statechange'));
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
// forward events to properties
|
|
23
|
+
this.addEventListener('statechange', (e) => {
|
|
24
|
+
if (this.onstatechange) this.onstatechange(e);
|
|
25
|
+
});
|
|
11
26
|
}
|
|
12
27
|
|
|
13
28
|
get maxChannels() {
|
|
14
|
-
return
|
|
29
|
+
if (this.state !== 'connected') return null;
|
|
30
|
+
return this.#pc ? this.#extraFunctions.maxDataChannelId() : 0;
|
|
15
31
|
}
|
|
16
32
|
|
|
17
33
|
get maxMessageSize() {
|
|
18
|
-
return
|
|
34
|
+
if (this.state !== 'connected') return null;
|
|
35
|
+
return this.#pc ? this.#extraFunctions.maxMessageSize() : 0;
|
|
19
36
|
}
|
|
20
37
|
|
|
21
38
|
get state() {
|
|
22
|
-
|
|
39
|
+
// reduce state from new, connecting, connected, disconnected, failed, closed, unknown
|
|
40
|
+
// to RTCSctpTransport states connecting, connected, closed
|
|
41
|
+
let state = this.#pc.connectionState;
|
|
42
|
+
if (state === 'new' || state === 'connecting') {
|
|
43
|
+
state = 'connecting';
|
|
44
|
+
} else if (state === 'disconnected' || state === 'failed' || state === 'closed' || state === 'unknown') {
|
|
45
|
+
state = 'closed';
|
|
46
|
+
}
|
|
47
|
+
return state;
|
|
23
48
|
}
|
|
24
49
|
|
|
25
50
|
get transport() {
|
|
26
51
|
return this.#transport;
|
|
27
52
|
}
|
|
28
53
|
}
|
|
29
|
-
|
|
30
|
-
function createEmptyFunction() {
|
|
31
|
-
return () => {
|
|
32
|
-
/** */
|
|
33
|
-
};
|
|
34
|
-
}
|
|
@@ -62,6 +62,8 @@ Napi::Object PeerConnectionWrapper::Init(Napi::Env env, Napi::Object exports)
|
|
|
62
62
|
InstanceMethod("bytesReceived", &PeerConnectionWrapper::bytesReceived),
|
|
63
63
|
InstanceMethod("rtt", &PeerConnectionWrapper::rtt),
|
|
64
64
|
InstanceMethod("getSelectedCandidatePair", &PeerConnectionWrapper::getSelectedCandidatePair),
|
|
65
|
+
InstanceMethod("maxDataChannelId", &PeerConnectionWrapper::maxDataChannelId),
|
|
66
|
+
InstanceMethod("maxMessageSize", &PeerConnectionWrapper::maxMessageSize),
|
|
65
67
|
});
|
|
66
68
|
|
|
67
69
|
constructor = Napi::Persistent(func);
|
|
@@ -984,11 +986,17 @@ Napi::Value PeerConnectionWrapper::getSelectedCandidatePair(const Napi::Callback
|
|
|
984
986
|
localObj.Set("port", local.port().value_or(0));
|
|
985
987
|
localObj.Set("type", candidateTypeToString(local.type()));
|
|
986
988
|
localObj.Set("transportType", candidateTransportTypeToString(local.transportType()));
|
|
989
|
+
localObj.Set("candidate", local.candidate());
|
|
990
|
+
localObj.Set("mid", local.mid());
|
|
991
|
+
localObj.Set("priority", local.priority());
|
|
987
992
|
|
|
988
993
|
remoteObj.Set("address", remote.address().value_or("?"));
|
|
989
994
|
remoteObj.Set("port", remote.port().value_or(0));
|
|
990
995
|
remoteObj.Set("type", candidateTypeToString(remote.type()));
|
|
991
996
|
remoteObj.Set("transportType", candidateTransportTypeToString(remote.transportType()));
|
|
997
|
+
remoteObj.Set("candidate", remote.candidate());
|
|
998
|
+
remoteObj.Set("mid", remote.mid());
|
|
999
|
+
remoteObj.Set("priority", remote.priority());
|
|
992
1000
|
|
|
993
1001
|
retvalue.Set("local", localObj);
|
|
994
1002
|
retvalue.Set("remote", remoteObj);
|
|
@@ -1002,6 +1010,48 @@ Napi::Value PeerConnectionWrapper::getSelectedCandidatePair(const Napi::Callback
|
|
|
1002
1010
|
}
|
|
1003
1011
|
}
|
|
1004
1012
|
|
|
1013
|
+
Napi::Value PeerConnectionWrapper::maxDataChannelId(const Napi::CallbackInfo &info)
|
|
1014
|
+
{
|
|
1015
|
+
PLOG_DEBUG << "maxDataChannelId() called";
|
|
1016
|
+
Napi::Env env = info.Env();
|
|
1017
|
+
|
|
1018
|
+
if (!mRtcPeerConnPtr)
|
|
1019
|
+
{
|
|
1020
|
+
return Napi::Number::New(info.Env(), 0);
|
|
1021
|
+
}
|
|
1022
|
+
|
|
1023
|
+
try
|
|
1024
|
+
{
|
|
1025
|
+
return Napi::Number::New(env, mRtcPeerConnPtr->maxDataChannelId());
|
|
1026
|
+
}
|
|
1027
|
+
catch (std::exception &ex)
|
|
1028
|
+
{
|
|
1029
|
+
Napi::Error::New(env, std::string("libdatachannel error: ") + ex.what()).ThrowAsJavaScriptException();
|
|
1030
|
+
return Napi::Number::New(info.Env(), 0);
|
|
1031
|
+
}
|
|
1032
|
+
}
|
|
1033
|
+
|
|
1034
|
+
Napi::Value PeerConnectionWrapper::maxMessageSize(const Napi::CallbackInfo &info)
|
|
1035
|
+
{
|
|
1036
|
+
PLOG_DEBUG << "maxMessageSize() called";
|
|
1037
|
+
Napi::Env env = info.Env();
|
|
1038
|
+
|
|
1039
|
+
if (!mRtcPeerConnPtr)
|
|
1040
|
+
{
|
|
1041
|
+
return Napi::Number::New(info.Env(), 0);
|
|
1042
|
+
}
|
|
1043
|
+
|
|
1044
|
+
try
|
|
1045
|
+
{
|
|
1046
|
+
return Napi::Number::New(env, mRtcPeerConnPtr->remoteMaxMessageSize());
|
|
1047
|
+
}
|
|
1048
|
+
catch (std::exception &ex)
|
|
1049
|
+
{
|
|
1050
|
+
Napi::Error::New(env, std::string("libdatachannel error: ") + ex.what()).ThrowAsJavaScriptException();
|
|
1051
|
+
return Napi::Number::New(info.Env(), 0);
|
|
1052
|
+
}
|
|
1053
|
+
}
|
|
1054
|
+
|
|
1005
1055
|
std::string PeerConnectionWrapper::candidateTypeToString(const rtc::Candidate::Type &type)
|
|
1006
1056
|
{
|
|
1007
1057
|
PLOG_DEBUG << "candidateTypeToString() called";
|
|
@@ -51,6 +51,8 @@ public:
|
|
|
51
51
|
Napi::Value bytesReceived(const Napi::CallbackInfo &info);
|
|
52
52
|
Napi::Value rtt(const Napi::CallbackInfo &info);
|
|
53
53
|
Napi::Value getSelectedCandidatePair(const Napi::CallbackInfo &info);
|
|
54
|
+
Napi::Value maxDataChannelId(const Napi::CallbackInfo &info);
|
|
55
|
+
Napi::Value maxMessageSize(const Napi::CallbackInfo &info);
|
|
54
56
|
|
|
55
57
|
// Close all existing Peer Connections
|
|
56
58
|
static void CloseAll();
|
package/test/connectivity.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import polyfill from '../polyfill/index.js';
|
|
2
|
-
import nodeDataChannel from '../lib/index.js';
|
|
2
|
+
import * as nodeDataChannel from '../lib/index.js';
|
|
3
3
|
|
|
4
4
|
nodeDataChannel.initLogger('Info');
|
|
5
5
|
|
|
@@ -71,6 +71,7 @@ dc1.onclose = () => {
|
|
|
71
71
|
peer1
|
|
72
72
|
.createOffer({})
|
|
73
73
|
.then((desc) => {
|
|
74
|
+
// console.log(122222, desc);
|
|
74
75
|
peer2.setRemoteDescription(desc);
|
|
75
76
|
})
|
|
76
77
|
.catch((err) => console.error(err));
|
package/test/test.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jest } from '@jest/globals';
|
|
2
|
-
import
|
|
2
|
+
import * as nodeDataChannel from '../lib';
|
|
3
3
|
|
|
4
4
|
describe('Module Definition', () => {
|
|
5
5
|
test('Module Defined', () => {
|
|
@@ -154,7 +154,7 @@ describe('DataChannel streams', () => {
|
|
|
154
154
|
let clientPeer = new nodeDataChannel.PeerConnection('Client', { iceServers: [] });
|
|
155
155
|
let echoPeer = new nodeDataChannel.PeerConnection('Client', { iceServers: [] });
|
|
156
156
|
|
|
157
|
-
const echoStream = new DataChannelStream(echoPeer.createDataChannel('echo-channel'));
|
|
157
|
+
const echoStream = new nodeDataChannel.DataChannelStream(echoPeer.createDataChannel('echo-channel'));
|
|
158
158
|
echoStream.pipe(echoStream); // Echo all received data back to the client
|
|
159
159
|
|
|
160
160
|
await waitForGathering(echoPeer);
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
ARG UBUNTU_VERSION=20.04
|
|
2
|
-
|
|
3
|
-
FROM ubuntu:${UBUNTU_VERSION}
|
|
4
|
-
|
|
5
|
-
RUN apt-get update -y && apt-get upgrade -y
|
|
6
|
-
|
|
7
|
-
# Node
|
|
8
|
-
# https://github.com/nodesource/distributions#nodejs
|
|
9
|
-
ARG NODE_MAJOR=18
|
|
10
|
-
RUN apt-get install -y ca-certificates curl gnupg
|
|
11
|
-
RUN mkdir -p /etc/apt/keyrings
|
|
12
|
-
RUN curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
|
|
13
|
-
RUN echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list
|
|
14
|
-
RUN apt-get update -y
|
|
15
|
-
RUN apt-get install -y nodejs
|
|
16
|
-
|
|
17
|
-
# C++
|
|
18
|
-
RUN apt-get install -y cmake g++
|
|
19
|
-
|
|
20
|
-
# libnice library as an alternative to default one
|
|
21
|
-
# RUN apt-get install -y libnice-dev
|
|
22
|
-
|
|
23
|
-
# libssl-dev
|
|
24
|
-
# https://www.claudiokuenzler.com/blog/1216/could-not-find-openssl-error-compiling-cmake-source
|
|
25
|
-
RUN apt-get install -y libssl-dev
|
|
26
|
-
|
|
27
|
-
# Git
|
|
28
|
-
RUN apt-get install -y git
|
|
29
|
-
|
|
30
|
-
WORKDIR /home/node-datachannel
|
package/examples/build/README.md
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
# Examples
|
|
2
|
-
|
|
3
|
-
## Building with Docker
|
|
4
|
-
|
|
5
|
-
`cd` into `node-datachannel` root directory
|
|
6
|
-
|
|
7
|
-
```sh
|
|
8
|
-
# Build Docker image from Dockerfile
|
|
9
|
-
# You can choose Ubuntu and Node major versions by changing UBUNTU_VERSION and NODE_MAJOR
|
|
10
|
-
> docker build \
|
|
11
|
-
-f ./examples/build/Dockerfile \
|
|
12
|
-
-t node-datachannel-dev \
|
|
13
|
-
--build-arg UBUNTU_VERSION=20.04 \
|
|
14
|
-
--build-arg NODE_MAJOR=18 \
|
|
15
|
-
.
|
|
16
|
-
|
|
17
|
-
# Run Docker container and mount node-datachannel root directory as a volume to the container
|
|
18
|
-
> docker run -it --rm --name node-datachannel-dev-container -v ${PWD}:/home/node-datachannel node-datachannel-dev /bin/bash
|
|
19
|
-
|
|
20
|
-
# Run inside Docker container:
|
|
21
|
-
> npm install --build-from-source
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
The build will be written to `prebuilds/`
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
The MIT License (MIT)
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2014 Jameson Little
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in
|
|
13
|
-
all copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
-
THE SOFTWARE.
|