Skip to content

Commit 0e23cfa

Browse files
committed
src,lib: implement experimental DTLS API
Decided to take a short break from the work on QUIC to implement a DTLS API. Very experimental at this point but the basic API is there (inspired by the QUIC API work). The implementation is based on OpenSSL's built-in DTLS support and no other dependencies are required. DTLS is a datagram-based version of TLS that is used for things like WebRTC and CoAP. It provides similar security guarantees as TLS but is designed to work over UDP instead of TCP. This shouldn't be considered ready for production but it is a good starting point for experimentation and feedback. ```bash ./configure --experimental-dtls make -j{nproc} ./node --experimental-dtls my-dtls-app.js ``` Signed-off-by: James M Snell <jasnell@gmail.com> Assisted-by: Opencode:Opus 4.6
1 parent 49aef0d commit 0e23cfa

38 files changed

Lines changed: 4223 additions & 1 deletion

configure.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1065,6 +1065,12 @@
10651065
default=None,
10661066
help='build with experimental QUIC support')
10671067

1068+
parser.add_argument('--experimental-dtls',
1069+
action='store_true',
1070+
dest='experimental_dtls',
1071+
default=None,
1072+
help='build with experimental DTLS support')
1073+
10681074
parser.add_argument('--ninja',
10691075
action='store_true',
10701076
dest='use_ninja',
@@ -2350,6 +2356,10 @@ def configure_quic(o):
23502356
o['variables']['node_use_quic'] = b(options.experimental_quic and
23512357
not options.without_ssl)
23522358

2359+
def configure_dtls(o):
2360+
o['variables']['node_use_dtls'] = b(options.experimental_dtls and
2361+
not options.without_ssl)
2362+
23532363
def configure_static(o):
23542364
if options.fully_static or options.partly_static:
23552365
if flavor == 'mac':
@@ -2808,6 +2818,7 @@ def make_bin_override():
28082818
configure_v8(output, configurations)
28092819
configure_openssl(output)
28102820
configure_quic(output)
2821+
configure_dtls(output)
28112822
configure_intl(output)
28122823
configure_static(output)
28132824
configure_inspector(output)

doc/api/cli.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1212,6 +1212,17 @@ If present, Node.js will look for a
12121212
`node.config.json` file in the current working directory and load it as a
12131213
configuration file.
12141214

1215+
### `--experimental-dtls`
1216+
1217+
<!-- YAML
1218+
added: REPLACEME
1219+
-->
1220+
1221+
> Stability: 1 - Experimental
1222+
1223+
Enable experimental support for the DTLS protocol. See the
1224+
[dtls documentation][] for details.
1225+
12151226
### `--experimental-eventsource`
12161227

12171228
<!-- YAML
@@ -3736,6 +3747,7 @@ one is included in the list below.
37363747
* `--experimental-abortcontroller`
37373748
* `--experimental-addon-modules`
37383749
* `--experimental-detect-module`
3750+
* `--experimental-dtls`
37393751
* `--experimental-eventsource`
37403752
* `--experimental-ffi`
37413753
* `--experimental-import-meta-resolve`
@@ -4406,6 +4418,7 @@ node --stack-trace-limit=12 -p -e "Error.stackTraceLimit" # prints 12
44064418
[debugger]: debugger.md
44074419
[debugging security implications]: https://nodejs.org/en/docs/guides/debugging-getting-started/#security-implications
44084420
[deprecation warnings]: deprecations.md#list-of-deprecated-apis
4421+
[dtls documentation]: dtls.md
44094422
[emit_warning]: process.md#processemitwarningwarning-options
44104423
[environment_variables]: #environment-variables_1
44114424
[filtering tests by name]: test.md#filtering-tests-by-name

0 commit comments

Comments
 (0)