Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add tls connection encrypter #2377

Merged
merged 7 commits into from
Feb 7, 2024

Conversation

achingbrain
Copy link
Member

@achingbrain achingbrain commented Jan 25, 2024

Encrypts connections using TLS 1.3.

Spec: https://github.com/libp2p/specs/blob/master/tls/tls.md

This connection encrypter primarily targets TCP connections on Node.js/Electron/React Native and is notable for having fewer round trips during connection establishment than Noise.

The Node.js TLS module has a fair few more users than Noise so it will be interesting to see how streaming performance compares between the two.

Change checklist

  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation if necessary (this includes comments as well)
  • I have added tests that prove my fix is effective or that my feature works

TODO

@achingbrain achingbrain force-pushed the feat/add-tls-connection-encrypter branch from bf3984f to 2b7b7c9 Compare January 25, 2024 15:20
@achingbrain
Copy link
Member Author

achingbrain commented Jan 25, 2024

One final compliance test is not passing - the server side of the connection doesn't notice the client closing it's end so it remains open and the test hangs until it times out.

@achingbrain achingbrain force-pushed the feat/add-tls-connection-encrypter branch from 2b7b7c9 to 6e8515e Compare January 25, 2024 15:58
Encrypts connections using TLS 1.3.

Spec: https://github.com/libp2p/specs/blob/master/tls/tls.md

This connection encrypter primarily targets TCP connections and is
notable for having fewer round trips during connection establishment
than Noise.
@achingbrain achingbrain force-pushed the feat/add-tls-connection-encrypter branch from 6e8515e to b930254 Compare January 25, 2024 17:25
@achingbrain achingbrain marked this pull request as ready for review January 26, 2024 13:16
@achingbrain achingbrain requested a review from a team as a code owner January 26, 2024 13:16
@achingbrain
Copy link
Member Author

achingbrain commented Jan 26, 2024

Streaming performance is comparable to noise, connection establishment is slower, which is unexpected: https://observablehq.com/@libp2p-workspace/performance-dashboard?branch=83b4e5da914c6dbcc8a04d23a8dca4df3419f33e

I think this may be because Node.js' TLS1.3 implementation doesn't support 0-RTT connection establishment (🤦‍♂️ if so)

@achingbrain achingbrain merged commit 537d356 into main Feb 7, 2024
22 checks passed
@achingbrain achingbrain deleted the feat/add-tls-connection-encrypter branch February 7, 2024 11:08
@achingbrain achingbrain mentioned this pull request Feb 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant