quico 0.1.3 β 0.3.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 +381 -216
- package/index.cjs +45 -0
- package/index.d.ts +158 -0
- package/index.js +49 -23
- package/package.json +83 -60
- package/src/agent.js +283 -0
- package/src/client.js +444 -0
- package/src/crypto.js +534 -0
- package/src/h3.js +920 -0
- package/src/h3_client.js +332 -0
- package/src/h3_server.js +392 -0
- package/src/quic_connection.js +2338 -0
- package/src/quic_server.js +314 -0
- package/src/quic_socket.js +76 -0
- package/src/server.js +354 -0
- package/src/streams.js +471 -0
- package/src/tls_bridge.js +273 -0
- package/src/transport.js +667 -0
- package/src/utils.js +345 -0
- package/src/webtransport.js +655 -0
- package/CHANGELOG.md +0 -31
- package/examples/webtransport_datagram_echo_server/client.html +0 -58
- package/examples/webtransport_datagram_echo_server/server.js +0 -23
- package/h3_server.js +0 -416
- package/h3_socket.js +0 -473
- package/libs/crypto.js +0 -1841
- package/libs/h3.js +0 -1461
- package/libs/utils.js +0 -404
- package/quic_socket.js +0 -1550
- package/quico.svg +0 -1
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
|
|
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
|
-
>
|
|
21
|
-
> Use at your own risk and please report issues!
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
- **
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
QUIC
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
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 & 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;
|