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

refactor(quic): introduce endpoint, 0rtt, cleanup #27444

Merged
merged 9 commits into from
Jan 6, 2025
Merged

Conversation

devsnek
Copy link
Member

@devsnek devsnek commented Dec 21, 2024

A QUIC endpoint is a UDP socket which multiplexes QUIC sessions, which may be initiated in either direction. This PR exposes endpoints and moves things around as needed.

Now that endpoints can be reused between client connections, we have a way to share tls tickets between them and allow 0rtt. This interface currently works by conditionally returning a promise.

Also cleaned up the rust op names, fixed some lingering problems in the data transmission, and switched to explicit error types.

@devsnek devsnek marked this pull request as ready for review December 21, 2024 22:24
@devsnek devsnek changed the title refactor(quic): introduce endpoint refactor(quic): introduce endpoint, 0rtt, cleanup Dec 21, 2024
@devsnek devsnek force-pushed the quic-changes branch 2 times, most recently from c69a4d6 to cf6128e Compare December 22, 2024 10:18
);
let getEndpointResource;

function transportOptions({
Copy link
Member

Choose a reason for hiding this comment

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

I don't understand the purpose of this function...

Copy link
Member Author

Choose a reason for hiding this comment

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

just pulls out transport options from the larger options bag to reduce serde overhead going into rust

class QuicEndpoint {
#endpoint;

constructor({ hostname = "::", port = 0, rid } = { __proto__: null }) {
Copy link
Member

Choose a reason for hiding this comment

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

Is this a public API? If so we shouldn't expose rid here. Maybe add another function that requires an internal symbol to construct endpoint from an existing resource id?

Copy link
Member

Choose a reason for hiding this comment

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

How about rewriting this API to use object wrap/cppgc?

Copy link
Member

Choose a reason for hiding this comment

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

Looks like it already uses cppgc, any chance we could further reduce amount of JS? Or maybe we could make this module lazy loaded similar to WebGPU code?

Copy link
Member Author

Choose a reason for hiding this comment

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

updated to use lazy loading

Comment on lines +834 to +837
* const caCert = await Deno.readTextFile("./certs/my_custom_root_CA.pem");
* const conn1 = await Deno.connectQuic({ hostname: "example.com", port: 443, alpnProtocols: ["h3"] });
* const conn2 = await Deno.connectQuic({ caCerts: [caCert], hostname: "example.com", port: 443, alpnProtocols: ["h3"] });
* ```
Copy link
Member

Choose a reason for hiding this comment

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

Sigh, we should really address #16160 so it wraps lines

@devsnek devsnek requested a review from bartlomieju January 6, 2025 10:48
@devsnek devsnek merged commit ccd3758 into main Jan 6, 2025
17 checks passed
@devsnek devsnek deleted the quic-changes branch January 6, 2025 14:25
dsherret pushed a commit that referenced this pull request Jan 9, 2025
A QUIC endpoint is a UDP socket which multiplexes QUIC sessions, which
may be initiated in either direction. This PR exposes endpoints and
moves things around as needed.

Now that endpoints can be reused between client connections, we have a
way to share tls tickets between them and allow 0rtt. This interface
currently works by conditionally returning a promise.

Also cleaned up the rust op names, fixed some lingering problems in the
data transmission, and switched to explicit error types.
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.

3 participants