quico 0.1.3 β†’ 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,217 +1,382 @@
1
- <p align="center">
2
- <img src="https://github.com/colocohen/quico/raw/main/quico.svg" width="450" alt="QUICO"/>
3
- </p>
4
-
5
- <h1 align="center">QUICO</h1>
6
- <p align="center">
7
- <em>πŸš€ JavaScript implementation of QUIC, HTTP/3, QPACK & WebTransport for Node.js</em>
8
- </p>
9
-
10
- <p align="center">
11
- <a href="https://www.npmjs.com/package/quico">
12
- <img src="https://img.shields.io/npm/v/quico?color=blue" alt="npm">
13
- </a>
14
- <img src="https://img.shields.io/badge/status-in%20development-yellow" alt="status">
15
- <img src="https://img.shields.io/github/license/colocohen/quico?color=brightgreen" alt="license">
16
- </p>
17
-
18
-
19
- > **⚠️ Project status: _Active development_.**
20
- > APIs may change without notice until we reach v1.0.
21
- > Use at your own risk and please report issues!
22
-
23
-
24
-
25
- ## Table of Contents
26
- 1. [What is QUIC/HTTP3?](#-what-is-quichttp3)
27
- 2. [Why is QUICO important?](#-why-is-quico-important)
28
- 3. [Features](#-features)
29
- 4. [Installation](#-installation)
30
- 5. [Node.js API Compatibility](#-nodejs-api-compatibility)
31
- 6. [Testing](#-testing)
32
- 7. [Roadmap](#-roadmap)
33
- 8. [Sponsors](#-sponsors)
34
- 9. [License](#-license)
35
-
36
-
37
-
38
- ## ⚑ What is QUIC/HTTP3?
39
-
40
- **QUIC** is the future of Internet transport protocols. Created at Google and standardized by the IETF, QUIC powers **HTTP/3** and is already deployed at scale by the world’s largest platforms. It was specifically designed to overcome the limitations of TCP and deliver a faster, smoother, and more resilient web.
41
-
42
- Key advantages of QUIC include:
43
-
44
- - **Eliminating bottlenecks**: With TCP, data must arrive strictly in order. If a single packet is lost or delayed, all subsequent packets are blocked until it arrives β€” a phenomenon called **head-of-line blocking**. QUIC removes this bottleneck by running over UDP, so each package arrives on its own and avoids dependence on delayed pieces of data.
45
-
46
- - **UDP efficiency**: By running over UDP, QUIC bypasses decades of kernel-level constraints, enabling lightning-fast performance even on constrained devices such as smartphones, IoT hardware, or edge gateways.
47
-
48
- - **Security by default**: TLS 1.3 is built directly into the protocol. Every connection is encrypted β€” no exceptions, no downgrade paths.
49
-
50
- - **Seamless mobility**: Connections remain stable as devices move across networks (e.g., Wi-Fi β†’ 4G/5G) or switch IP addresses, without breaking the session.
51
-
52
- - **Lower latency**: QUIC merges the transport and TLS handshake into fewer round-trips, significantly reducing connection setup time.
53
-
54
- - **Smarter congestion control**: Advanced congestion control algorithms (such as BBR) continuously measure bandwidth, round-trip time, and loss in real time. They dynamically adjust to real-world network conditions.
55
-
56
-
57
- QUIC combines **UDP speed, TCP reliability, mandatory TLS security, and adaptive multiplexing** into one powerful transport layer.
58
-
59
- **HTTP/3** (h3 in short) is the layer on top of QUIC. This is the evolution of the web’s application layer. Instead of riding over TCP, HTTP/3 maps HTTP requests and responses directly onto QUIC streams.
60
- HTTP/3 is also himself dramatically reduces overhead and improves efficiency - thats bring faster page loads and real-time applications that scale across the modern web.
61
-
62
-
63
-
64
- ## Why is QUICO important?
65
-
66
- Node.js is the backbone of countless modern web applications, but it currently lacks a native QUIC implementation. Supporting QUIC inside Node.js requires **deep access to TLS internals** that Node’s existing TLS APIs don’t expose. Beyond that, QUIC demands a **highly complex architecture**, including intricate state machines, packet schedulers, and congestion control mechanisms.
67
-
68
- **QUICO** brings this missing capability directly into the **Node.js ecosystem**. It is a from-scratch JavaScript implementation of **QUIC, HTTP/3 and WebTransport**, built without relying on OpenSSL or native code. At its core, it uses [LemonTLS](https://github.com/colocohen/lemon-tls) a pure JavaScript TLS 1.3 library, to provide the cryptographic expose that QUIC requires.
69
-
70
-
71
-
72
- ## ✨ Features
73
-
74
- - **Pure JavaScript QUIC**
75
- Full transport layer written from scratch in JS β€” including Initial & 1-RTT packet handling, connection ID management, acknowledgments, and flow control. No native bindings required.
76
-
77
- - **HTTP/3**
78
- Support for control streams, request/response handling, and GOAWAY frames β€” the foundation of modern web transport.
79
-
80
- - **WebTransport**
81
- Unidirectional and bidirectional streams plus datagrams (RFC 9298), tested with Chrome Canary for real-world compatibility.
82
-
83
- - **QPACK Compression**
84
- Full encoder/decoder implementation with support for static, dynamic, and custom Huffman tables to reduce header overhead.
85
-
86
- > ⚠️ **Note**: Currently implemented as **server-side only**. Client support is planned in the roadmap.
87
-
88
-
89
-
90
- ## πŸ“¦ Installation
91
-
92
- ```bash
93
- npm install quico
94
- ```
95
-
96
-
97
-
98
- ## πŸ”— Node.js API Compatibility
99
-
100
- One of the core design goals of QUICO is to provide a **familiar and intuitive API**.
101
- If you already know how to use Node’s built-in `http` or `https` modules, working with QUICO should feel natural.
102
-
103
- QUICO exposes an API modeled after Node’s server interfaces:
104
- - **`createServer`** works just like in `http` / `https`, accepting request and response objects.
105
- - **`req` and `res` objects** follow the same semantics you already know: `req.headers`, `res.writeHead()`, `res.end()`, etc.
106
-
107
-
108
- ```js
109
- import fs from 'node:fs';
110
- import quico from 'quico';
111
- import tls from 'lemon-tls';
112
-
113
- const server = quico.createServer({
114
- SNICallback: function (servername, cb) {
115
- cb(null, tls.createSecureContext({
116
- key: fs.readFileSync('YOUR_KEY_FILE_PATH'),
117
- cert: fs.readFileSync('YOUR_CERT_FILE_PATH')
118
- }));
119
- }
120
- }, function (req, res) {
121
- res.writeHead(200, {
122
- 'Content-Type': 'text/html; charset=utf-8'
123
- });
124
- res.end('Hello World from HTTP/3 on Node.js!');
125
- });
126
-
127
- server.listen(4433, function () {
128
- console.log('πŸš€ QUIC server running on https://localhost:4433');
129
- });
130
- ```
131
-
132
- > πŸ“‚ For more examples, see [`examples/`](./examples)
133
-
134
-
135
- ## πŸ§ͺ Testing
136
-
137
- QUIC requires TLS 1.3 with an ECDSA certificate.
138
- RSA self-signed certificates usually fail with QUIC/HTTP3.
139
- For local development the easiest option is [mkcert](https://github.com/FiloSottile/mkcert),
140
- which generates locally trusted ECDSA certificates automatically.
141
-
142
- This project supports ALPN `"h3"` only
143
- (final version, not draft variants like `h3-29` or `h3-32`).
144
- You must explicitly force h3 when testing.
145
-
146
- > βœ… Launch Chrome with:
147
- > `--enable-quic --quic-version=h3 --ignore-certificate-errors --origin-to-force-quic-on=localhost:4433`
148
- >
149
- > βœ… Or test with Curl:
150
- > `curl --http3 -vvv --trace-time --trace-ascii - https://localhost:4433 --insecure`
151
-
152
-
153
- ## πŸ›£ Roadmap
154
-
155
- The following roadmap reflects the current and planned status of the QUICO project.
156
- βœ… = Completedβ€ƒπŸ”„ = In progress ⏳ = Plannedβ€ƒβŒ = Not planned
157
-
158
- ### βœ… Completed
159
- | Status | Item |
160
- |:------:|------|
161
- | βœ… | QUIC: Initial / Handshake / 1-RTT |
162
- | βœ… | TLS 1.3 handshake & key schedule |
163
- | βœ… | HTTP/3: control streams & basic requests |
164
- | βœ… | QPACK: static & dynamic table |
165
-
166
- ### πŸ”„ In Progress
167
- | Status | Item | Notes |
168
- |:------:|------|-------|
169
- | πŸ”„ | QPACK: Huffman encoding/decoding | Custom table support partially working |
170
- | πŸ”„ | WebTransport: unidirectional & bidirectional streams | Stream interface WIP |
171
- | πŸ”„ | HTTP/3: GOAWAY & request cancellation | Partial control flow support |
172
- | πŸ”„ | Integration with Node.js `https`-style API | Goal: seamless compatibility |
173
- | πŸ”„ | Project modularization & internal refactoring | To improve maintainability |
174
-
175
- ### ⏳ Planned
176
- | Status | Item | Notes |
177
- |:------:|------|-------|
178
- | ⏳ | QUIC: 0-RTT support | Will follow key update & early data support |
179
- | ⏳ | WebTransport: datagram support | Based on RFC 9298 |
180
- | ⏳ | QUIC: proper connection teardown | CLOSE frame, idle timeout |
181
- | ⏳ | QUIC: keep-alive & PING frames | For long-lived connections |
182
- | ⏳ | QUIC: flow control & congestion (BBR / CUBIC) | Needs metrics and simulation |
183
- | ⏳ | QUIC: session resumption & connection migration | For mobile/roaming support |
184
- | ⏳ | End-to-end test suite against Chromium | Automate using testh3 and Puppeteer |
185
- | ⏳ | Benchmarks, performance analysis & tuning | Resource usage, latency, throughput |
186
- | ⏳ | Fuzz testing and protocol robustness checks | To improve security and reliability |
187
- | ⏳ | Developer documentation & API reference | For better onboarding |
188
- | ⏳ | TypeScript typings | Type safety for IDE support |
189
-
190
- _Note: QUICO is a work-in-progress project aiming to provide a full JavaScript implementation of QUIC + HTTP/3. Community contributions are welcome!_
191
-
192
- _Please ⭐ star the repo to follow progress!_
193
-
194
- ## πŸ™ Sponsors
195
-
196
- QUICO is an evenings-and-weekends project.
197
- Support development via **GitHub Sponsors** or simply share the project.
198
-
199
- ## πŸ“œ License
200
-
201
- **Apache License 2.0**
202
-
203
- ```
204
- Copyright Β© 2025 colocohen
205
-
206
- Licensed under the Apache License, Version 2.0 (the "License");
207
- you may not use this file except in compliance with the License.
208
- You may obtain a copy of the License at
209
-
210
- http://www.apache.org/licenses/LICENSE-2.0
211
-
212
- Unless required by applicable law or agreed to in writing, software
213
- distributed under the License is distributed on an "AS IS" BASIS,
214
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
215
- See the License for the specific language governing permissions and
216
- limitations under the License.
1
+ <p align="center">
2
+ <img src="https://github.com/colocohen/quico/raw/main/quico.svg" width="450" alt="QUICO"/>
3
+ </p>
4
+
5
+ <h1 align="center">QUICO</h1>
6
+ <p align="center">
7
+ <em>Pure JavaScript implementation of QUIC, HTTP/3, QPACK &amp; WebTransport for Node.js</em>
8
+ </p>
9
+
10
+ <p align="center">
11
+ <a href="https://www.npmjs.com/package/quico">
12
+ <img src="https://img.shields.io/npm/v/quico?color=blue" alt="npm">
13
+ </a>
14
+ <img src="https://img.shields.io/badge/status-in%20development-yellow" alt="status">
15
+ <img src="https://img.shields.io/github/license/colocohen/quico?color=brightgreen" alt="license">
16
+ </p>
17
+
18
+ ---
19
+
20
+ > **⚠️ Project status: Active development.**
21
+ > APIs may change before v1.0. Use at your own risk and please report issues!
22
+
23
+ ---
24
+
25
+
26
+ ## Table of Contents
27
+ 1. [What is QUIC / HTTP/3?](#-what-is-quic--http3)
28
+ 2. [Why QUICO?](#-why-quico)
29
+ 3. [Quick Start](#-quick-start)
30
+ 4. [Features](#-features)
31
+ 5. [Node.js API Compatibility](#-nodejs-api-compatibility)
32
+ 6. [WebTransport](#-webtransport)
33
+ 7. [Testing](#-testing)
34
+ 8. [Project Structure](#-project-structure)
35
+ 9. [Roadmap](#-roadmap)
36
+ 10. [Sponsors](#-sponsors)
37
+ 11. [Contact](#-contact)
38
+ 12. [License](#-license)
39
+
40
+
41
+ ## ⚑ What is QUIC / HTTP/3?
42
+
43
+ **QUIC** is the future of Internet transport protocols. Created at Google and standardized by the IETF, QUIC powers **HTTP/3** and is already deployed at scale by the world’s largest platforms. It was specifically designed to overcome the limitations of TCP and deliver a faster, smoother, and more resilient web.
44
+
45
+ Key advantages of QUIC include:
46
+
47
+ - **Eliminating bottlenecks**: With TCP, data must arrive strictly in order. If a single packet is lost or delayed, all subsequent packets are blocked until it arrives β€” a phenomenon called **head-of-line blocking**. QUIC removes this bottleneck by running over UDP, so each package arrives on its own and avoids dependence on delayed pieces of data.
48
+
49
+ - **UDP efficiency**: By running over UDP, QUIC bypasses decades of kernel-level constraints, enabling lightning-fast performance even on constrained devices such as smartphones, IoT hardware, or edge gateways.
50
+
51
+ - **Security by default**: TLS 1.3 is built directly into the protocol. Every connection is encrypted β€” no exceptions, no downgrade paths.
52
+
53
+ - **Seamless mobility**: Connections remain stable as devices move across networks (e.g., Wi-Fi β†’ 4G/5G) or switch IP addresses, without breaking the session.
54
+
55
+ - **Lower latency**: QUIC merges the transport and TLS handshake into fewer round-trips, significantly reducing connection setup time.
56
+
57
+ - **Smarter congestion control**: Advanced congestion control algorithms (such as BBR) continuously measure bandwidth, round-trip time, and loss in real time. They dynamically adjust to real-world network conditions.
58
+
59
+
60
+ QUIC combines **UDP speed, TCP reliability, mandatory TLS security, and adaptive multiplexing** into one powerful transport layer.
61
+
62
+ **HTTP/3** (h3 in short) is the layer on top of QUIC. This is the evolution of the web’s application layer. Instead of riding over TCP, HTTP/3 maps HTTP requests and responses directly onto QUIC streams.
63
+ HTTP/3 is also himself dramatically reduces overhead and improves efficiency - thats bring faster page loads and real-time applications that scale across the modern web.
64
+
65
+
66
+
67
+ ## 🧠 Why QUICO?
68
+
69
+ Node.js is the backbone of countless modern web applications, but it currently lacks a native QUIC implementation. Supporting QUIC inside Node.js requires **deep access to TLS internals** that Node's existing TLS APIs don't expose. Beyond that, QUIC demands a **highly complex architecture** β€” intricate state machines, packet schedulers, and congestion control mechanisms.
70
+
71
+ **QUICO** brings this missing capability directly into the **Node.js ecosystem**. It is a from-scratch JavaScript implementation of QUIC, HTTP/3 and WebTransport, built without relying on OpenSSL or native code. At its core, it uses [LemonTLS](https://github.com/colocohen/lemon-tls) β€” a pure JavaScript TLS 1.3 library built by the same author β€” to provide the cryptographic layer that QUIC requires. Together, QUICO and LemonTLS form a complete, fully auditable JavaScript networking stack from UDP to HTTP/3.
72
+
73
+ **What this means for you:**
74
+
75
+ - **`npm install` and go** β€” no build tools, no platform-specific binaries, no gyp
76
+ - **Works everywhere Node.js runs** β€” Linux, macOS, Windows, ARM, Docker, edge
77
+ - **Debuggable top to bottom** β€” every packet, every frame, every byte is JavaScript you can step through
78
+
79
+
80
+ ## πŸ“¦ Quick Start
81
+
82
+ ```bash
83
+ npm install quico
84
+ ```
85
+
86
+ ### Server
87
+
88
+ ```js
89
+ import quico from 'quico';
90
+ import fs from 'node:fs';
91
+
92
+ const server = quico.createServer({
93
+ key: fs.readFileSync('server.key'),
94
+ cert: fs.readFileSync('server.crt')
95
+ }, (req, res) => {
96
+ res.writeHead(200, { 'content-type': 'text/plain' });
97
+ res.end('Hello from HTTP/3!');
98
+ });
99
+
100
+ server.listen(4433, () => {
101
+ console.log('HTTP/3 server on https://localhost:4433');
102
+ });
103
+ ```
104
+
105
+ ### Client
106
+
107
+ ```js
108
+ import quico from 'quico';
109
+
110
+ quico.request('https://www.google.com/', (res) => {
111
+ console.log('Status:', res.statusCode); // 200
112
+ console.log('Protocol:', res.httpVersion); // "3.0"
113
+ res.on('data', (chunk) => process.stdout.write(chunk));
114
+ });
115
+ ```
116
+
117
+ > πŸ“‚ For more examples, see [`examples/`](./examples)
118
+
119
+
120
+ ## ✨ Features
121
+
122
+ ### HTTP/3 Server & Client
123
+ - Full request/response cycle over QUIC
124
+ - QPACK header compression with static and dynamic tables
125
+ - Standard Node.js API: `req.headers`, `res.writeHead()`, `res.end()`
126
+ - Multiple requests per connection (stream multiplexing)
127
+ - Automatic `Alt-Svc` header for HTTP/3 protocol discovery
128
+ - H3 β†’ H2 β†’ H1 fallback when QUIC isn't available
129
+ - Tested against Google, Cloudflare, Facebook, Microsoft and nginx QUIC servers
130
+
131
+ ### WebTransport
132
+ - Client and server implementation
133
+ - Bidirectional and unidirectional streams (Node.js Duplex + WHATWG Streams API)
134
+ - Unreliable datagrams (RFC 9297)
135
+ - Natural API: `req.on('stream')`, `res.sendDatagram()`, `res.writeHead(200)` to accept
136
+
137
+ ### QUIC Transport
138
+ - Full TLS 1.3 handshake via LemonTLS (no OpenSSL)
139
+ - Initial, Handshake, and 1-RTT packet handling
140
+ - Connection ID management
141
+ - ACK processing and flow control
142
+ - Key updates (key phase bit rotation)
143
+ - HelloRetryRequest support (P-256, P-384, X25519)
144
+ - AES-128-GCM and AES-256-GCM cipher suites
145
+ - Handshake timeout
146
+
147
+
148
+ ## πŸ”— Node.js API Compatibility
149
+
150
+ One of the core design goals of QUICO is to provide a **familiar API**. If you already know `node:https`, working with QUICO should feel natural β€” `createServer`, `request`, `req`, `res` all work the same way.
151
+
152
+ This means existing frameworks work out of the box:
153
+
154
+ ```js
155
+ import express from 'express';
156
+ import quico from 'quico';
157
+
158
+ const app = express();
159
+ app.get('/', (req, res) => res.json({ protocol: req.httpVersion }));
160
+
161
+ quico.createServer({ key: KEY, cert: CERT }, app).listen(4433);
162
+ // β†’ { "protocol": "3.0" }
163
+ ```
164
+
165
+ For multi-domain setups, QUICO supports `SNICallback` just like `node:https`:
166
+
167
+ ```js
168
+ import quico from 'quico';
169
+ import tls from 'lemon-tls';
170
+
171
+ const server = quico.createServer({
172
+ SNICallback: function (servername, cb) {
173
+ cb(null, tls.createSecureContext({
174
+ key: fs.readFileSync('certs/' + servername + '.key'),
175
+ cert: fs.readFileSync('certs/' + servername + '.crt')
176
+ }));
177
+ }
178
+ }, (req, res) => {
179
+ res.writeHead(200, { 'content-type': 'text/html; charset=utf-8' });
180
+ res.end('Hello World from HTTP/3 on Node.js!');
181
+ });
182
+
183
+ server.listen(4433, () => {
184
+ console.log('πŸš€ QUIC server running on https://localhost:4433');
185
+ });
186
+ ```
187
+
188
+
189
+ ## πŸš€ WebTransport
190
+
191
+ ### Server
192
+
193
+ ```js
194
+ import quico from 'quico';
195
+
196
+ quico.createServer({ key: KEY, cert: CERT }, (req, res) => {
197
+ if (req.headers[':protocol'] === 'webtransport') {
198
+ // Accept the WebTransport session
199
+ res.writeHead(200);
200
+
201
+ // Bidirectional streams from the client
202
+ req.on('stream', (stream) => {
203
+ stream.on('data', (chunk) => {
204
+ stream.write(chunk); // echo back
205
+ });
206
+ stream.on('end', () => stream.end());
207
+ });
208
+
209
+ // Unreliable datagrams
210
+ req.on('datagram', (data) => {
211
+ res.sendDatagram(data); // echo back
212
+ });
213
+
214
+ // Server can also create streams
215
+ const push = res.createBidirectionalStream();
216
+ push.write('server says hello');
217
+ push.end();
218
+ } else {
219
+ // Regular HTTP/3 request
220
+ res.end('Hello HTTP/3!');
221
+ }
222
+ }).listen(4433);
223
+ ```
224
+
225
+ ### Client (Node.js)
226
+
227
+ ```js
228
+ import { WebTransport } from 'quico';
229
+
230
+ const wt = new WebTransport('https://localhost:4433/echo');
231
+ await wt.ready;
232
+
233
+ // Bidirectional stream
234
+ const stream = await wt.createBidirectionalStream();
235
+ stream.write('hello');
236
+ stream.on('data', (chunk) => console.log('echo:', chunk.toString()));
237
+ stream.end();
238
+
239
+ // Unidirectional stream
240
+ const uni = await wt.createUnidirectionalStream();
241
+ uni.write('fire and forget');
242
+ uni.end();
243
+
244
+ // Datagrams (unreliable)
245
+ wt.sendDatagram(Buffer.from('ping'));
246
+ wt.on('datagram', (data) => console.log('pong:', data.toString()));
247
+
248
+ wt.close();
249
+ ```
250
+
251
+ ### Client (Browser)
252
+
253
+ ```js
254
+ const wt = new WebTransport('https://yourserver.com:4433/live');
255
+ await wt.ready;
256
+
257
+ // Send via WHATWG Streams API
258
+ const writer = wt.datagrams.writable.getWriter();
259
+ await writer.write(new TextEncoder().encode('Hello QUIC'));
260
+
261
+ // Receive
262
+ const reader = wt.datagrams.readable.getReader();
263
+ const { value } = await reader.read();
264
+ console.log('Received:', new TextDecoder().decode(value));
265
+ ```
266
+
267
+
268
+ ## πŸ§ͺ Testing
269
+
270
+ QUIC requires TLS 1.3. Self-signed RSA certificates usually fail with QUIC clients and browsers. For local development, [mkcert](https://github.com/FiloSottile/mkcert) is the easiest option β€” it generates locally-trusted ECDSA certificates automatically.
271
+
272
+ This project supports ALPN `"h3"` only (not draft variants like `h3-29`). You must explicitly force h3 when testing with Chrome.
273
+
274
+ **Chrome:**
275
+ ```bash
276
+ chrome --enable-quic --quic-version=h3 --ignore-certificate-errors --origin-to-force-quic-on=localhost:4433
277
+ ```
278
+
279
+ **curl:**
280
+ ```bash
281
+ curl --http3 https://localhost:4433 --insecure
282
+ ```
283
+
284
+ **Integration tests:**
285
+ ```bash
286
+ node examples/test_integration.js # HTTP/3 client + server β€” 19 tests
287
+ node examples/test_wt_server.js # WebTransport server echo (QUICO ↔ QUICO)
288
+ node examples/test_webtransport.js URL # WebTransport client against any server
289
+ ```
290
+
291
+
292
+ ## πŸ“ Project Structure
293
+
294
+ ```
295
+ quico/
296
+ β”œβ”€β”€ index.js β€” Public API exports
297
+ └── src/
298
+ β”œβ”€β”€ server.js β€” Unified server (drop-in for node:https)
299
+ β”œβ”€β”€ client.js β€” Unified client with H3 β†’ H2 β†’ H1 fallback
300
+ β”œβ”€β”€ agent.js β€” Connection pooling and Alt-Svc protocol cache
301
+ β”œβ”€β”€ streams.js β€” IncomingMessage, ServerResponse, ClientRequest
302
+ β”œβ”€β”€ h3.js β€” HTTP/3 framing, QPACK, WebTransport detection
303
+ β”œβ”€β”€ h3_server.js β€” HTTP/3 + WebTransport server
304
+ β”œβ”€β”€ h3_client.js β€” HTTP/3 client (DNS, UDP, QUIC, H3 pipeline)
305
+ β”œβ”€β”€ quic_connection.js β€” QUIC state machine, burst scheduler, flow control
306
+ β”œβ”€β”€ transport.js β€” Packet parsing, frame encoding/decoding
307
+ β”œβ”€β”€ crypto.js β€” AEAD encryption, header protection, key derivation
308
+ β”œβ”€β”€ tls_bridge.js β€” LemonTLS integration, transport parameters
309
+ └── webtransport.js β€” WebTransport client + stream classes
310
+ ```
311
+
312
+
313
+ ## πŸ›£ Roadmap
314
+
315
+ ### βœ… Done
316
+ - QUIC v1 transport (RFC 9000) β€” Initial, Handshake, 1-RTT
317
+ - TLS 1.3 via LemonTLS β€” X25519, P-256, P-384, AES-128/256-GCM
318
+ - HTTP/3 server and client (RFC 9114)
319
+ - QPACK header compression with static and dynamic tables (RFC 9204)
320
+ - WebTransport client and server β€” bidi/uni streams + datagrams (RFC 9297)
321
+ - Node.js `https`-style API compatibility β€” `createServer`, `request`, `get`
322
+ - Express / Fastify / Koa middleware support
323
+ - Connection reuse and multiplexing
324
+ - HelloRetryRequest β€” client and server
325
+ - Key updates (key phase rotation)
326
+ - Interop with Google, Cloudflare, Facebook, Microsoft, nginx
327
+ - Handshake timeout
328
+
329
+ ### πŸ”„ In Progress
330
+ - Loss detection and PTO timers (RFC 9002)
331
+ - Congestion control (BBR / CUBIC)
332
+ - 0-RTT and session resumption
333
+ - Debug log cleanup (`QUICO_DEBUG` environment flag)
334
+
335
+ ### ⏳ Planned
336
+ - Connection migration (PATH_CHALLENGE / PATH_RESPONSE)
337
+ - ChaCha20-Poly1305 cipher suite (0x1303)
338
+ - GOAWAY and graceful shutdown
339
+ - Stream priority (RFC 9218)
340
+ - TypeScript type definitions
341
+ - Performance benchmarks
342
+ - Fuzz testing
343
+
344
+ _Community contributions are welcome! Please ⭐ star the repo to follow progress._
345
+
346
+
347
+ ## πŸ™ Sponsors
348
+
349
+ QUICO is an evenings-and-weekends project.
350
+ Support development via **GitHub Sponsors** or simply share the project.
351
+
352
+
353
+
354
+ ## πŸ’¬ Contact
355
+
356
+ For feedback, ideas, or contributions,
357
+ contact directly at:
358
+ πŸ“§ **support@quicojs.dev**
359
+
360
+ For security-related issues, please see [SECURITY.md](./SECURITY.md).
361
+
362
+
363
+
364
+ ## πŸ“œ License
365
+
366
+ **Apache License 2.0**
367
+
368
+ ```
369
+ Copyright Β© 2025 colocohen
370
+
371
+ Licensed under the Apache License, Version 2.0 (the "License");
372
+ you may not use this file except in compliance with the License.
373
+ You may obtain a copy of the License at
374
+
375
+ http://www.apache.org/licenses/LICENSE-2.0
376
+
377
+ Unless required by applicable law or agreed to in writing, software
378
+ distributed under the License is distributed on an "AS IS" BASIS,
379
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
380
+ See the License for the specific language governing permissions and
381
+ limitations under the License.
217
382
  ```
package/index.cjs ADDED
@@ -0,0 +1,45 @@
1
+ /*
2
+ * quico β€” CommonJS entry point
3
+ *
4
+ * Since quico is ESM-only internally, CommonJS users
5
+ * must await .ready before calling any API:
6
+ *
7
+ * const quico = require('quico');
8
+ * await quico.ready;
9
+ * const server = quico.createServer({ ... }, handler);
10
+ *
11
+ * Or in one step:
12
+ *
13
+ * const quico = await require('quico').ready;
14
+ * const server = quico.createServer({ ... }, handler);
15
+ */
16
+
17
+ let _mod;
18
+
19
+ const proxy = new Proxy({}, {
20
+ get(target, key) {
21
+ // .ready must be accessible before module loads
22
+ if (key === 'ready') return target.ready;
23
+ // Prevent Promise auto-unwrapping when proxy is returned from async
24
+ if (key === 'then') return undefined;
25
+ if (!_mod) throw new Error(
26
+ 'quico: module not loaded yet. Use "const quico = await require(\'quico\').ready" first.'
27
+ );
28
+ return _mod[key];
29
+ }
30
+ });
31
+
32
+ // Kick off async ESM import β€” sets .ready on proxy target
33
+ proxy.ready = import('./index.js').then(function (m) {
34
+ // Merge default export (createServer, request, etc.)
35
+ // with named exports (WebTransport, etc.)
36
+ _mod = Object.assign({}, m.default);
37
+ for (var key in m) {
38
+ if (key !== 'default' && key !== '__esModule') {
39
+ _mod[key] = m[key];
40
+ }
41
+ }
42
+ return proxy;
43
+ });
44
+
45
+ module.exports = proxy;