Skip to content

src,lib: implement experimental DTLS API#63182

Closed
jasnell wants to merge 3 commits into
nodejs:mainfrom
jasnell:jasnell/dtls
Closed

src,lib: implement experimental DTLS API#63182
jasnell wants to merge 3 commits into
nodejs:mainfrom
jasnell:jasnell/dtls

Conversation

@jasnell

@jasnell jasnell commented May 8, 2026

Copy link
Copy Markdown
Member

Decided to take a short break from the work on QUIC to implement a DTLS API, mostly just for the enjoyment of it. 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.

./configure --experimental-dtls
make -j{nproc}
./node --experimental-dtls my-dtls-app.js

Fixes: #61630

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/config
  • @nodejs/gyp
  • @nodejs/loaders
  • @nodejs/startup

@jasnell jasnell requested a review from mcollina May 8, 2026 04:04
@nodejs-github-bot nodejs-github-bot added lib / src Issues and PRs related to general changes in the lib or src directory. needs-ci PRs that need a full CI run. labels May 8, 2026
@jasnell

jasnell commented May 8, 2026

Copy link
Copy Markdown
Member Author

@nodejs/net

@mcollina mcollina left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1, good idea

@jasnell jasnell force-pushed the jasnell/dtls branch 3 times, most recently from a09cc0b to 9bd9284 Compare May 8, 2026 18:45
@jasnell jasnell added net Issues and PRs related to the net subsystem. experimental Issues and PRs related to experimental features. dont-land-on-v22.x PRs that should not land on the v22.x-staging branch and should not be released in v22.x. dont-land-on-v24.x PRs that should not land on the v24.x-staging branch and should not be released in v24.x. dont-land-on-v25.x dont-land-on-v26.x PRs that should not land on the v26.x-staging branch and should not be released in v26.x. large-pr dtls labels May 8, 2026
@jasnell jasnell marked this pull request as ready for review May 8, 2026 18:46
@jasnell jasnell requested a review from mcollina May 8, 2026 18:46
@codecov

This comment was marked as resolved.

@jasnell jasnell force-pushed the jasnell/dtls branch 3 times, most recently from c33674f to e1dc8db Compare May 10, 2026 18:49
@nodejs-github-bot

This comment was marked as duplicate.

@nodejs-github-bot

This comment was marked as outdated.

@nodejs-github-bot

This comment was marked as outdated.

@nodejs-github-bot

This comment was marked as outdated.

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
@nodejs-github-bot

This comment was marked as outdated.

@nodejs-github-bot

nodejs-github-bot commented May 13, 2026

Copy link
Copy Markdown
Collaborator

@jasnell jasnell requested a review from a team May 14, 2026 13:40

@mcollina mcollina left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RSLGTM, the API makes sense.

Before enabling in the default build, make sure to have your agent do a pass in finding security bugs, as I don't want us to be spammed.

@jasnell

jasnell commented May 21, 2026

Copy link
Copy Markdown
Member Author

@nodejs ... per our new "large PR" rules. this needs an additional @nodejs/tsc sign off before it can land.

@RafaelGSS RafaelGSS left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I might have overlooked it, but I didn't see a test for expectsWarning from experimental usage. There's a warning, but no assertion to it (non-blocking tho)

jasnell added a commit that referenced this pull request May 21, 2026
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
PR-URL: #63182
Fixes: #61630
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
jasnell added a commit that referenced this pull request May 21, 2026
PR-URL: #63182
Fixes: #61630
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
jasnell added a commit that referenced this pull request May 21, 2026
PR-URL: #63182
Fixes: #61630
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
@jasnell

jasnell commented May 21, 2026

Copy link
Copy Markdown
Member Author

Landed in 9c60b08...f835cc4

@jasnell jasnell closed this May 21, 2026
@richardlau richardlau added the semver-minor PRs that contain new features and should be released in the next minor version. label May 21, 2026
araujogui pushed a commit to araujogui/node that referenced this pull request May 26, 2026
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
PR-URL: nodejs#63182
Fixes: nodejs#61630
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
araujogui pushed a commit to araujogui/node that referenced this pull request May 26, 2026
PR-URL: nodejs#63182
Fixes: nodejs#61630
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
araujogui pushed a commit to araujogui/node that referenced this pull request May 26, 2026
PR-URL: nodejs#63182
Fixes: nodejs#61630
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dont-land-on-v22.x PRs that should not land on the v22.x-staging branch and should not be released in v22.x. dont-land-on-v24.x PRs that should not land on the v24.x-staging branch and should not be released in v24.x. dont-land-on-v26.x PRs that should not land on the v26.x-staging branch and should not be released in v26.x. dtls experimental Issues and PRs related to experimental features. large-pr lib / src Issues and PRs related to general changes in the lib or src directory. needs-ci PRs that need a full CI run. net Issues and PRs related to the net subsystem. semver-minor PRs that contain new features and should be released in the next minor version.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DTLS

6 participants