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(unstable): Implement QUIC #21942

Merged
merged 2 commits into from
Dec 20, 2024
Merged

feat(unstable): Implement QUIC #21942

merged 2 commits into from
Dec 20, 2024

Conversation

devsnek
Copy link
Member

@devsnek devsnek commented Jan 15, 2024

Implements a QUIC interface, loosely based on the WebTransport API (a future change could add the WebTransport API, built on top of this one).

quinn is used for the underlying QUIC implementation, for a few reasons:

  • A cloneable "handle" api which fits quite nicely into deno resources.
  • Good collaboration with the rust ecosystem, especially rustls.
  • I like it.

@devsnek devsnek force-pushed the quic branch 2 times, most recently from 8d2f39b to 84747e1 Compare January 15, 2024 04:29
Copy link
Member

@littledivy littledivy left a comment

Choose a reason for hiding this comment

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

nice API 👍

Cargo.lock Outdated Show resolved Hide resolved
cli/tests/unit/quic_test.ts Outdated Show resolved Hide resolved
@devsnek devsnek force-pushed the quic branch 4 times, most recently from 28254df to f7eb83e Compare January 15, 2024 06:47
@devsnek devsnek changed the title [wip] quic Implement QUIC Jan 15, 2024
@devsnek devsnek marked this pull request as ready for review January 15, 2024 06:53
@devsnek devsnek force-pushed the quic branch 4 times, most recently from 37df306 to aec0bb8 Compare January 15, 2024 07:23
@devsnek devsnek force-pushed the quic branch 4 times, most recently from e208a10 to 6d9a15f Compare January 15, 2024 19:32
Copy link
Contributor

@mmastrac mmastrac left a comment

Choose a reason for hiding this comment

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

This looks pretty good. I agree with @littledivy's comments re: ring.

I think we should consider merging this into ext/net rather than creating a new module, however.

ext/quic/01_quic.js Outdated Show resolved Hide resolved
@devsnek devsnek changed the title Implement QUIC feat: Implement QUIC Jan 15, 2024
@devsnek devsnek force-pushed the quic branch 3 times, most recently from d05ef59 to 823a8f9 Compare January 15, 2024 22:48
Copy link
Member

@bartlomieju bartlomieju left a comment

Choose a reason for hiding this comment

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

@devsnek this is fantastic work, I'm impressed how few lines of code you needed to implement that 💪

ext/quic/01_quic.js Outdated Show resolved Hide resolved
ext/quic/01_quic.js Outdated Show resolved Hide resolved
ext/quic/lib.rs Outdated Show resolved Hide resolved
@devsnek devsnek force-pushed the quic branch 4 times, most recently from a5b1091 to 7645454 Compare January 18, 2024 06:09
@devsnek devsnek force-pushed the quic branch 2 times, most recently from b7fdfb6 to 001fb6a Compare February 13, 2024 18:32
@mmastrac mmastrac added this to the 1.41 milestone Feb 13, 2024
@devsnek devsnek force-pushed the quic branch 2 times, most recently from 4d4f24e to b21790d Compare February 19, 2024 05:08
@hironichu
Copy link
Contributor

hironichu commented Feb 19, 2024

How hard or how long would it take to implement Webtransport with this PR ?

My suggestion is : why not adding it at the same time before merging in 1.41 since WT is 76% available on the browsers.

Adding a client seems "easy" enough, and a server which is upgrading the QUIC transport connection to a server (somewhat like Websocket works at the moment)

@devsnek devsnek force-pushed the quic branch 3 times, most recently from 8638073 to c8e070f Compare February 25, 2024 18:32
@bartlomieju bartlomieju removed this from the 1.41 milestone Mar 6, 2024
@lino-levan
Copy link
Contributor

How hard or how long would it take to implement WebTransport with this PR ?

Probably should be done in a separate PR imo. I'm really excited about this! Is there any consideration for this in deno 1.43 @bartlomieju?

Copy link
Contributor

@iuioiua iuioiua left a comment

Choose a reason for hiding this comment

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

Very nicely done. Most of my suggestions are little nits. However, same as @mmastrac, I question whether this should be done as an extra module rather than within ext/net.

Either way, can you please resolve the merge conflicts?

ext/quic/lib.deno_quic.d.ts Outdated Show resolved Hide resolved
ext/quic/lib.deno_quic.d.ts Outdated Show resolved Hide resolved
ext/quic/lib.deno_quic.d.ts Outdated Show resolved Hide resolved
ext/quic/lib.deno_quic.d.ts Outdated Show resolved Hide resolved
ext/quic/lib.deno_quic.d.ts Outdated Show resolved Hide resolved
ext/quic/01_quic.js Outdated Show resolved Hide resolved
ext/quic/01_quic.js Outdated Show resolved Hide resolved
ext/quic/01_quic.js Outdated Show resolved Hide resolved
ext/quic/01_quic.js Outdated Show resolved Hide resolved
Comment on lines 361 to 200
connectQuic: quic.connectQuic,
listenQuic: quic.listenQuic,
QuicBidirectionalStream: quic.QuicBidirectionalStream,
QuicConn: quic.QuicConn,
QuicListener: quic.QuicListener,
QuicReceiveStream: quic.QuicReceiveStream,
QuicSendStream: quic.QuicSendStream,
};

Copy link
Contributor

Choose a reason for hiding this comment

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

We can either include these classes in the Deno.* namespace or make the constructors of these classes illegal. The former adds to the API surface area, but the latter enables such objects to be identified with the use of instanceof. Which should we do? @bartlomieju

@hironichu
Copy link
Contributor

Very nicely done. Most of my suggestions are little nits. However, same as @mmastrac, I question whether this should be done as an extra module rather than within ext/net.

Either way, can you please resolve the merge conflicts?

I also think we should merge it into ext/net, and if we want to make protocol that depends on QUIC then we can make module ( i.e WebTransport and Media over Quic (MoQ)..

@devsnek devsnek force-pushed the quic branch 2 times, most recently from 4fe503b to e2156ca Compare July 10, 2024 01:37
Copy link
Contributor

@iuioiua iuioiua left a comment

Choose a reason for hiding this comment

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

Mostly documentation nits.

ext/net/lib.deno_net.d.ts Outdated Show resolved Hide resolved
ext/net/lib.deno_net.d.ts Outdated Show resolved Hide resolved
ext/net/lib.deno_net.d.ts Outdated Show resolved Hide resolved
ext/net/lib.deno_net.d.ts Outdated Show resolved Hide resolved
ext/net/lib.deno_net.d.ts Outdated Show resolved Hide resolved
ext/net/lib.deno_net.d.ts Show resolved Hide resolved
@lkwr
Copy link

lkwr commented Sep 25, 2024

Any updates on this? @devsnek @bartlomieju

@devsnek devsnek force-pushed the quic branch 3 times, most recently from 02bc6fb to 8e2726e Compare December 18, 2024 13:51
@devsnek devsnek changed the title feat: Implement QUIC feat(unstable): Implement QUIC Dec 18, 2024
Comment on lines +44 to +50
"connectQuic",
"listenQuic",
"QuicBidirectionalStream",
"QuicConn",
"QuicListener",
"QuicReceiveStream",
"QuicSendStream",
Copy link
Member

Choose a reason for hiding this comment

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

Nitpick - add these to runtime/fmt_errors.rs get_suggestions_for_terminal_errors for better DX?

Comment on lines 453 to 454
/** @category Network */
export interface QuicTransportOptions {
Copy link
Member

Choose a reason for hiding this comment

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

All these typings are missing the **UNSTABLE**: New API, yet to be vetted. banners and @experimental markers. @crowlKats can double check if they are marked properly

@devsnek devsnek requested a review from bartlomieju December 20, 2024 08:53
Copy link
Member

@bartlomieju bartlomieju left a comment

Choose a reason for hiding this comment

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

LGTM, 🚢 it

@devsnek devsnek merged commit 65b6479 into denoland:main Dec 20, 2024
17 checks passed
@devsnek devsnek deleted the quic branch December 20, 2024 12:48
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.

9 participants