-
Notifications
You must be signed in to change notification settings - Fork 39
Initial web-transport-quiche support #118
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
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
764a98d
Don't use a newer Rust method.
kixelated f900a79
WIP
kixelated f32b3b6
Initial web-transport-quiche work.
kixelated 74fa8a8
Move some stuff.
kixelated 4e58051
WIP
kixelated a2520c8
More WIP
kixelated 6a24905
Client echo works.
kixelated 5169f5a
More tweaks.
kixelated 78151ee
Fix some bugs and dramatically improve the DriverState.
kixelated 33f7ae1
Documentation.
kixelated 78e0c21
Fix CI maybe.
kixelated b9bacd4
More CI stuff.
kixelated 031c93f
Try using the boring crate to see if it fixes CI.
kixelated bf1d141
Revert "Try using the boring crate to see if it fixes CI."
kixelated bb5de09
Maybe this works.
kixelated File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,75 @@ | ||
| // @ts-expect-error embed the certificate fingerprint using bundler | ||
| import fingerprintHex from "bundle-text:../dev/localhost.hex"; | ||
|
|
||
| // Convert the hex to binary. | ||
| const fingerprint = []; | ||
| for (let c = 0; c < fingerprintHex.length - 1; c += 2) { | ||
| fingerprint.push(parseInt(fingerprintHex.substring(c, c + 2), 16)); | ||
| } | ||
|
|
||
| const params = new URLSearchParams(window.location.search); | ||
|
|
||
| const url = params.get("url") || "https://localhost:4443"; | ||
| const datagram = params.get("datagram") || false; | ||
|
|
||
| function log(msg) { | ||
| const element = document.createElement("div"); | ||
| element.innerText = msg; | ||
|
|
||
| document.body.appendChild(element); | ||
| } | ||
|
|
||
| async function run() { | ||
| // Connect using the hex fingerprint in the cert folder. | ||
| const transport = new WebTransport(url, { | ||
| serverCertificateHashes: [ | ||
| { | ||
| algorithm: "sha-256", | ||
| value: new Uint8Array(fingerprint), | ||
| }, | ||
| ], | ||
| }); | ||
| await transport.ready; | ||
|
|
||
| log("connected"); | ||
|
|
||
| let writer; | ||
| let reader; | ||
|
|
||
| if (!datagram) { | ||
| // Create a bidirectional stream | ||
| const stream = await transport.createBidirectionalStream(); | ||
| log("created stream"); | ||
|
|
||
| writer = stream.writable.getWriter(); | ||
| reader = stream.readable.getReader(); | ||
| } else { | ||
| log("using datagram"); | ||
|
|
||
| // Create a datagram | ||
| writer = transport.datagrams.writable.getWriter(); | ||
| reader = transport.datagrams.readable.getReader(); | ||
| } | ||
|
|
||
| // Create a message | ||
| const msg = "Hello, world!"; | ||
| const encoded = new TextEncoder().encode(msg); | ||
|
|
||
| await writer.write(encoded); | ||
| await writer.close(); | ||
| writer.releaseLock(); | ||
|
|
||
| log("send: " + msg); | ||
|
|
||
| // Read a message from it | ||
| // TODO handle partial reads | ||
| const { value } = await reader.read(); | ||
|
|
||
| const recv = new TextDecoder().decode(value); | ||
| log("recv: " + recv); | ||
|
|
||
| transport.close(); | ||
| log("closed"); | ||
| } | ||
|
|
||
| run(); | ||
File renamed without changes.
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix datagram parameter parsing logic.
Line 13 has a logic error:
params.get("datagram")returns either a string ornull, so|| falsewill evaluate to the string value (e.g.,"false") rather than a boolean. Any non-empty string (including"false") is truthy in JavaScript.Apply this fix:
📝 Committable suggestion
🤖 Prompt for AI Agents