rwebtransport 0.2.2 → 0.2.5
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/Cargo.lock +523 -140
- package/Cargo.toml +5 -5
- package/README.md +8 -4
- package/crates/echo-server/src/bin/gen-test-cert.rs +1 -1
- package/crates/native/Cargo.toml +2 -0
- package/crates/native/src/config.rs +69 -8
- package/crates/native/src/driver.rs +253 -90
- package/crates/native/src/lib.rs +80 -57
- package/crates/native/src/parser_memory.rs +203 -0
- package/crates/native/src/server.rs +215 -183
- package/crates/native/src/session.rs +1341 -243
- package/crates/native/src/test_support.rs +119 -0
- package/crates/wtcore/Cargo.toml +1 -0
- package/crates/wtcore/src/h3.rs +250 -46
- package/dist/index.js +218 -75
- package/dist/index.js.map +7 -1
- package/dist/index.mjs +214 -69
- package/dist/index.mjs.map +7 -1
- package/dist/native.d.ts +10 -4
- package/dist/server.d.ts +1 -0
- package/package.json +84 -78
- package/prebuilds/darwin-arm64/rwebtransport.node +0 -0
- package/prebuilds/linux-arm64/rwebtransport.node +0 -0
- package/prebuilds/linux-x64/rwebtransport.node +0 -0
- package/prebuilds/win32-x64/rwebtransport.node +0 -0
- package/scripts/build-linux-prebuilt.sh +46 -0
- package/scripts/build-ts.js +41 -0
- package/scripts/build.js +10 -3
- package/vendor/quiche/AGENTS.md +10 -0
- package/vendor/quiche/Cargo.lock +239 -248
- package/vendor/quiche/Cargo.toml +23 -10
- package/vendor/quiche/examples/Makefile +4 -4
- package/vendor/quiche/examples/client.rs +10 -28
- package/vendor/quiche/examples/http3-client.rs +20 -34
- package/vendor/quiche/examples/http3-server.rs +47 -78
- package/vendor/quiche/examples/server.rs +19 -49
- package/vendor/quiche/include/quiche.h +35 -4
- package/vendor/quiche/src/build.rs +17 -0
- package/vendor/quiche/src/cid.rs +129 -61
- package/vendor/quiche/src/crypto/boringssl.rs +98 -86
- package/vendor/quiche/src/crypto/mod.rs +64 -77
- package/vendor/quiche/src/dgram.rs +2 -3
- package/vendor/quiche/src/error.rs +22 -20
- package/vendor/quiche/src/ffi.rs +558 -280
- package/vendor/quiche/src/flowcontrol.rs +0 -7
- package/vendor/quiche/src/frame.rs +134 -135
- package/vendor/quiche/src/h3/ffi.rs +73 -60
- package/vendor/quiche/src/h3/frame.rs +70 -90
- package/vendor/quiche/src/h3/mod.rs +1024 -593
- package/vendor/quiche/src/h3/qpack/decoder.rs +248 -34
- package/vendor/quiche/src/h3/qpack/dynamic_table.rs +859 -0
- package/vendor/quiche/src/h3/qpack/encoder.rs +14 -17
- package/vendor/quiche/src/h3/qpack/mod.rs +48 -0
- package/vendor/quiche/src/h3/qpack/static_table.rs +86 -73
- package/vendor/quiche/src/h3/stream.rs +1009 -194
- package/vendor/quiche/src/lib.rs +1361 -1195
- package/vendor/quiche/src/minmax.rs +2 -6
- package/vendor/quiche/src/packet.rs +420 -552
- package/vendor/quiche/src/path.rs +202 -72
- package/vendor/quiche/src/pmtud.rs +18 -16
- package/vendor/quiche/src/ranges.rs +184 -82
- package/vendor/quiche/src/recovery/AGENTS.md +5 -2
- package/vendor/quiche/src/recovery/bandwidth.rs +59 -40
- package/vendor/quiche/src/recovery/bytes_in_flight.rs +2 -2
- package/vendor/quiche/src/recovery/congestion/cubic.rs +38 -47
- package/vendor/quiche/src/recovery/congestion/delivery_rate.rs +54 -60
- package/vendor/quiche/src/recovery/congestion/hystart.rs +6 -10
- package/vendor/quiche/src/recovery/congestion/mod.rs +110 -42
- package/vendor/quiche/src/recovery/congestion/prr.rs +4 -1
- package/vendor/quiche/src/recovery/congestion/recovery.rs +91 -95
- package/vendor/quiche/src/recovery/congestion/reno.rs +17 -12
- package/vendor/quiche/src/recovery/congestion/test_sender.rs +8 -27
- package/vendor/quiche/src/recovery/gcongestion/bbr/bandwidth_sampler.rs +159 -247
- package/vendor/quiche/src/recovery/gcongestion/bbr/windowed_filter.rs +9 -14
- package/vendor/quiche/src/recovery/gcongestion/bbr2/drain.rs +18 -15
- package/vendor/quiche/src/recovery/gcongestion/bbr2/mode.rs +43 -28
- package/vendor/quiche/src/recovery/gcongestion/bbr2/network_model.rs +349 -76
- package/vendor/quiche/src/recovery/gcongestion/bbr2/probe_bw.rs +147 -195
- package/vendor/quiche/src/recovery/gcongestion/bbr2/probe_rtt.rs +29 -27
- package/vendor/quiche/src/recovery/gcongestion/bbr2/rtt_jump_detector/global_min.rs +180 -0
- package/vendor/quiche/src/recovery/gcongestion/bbr2/rtt_jump_detector/global_min_tests.rs +221 -0
- package/vendor/quiche/src/recovery/gcongestion/bbr2/rtt_jump_detector/hmm.rs +395 -0
- package/vendor/quiche/src/recovery/gcongestion/bbr2/rtt_jump_detector/hmm_tests.rs +473 -0
- package/vendor/quiche/src/recovery/gcongestion/bbr2/rtt_jump_detector/mod.rs +175 -0
- package/vendor/quiche/src/recovery/gcongestion/bbr2/startup.rs +33 -26
- package/vendor/quiche/src/recovery/gcongestion/bbr2.rs +107 -60
- package/vendor/quiche/src/recovery/gcongestion/mod.rs +64 -11
- package/vendor/quiche/src/recovery/gcongestion/pacer.rs +34 -25
- package/vendor/quiche/src/recovery/gcongestion/recovery.rs +81 -86
- package/vendor/quiche/src/recovery/mod.rs +414 -173
- package/vendor/quiche/src/recovery/rtt.rs +8 -5
- package/vendor/quiche/src/stream/mod.rs +864 -133
- package/vendor/quiche/src/stream/recv_buf.rs +476 -172
- package/vendor/quiche/src/stream/send_buf.rs +343 -81
- package/vendor/quiche/src/test_utils.rs +78 -64
- package/vendor/quiche/src/tests.rs +2559 -1335
- package/vendor/quiche/src/tls/boringssl.rs +60 -63
- package/vendor/quiche/src/tls/mod.rs +146 -193
- package/vendor/quiche/src/transport_params.rs +87 -103
|
@@ -50,33 +50,30 @@ pub extern "C" fn quiche_h3_config_new() -> *mut h3::Config {
|
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
#[no_mangle]
|
|
53
|
-
pub extern "C" fn quiche_h3_config_set_max_field_section_size(
|
|
54
|
-
config: &mut h3::Config, v: u64,
|
|
55
|
-
) {
|
|
53
|
+
pub extern "C" fn quiche_h3_config_set_max_field_section_size(config: &mut h3::Config, v: u64) {
|
|
56
54
|
config.set_max_field_section_size(v);
|
|
57
55
|
}
|
|
58
56
|
|
|
59
57
|
#[no_mangle]
|
|
60
|
-
pub extern "C" fn quiche_h3_config_set_qpack_max_table_capacity(
|
|
61
|
-
config: &mut h3::Config, v: u64,
|
|
62
|
-
) {
|
|
58
|
+
pub extern "C" fn quiche_h3_config_set_qpack_max_table_capacity(config: &mut h3::Config, v: u64) {
|
|
63
59
|
config.set_qpack_max_table_capacity(v);
|
|
64
60
|
}
|
|
65
61
|
|
|
66
62
|
#[no_mangle]
|
|
67
|
-
pub extern "C" fn quiche_h3_config_set_qpack_blocked_streams(
|
|
68
|
-
config: &mut h3::Config, v: u64,
|
|
69
|
-
) {
|
|
63
|
+
pub extern "C" fn quiche_h3_config_set_qpack_blocked_streams(config: &mut h3::Config, v: u64) {
|
|
70
64
|
config.set_qpack_blocked_streams(v);
|
|
71
65
|
}
|
|
72
66
|
|
|
73
67
|
#[no_mangle]
|
|
74
|
-
pub extern "C" fn quiche_h3_config_enable_extended_connect(
|
|
75
|
-
config: &mut h3::Config, enabled: bool,
|
|
76
|
-
) {
|
|
68
|
+
pub extern "C" fn quiche_h3_config_enable_extended_connect(config: &mut h3::Config, enabled: bool) {
|
|
77
69
|
config.enable_extended_connect(enabled);
|
|
78
70
|
}
|
|
79
71
|
|
|
72
|
+
#[no_mangle]
|
|
73
|
+
pub extern "C" fn quiche_h3_config_set_max_priority_update_size(config: &mut h3::Config, v: u64) {
|
|
74
|
+
config.set_max_priority_update_size(v);
|
|
75
|
+
}
|
|
76
|
+
|
|
80
77
|
#[no_mangle]
|
|
81
78
|
pub extern "C" fn quiche_h3_config_free(config: *mut h3::Config) {
|
|
82
79
|
if !config.is_null() {
|
|
@@ -86,7 +83,8 @@ pub extern "C" fn quiche_h3_config_free(config: *mut h3::Config) {
|
|
|
86
83
|
|
|
87
84
|
#[no_mangle]
|
|
88
85
|
pub extern "C" fn quiche_h3_conn_new_with_transport(
|
|
89
|
-
quic_conn: &mut Connection,
|
|
86
|
+
quic_conn: &mut Connection,
|
|
87
|
+
config: &mut h3::Config,
|
|
90
88
|
) -> *mut h3::Connection {
|
|
91
89
|
match h3::Connection::with_transport(quic_conn, config) {
|
|
92
90
|
Ok(c) => Box::into_raw(Box::new(c)),
|
|
@@ -112,7 +110,7 @@ pub extern "C" fn quiche_h3_for_each_setting(
|
|
|
112
110
|
}
|
|
113
111
|
|
|
114
112
|
0
|
|
115
|
-
}
|
|
113
|
+
}
|
|
116
114
|
|
|
117
115
|
None => -1,
|
|
118
116
|
}
|
|
@@ -120,7 +118,8 @@ pub extern "C" fn quiche_h3_for_each_setting(
|
|
|
120
118
|
|
|
121
119
|
#[no_mangle]
|
|
122
120
|
pub extern "C" fn quiche_h3_conn_poll(
|
|
123
|
-
conn: &mut h3::Connection,
|
|
121
|
+
conn: &mut h3::Connection,
|
|
122
|
+
quic_conn: &mut Connection,
|
|
124
123
|
ev: *mut *const h3::Event,
|
|
125
124
|
) -> i64 {
|
|
126
125
|
match conn.poll(quic_conn) {
|
|
@@ -130,7 +129,7 @@ pub extern "C" fn quiche_h3_conn_poll(
|
|
|
130
129
|
}
|
|
131
130
|
|
|
132
131
|
id as i64
|
|
133
|
-
}
|
|
132
|
+
}
|
|
134
133
|
|
|
135
134
|
Err(e) => e.to_c() as i64,
|
|
136
135
|
}
|
|
@@ -168,7 +167,7 @@ pub extern "C" fn quiche_h3_event_for_each_header(
|
|
|
168
167
|
argp: *mut c_void,
|
|
169
168
|
) -> c_int {
|
|
170
169
|
match ev {
|
|
171
|
-
h3::Event::Headers { list, .. } =>
|
|
170
|
+
h3::Event::Headers { list, .. } => {
|
|
172
171
|
for h in list {
|
|
173
172
|
let rc = cb(
|
|
174
173
|
h.name().as_ptr(),
|
|
@@ -181,7 +180,8 @@ pub extern "C" fn quiche_h3_event_for_each_header(
|
|
|
181
180
|
if rc != 0 {
|
|
182
181
|
return rc;
|
|
183
182
|
}
|
|
184
|
-
}
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
185
|
|
|
186
186
|
_ => unreachable!(),
|
|
187
187
|
}
|
|
@@ -190,9 +190,7 @@ pub extern "C" fn quiche_h3_event_for_each_header(
|
|
|
190
190
|
}
|
|
191
191
|
|
|
192
192
|
#[no_mangle]
|
|
193
|
-
pub extern "C" fn quiche_h3_event_headers_has_more_frames(
|
|
194
|
-
ev: &h3::Event,
|
|
195
|
-
) -> bool {
|
|
193
|
+
pub extern "C" fn quiche_h3_event_headers_has_more_frames(ev: &h3::Event) -> bool {
|
|
196
194
|
match ev {
|
|
197
195
|
h3::Event::Headers { more_frames, .. } => *more_frames,
|
|
198
196
|
|
|
@@ -201,9 +199,7 @@ pub extern "C" fn quiche_h3_event_headers_has_more_frames(
|
|
|
201
199
|
}
|
|
202
200
|
|
|
203
201
|
#[no_mangle]
|
|
204
|
-
pub extern "C" fn quiche_h3_extended_connect_enabled_by_peer(
|
|
205
|
-
conn: &h3::Connection,
|
|
206
|
-
) -> bool {
|
|
202
|
+
pub extern "C" fn quiche_h3_extended_connect_enabled_by_peer(conn: &h3::Connection) -> bool {
|
|
207
203
|
conn.extended_connect_enabled_by_peer()
|
|
208
204
|
}
|
|
209
205
|
|
|
@@ -225,8 +221,11 @@ pub struct Header {
|
|
|
225
221
|
|
|
226
222
|
#[no_mangle]
|
|
227
223
|
pub extern "C" fn quiche_h3_send_request(
|
|
228
|
-
conn: &mut h3::Connection,
|
|
229
|
-
|
|
224
|
+
conn: &mut h3::Connection,
|
|
225
|
+
quic_conn: &mut Connection,
|
|
226
|
+
headers: *const Header,
|
|
227
|
+
headers_len: size_t,
|
|
228
|
+
fin: bool,
|
|
230
229
|
) -> i64 {
|
|
231
230
|
let req_headers = headers_from_ptr(headers, headers_len);
|
|
232
231
|
|
|
@@ -239,8 +238,12 @@ pub extern "C" fn quiche_h3_send_request(
|
|
|
239
238
|
|
|
240
239
|
#[no_mangle]
|
|
241
240
|
pub extern "C" fn quiche_h3_send_response(
|
|
242
|
-
conn: &mut h3::Connection,
|
|
243
|
-
|
|
241
|
+
conn: &mut h3::Connection,
|
|
242
|
+
quic_conn: &mut Connection,
|
|
243
|
+
stream_id: u64,
|
|
244
|
+
headers: *const Header,
|
|
245
|
+
headers_len: size_t,
|
|
246
|
+
fin: bool,
|
|
244
247
|
) -> c_int {
|
|
245
248
|
let resp_headers = headers_from_ptr(headers, headers_len);
|
|
246
249
|
|
|
@@ -253,18 +256,17 @@ pub extern "C" fn quiche_h3_send_response(
|
|
|
253
256
|
|
|
254
257
|
#[no_mangle]
|
|
255
258
|
pub extern "C" fn quiche_h3_send_response_with_priority(
|
|
256
|
-
conn: &mut h3::Connection,
|
|
257
|
-
|
|
259
|
+
conn: &mut h3::Connection,
|
|
260
|
+
quic_conn: &mut Connection,
|
|
261
|
+
stream_id: u64,
|
|
262
|
+
headers: *const Header,
|
|
263
|
+
headers_len: size_t,
|
|
264
|
+
priority: &Priority,
|
|
265
|
+
fin: bool,
|
|
258
266
|
) -> c_int {
|
|
259
267
|
let resp_headers = headers_from_ptr(headers, headers_len);
|
|
260
268
|
|
|
261
|
-
match conn.send_response_with_priority(
|
|
262
|
-
quic_conn,
|
|
263
|
-
stream_id,
|
|
264
|
-
&resp_headers,
|
|
265
|
-
priority,
|
|
266
|
-
fin,
|
|
267
|
-
) {
|
|
269
|
+
match conn.send_response_with_priority(quic_conn, stream_id, &resp_headers, priority, fin) {
|
|
268
270
|
Ok(_) => 0,
|
|
269
271
|
|
|
270
272
|
Err(e) => e.to_c() as c_int,
|
|
@@ -273,19 +275,17 @@ pub extern "C" fn quiche_h3_send_response_with_priority(
|
|
|
273
275
|
|
|
274
276
|
#[no_mangle]
|
|
275
277
|
pub extern "C" fn quiche_h3_send_additional_headers(
|
|
276
|
-
conn: &mut h3::Connection,
|
|
277
|
-
|
|
278
|
+
conn: &mut h3::Connection,
|
|
279
|
+
quic_conn: &mut Connection,
|
|
280
|
+
stream_id: u64,
|
|
281
|
+
headers: *const Header,
|
|
282
|
+
headers_len: size_t,
|
|
283
|
+
is_trailer_section: bool,
|
|
278
284
|
fin: bool,
|
|
279
285
|
) -> c_int {
|
|
280
286
|
let headers = headers_from_ptr(headers, headers_len);
|
|
281
287
|
|
|
282
|
-
match conn.send_additional_headers(
|
|
283
|
-
quic_conn,
|
|
284
|
-
stream_id,
|
|
285
|
-
&headers,
|
|
286
|
-
is_trailer_section,
|
|
287
|
-
fin,
|
|
288
|
-
) {
|
|
288
|
+
match conn.send_additional_headers(quic_conn, stream_id, &headers, is_trailer_section, fin) {
|
|
289
289
|
Ok(_) => 0,
|
|
290
290
|
|
|
291
291
|
Err(e) => e.to_c() as c_int,
|
|
@@ -294,8 +294,12 @@ pub extern "C" fn quiche_h3_send_additional_headers(
|
|
|
294
294
|
|
|
295
295
|
#[no_mangle]
|
|
296
296
|
pub extern "C" fn quiche_h3_send_body(
|
|
297
|
-
conn: &mut h3::Connection,
|
|
298
|
-
|
|
297
|
+
conn: &mut h3::Connection,
|
|
298
|
+
quic_conn: &mut Connection,
|
|
299
|
+
stream_id: u64,
|
|
300
|
+
body: *const u8,
|
|
301
|
+
body_len: size_t,
|
|
302
|
+
fin: bool,
|
|
299
303
|
) -> ssize_t {
|
|
300
304
|
if body_len > <ssize_t>::MAX as usize {
|
|
301
305
|
panic!("The provided buffer is too large");
|
|
@@ -312,8 +316,11 @@ pub extern "C" fn quiche_h3_send_body(
|
|
|
312
316
|
|
|
313
317
|
#[no_mangle]
|
|
314
318
|
pub extern "C" fn quiche_h3_recv_body(
|
|
315
|
-
conn: &mut h3::Connection,
|
|
316
|
-
|
|
319
|
+
conn: &mut h3::Connection,
|
|
320
|
+
quic_conn: &mut Connection,
|
|
321
|
+
stream_id: u64,
|
|
322
|
+
out: *mut u8,
|
|
323
|
+
out_len: size_t,
|
|
317
324
|
) -> ssize_t {
|
|
318
325
|
if out_len > <ssize_t>::MAX as usize {
|
|
319
326
|
panic!("The provided buffer is too large");
|
|
@@ -330,7 +337,9 @@ pub extern "C" fn quiche_h3_recv_body(
|
|
|
330
337
|
|
|
331
338
|
#[no_mangle]
|
|
332
339
|
pub extern "C" fn quiche_h3_send_goaway(
|
|
333
|
-
conn: &mut h3::Connection,
|
|
340
|
+
conn: &mut h3::Connection,
|
|
341
|
+
quic_conn: &mut Connection,
|
|
342
|
+
id: u64,
|
|
334
343
|
) -> c_int {
|
|
335
344
|
match conn.send_goaway(quic_conn, id) {
|
|
336
345
|
Ok(()) => 0,
|
|
@@ -342,7 +351,9 @@ pub extern "C" fn quiche_h3_send_goaway(
|
|
|
342
351
|
#[no_mangle]
|
|
343
352
|
#[cfg(feature = "sfv")]
|
|
344
353
|
pub extern "C" fn quiche_h3_parse_extensible_priority(
|
|
345
|
-
priority: *const u8,
|
|
354
|
+
priority: *const u8,
|
|
355
|
+
priority_len: size_t,
|
|
356
|
+
parsed: &mut Priority,
|
|
346
357
|
) -> c_int {
|
|
347
358
|
let priority = unsafe { slice::from_raw_parts(priority, priority_len) };
|
|
348
359
|
|
|
@@ -351,7 +362,7 @@ pub extern "C" fn quiche_h3_parse_extensible_priority(
|
|
|
351
362
|
parsed.urgency = v.urgency;
|
|
352
363
|
parsed.incremental = v.incremental;
|
|
353
364
|
0
|
|
354
|
-
}
|
|
365
|
+
}
|
|
355
366
|
|
|
356
367
|
Err(e) => e.to_c() as c_int,
|
|
357
368
|
}
|
|
@@ -359,7 +370,9 @@ pub extern "C" fn quiche_h3_parse_extensible_priority(
|
|
|
359
370
|
|
|
360
371
|
#[no_mangle]
|
|
361
372
|
pub extern "C" fn quiche_h3_send_priority_update_for_request(
|
|
362
|
-
conn: &mut h3::Connection,
|
|
373
|
+
conn: &mut h3::Connection,
|
|
374
|
+
quic_conn: &mut Connection,
|
|
375
|
+
stream_id: u64,
|
|
363
376
|
priority: &Priority,
|
|
364
377
|
) -> c_int {
|
|
365
378
|
match conn.send_priority_update_for_request(quic_conn, stream_id, priority) {
|
|
@@ -371,7 +384,8 @@ pub extern "C" fn quiche_h3_send_priority_update_for_request(
|
|
|
371
384
|
|
|
372
385
|
#[no_mangle]
|
|
373
386
|
pub extern "C" fn quiche_h3_take_last_priority_update(
|
|
374
|
-
conn: &mut h3::Connection,
|
|
387
|
+
conn: &mut h3::Connection,
|
|
388
|
+
prioritized_element_id: u64,
|
|
375
389
|
cb: extern "C" fn(
|
|
376
390
|
priority_field_value: *const u8,
|
|
377
391
|
priority_field_value_len: size_t,
|
|
@@ -388,7 +402,7 @@ pub extern "C" fn quiche_h3_take_last_priority_update(
|
|
|
388
402
|
}
|
|
389
403
|
|
|
390
404
|
0
|
|
391
|
-
}
|
|
405
|
+
}
|
|
392
406
|
|
|
393
407
|
Err(e) => e.to_c() as c_int,
|
|
394
408
|
}
|
|
@@ -396,7 +410,8 @@ pub extern "C" fn quiche_h3_take_last_priority_update(
|
|
|
396
410
|
|
|
397
411
|
#[no_mangle]
|
|
398
412
|
pub extern "C" fn quiche_h3_dgram_enabled_by_peer(
|
|
399
|
-
conn: &h3::Connection,
|
|
413
|
+
conn: &h3::Connection,
|
|
414
|
+
quic_conn: &Connection,
|
|
400
415
|
) -> bool {
|
|
401
416
|
conn.dgram_enabled_by_peer(quic_conn)
|
|
402
417
|
}
|
|
@@ -408,9 +423,7 @@ pub extern "C" fn quiche_h3_conn_free(conn: *mut h3::Connection) {
|
|
|
408
423
|
}
|
|
409
424
|
}
|
|
410
425
|
|
|
411
|
-
fn headers_from_ptr<'a>(
|
|
412
|
-
ptr: *const Header, len: size_t,
|
|
413
|
-
) -> Vec<h3::HeaderRef<'a>> {
|
|
426
|
+
fn headers_from_ptr<'a>(ptr: *const Header, len: size_t) -> Vec<h3::HeaderRef<'a>> {
|
|
414
427
|
let headers = unsafe { slice::from_raw_parts(ptr, len) };
|
|
415
428
|
|
|
416
429
|
let mut out = Vec::new();
|