rwebtransport 0.2.3 → 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.
Files changed (96) hide show
  1. package/Cargo.lock +153 -226
  2. package/Cargo.toml +5 -5
  3. package/README.md +4 -4
  4. package/crates/echo-server/src/bin/gen-test-cert.rs +1 -1
  5. package/crates/native/Cargo.toml +1 -1
  6. package/crates/native/src/config.rs +13 -1
  7. package/crates/native/src/driver.rs +249 -91
  8. package/crates/native/src/lib.rs +9 -10
  9. package/crates/native/src/parser_memory.rs +1 -0
  10. package/crates/native/src/server.rs +197 -182
  11. package/crates/native/src/session.rs +329 -177
  12. package/crates/native/src/test_support.rs +2 -2
  13. package/crates/wtcore/src/h3.rs +166 -10
  14. package/dist/index.js +92 -45
  15. package/dist/index.js.map +2 -2
  16. package/dist/index.mjs +92 -45
  17. package/dist/index.mjs.map +2 -2
  18. package/dist/native.d.ts +9 -4
  19. package/package.json +14 -11
  20. package/prebuilds/darwin-arm64/rwebtransport.node +0 -0
  21. package/prebuilds/linux-arm64/rwebtransport.node +0 -0
  22. package/prebuilds/linux-x64/rwebtransport.node +0 -0
  23. package/prebuilds/win32-x64/rwebtransport.node +0 -0
  24. package/scripts/build-linux-prebuilt.sh +46 -0
  25. package/scripts/build.js +10 -3
  26. package/vendor/quiche/AGENTS.md +10 -0
  27. package/vendor/quiche/Cargo.lock +239 -248
  28. package/vendor/quiche/Cargo.toml +23 -10
  29. package/vendor/quiche/examples/Makefile +4 -4
  30. package/vendor/quiche/examples/client.rs +10 -28
  31. package/vendor/quiche/examples/http3-client.rs +20 -34
  32. package/vendor/quiche/examples/http3-server.rs +47 -78
  33. package/vendor/quiche/examples/server.rs +19 -49
  34. package/vendor/quiche/include/quiche.h +35 -4
  35. package/vendor/quiche/src/build.rs +17 -0
  36. package/vendor/quiche/src/cid.rs +129 -61
  37. package/vendor/quiche/src/crypto/boringssl.rs +98 -86
  38. package/vendor/quiche/src/crypto/mod.rs +64 -77
  39. package/vendor/quiche/src/dgram.rs +2 -3
  40. package/vendor/quiche/src/error.rs +22 -20
  41. package/vendor/quiche/src/ffi.rs +558 -280
  42. package/vendor/quiche/src/flowcontrol.rs +0 -7
  43. package/vendor/quiche/src/frame.rs +134 -135
  44. package/vendor/quiche/src/h3/ffi.rs +73 -60
  45. package/vendor/quiche/src/h3/frame.rs +70 -90
  46. package/vendor/quiche/src/h3/mod.rs +1024 -593
  47. package/vendor/quiche/src/h3/qpack/decoder.rs +248 -34
  48. package/vendor/quiche/src/h3/qpack/dynamic_table.rs +859 -0
  49. package/vendor/quiche/src/h3/qpack/encoder.rs +14 -17
  50. package/vendor/quiche/src/h3/qpack/mod.rs +48 -0
  51. package/vendor/quiche/src/h3/qpack/static_table.rs +86 -73
  52. package/vendor/quiche/src/h3/stream.rs +1009 -194
  53. package/vendor/quiche/src/lib.rs +1346 -1195
  54. package/vendor/quiche/src/minmax.rs +2 -6
  55. package/vendor/quiche/src/packet.rs +420 -552
  56. package/vendor/quiche/src/path.rs +202 -72
  57. package/vendor/quiche/src/pmtud.rs +18 -16
  58. package/vendor/quiche/src/ranges.rs +184 -82
  59. package/vendor/quiche/src/recovery/AGENTS.md +5 -2
  60. package/vendor/quiche/src/recovery/bandwidth.rs +59 -40
  61. package/vendor/quiche/src/recovery/bytes_in_flight.rs +2 -2
  62. package/vendor/quiche/src/recovery/congestion/cubic.rs +38 -47
  63. package/vendor/quiche/src/recovery/congestion/delivery_rate.rs +54 -60
  64. package/vendor/quiche/src/recovery/congestion/hystart.rs +6 -10
  65. package/vendor/quiche/src/recovery/congestion/mod.rs +110 -42
  66. package/vendor/quiche/src/recovery/congestion/prr.rs +4 -1
  67. package/vendor/quiche/src/recovery/congestion/recovery.rs +91 -95
  68. package/vendor/quiche/src/recovery/congestion/reno.rs +17 -12
  69. package/vendor/quiche/src/recovery/congestion/test_sender.rs +8 -27
  70. package/vendor/quiche/src/recovery/gcongestion/bbr/bandwidth_sampler.rs +159 -247
  71. package/vendor/quiche/src/recovery/gcongestion/bbr/windowed_filter.rs +9 -14
  72. package/vendor/quiche/src/recovery/gcongestion/bbr2/drain.rs +18 -15
  73. package/vendor/quiche/src/recovery/gcongestion/bbr2/mode.rs +43 -28
  74. package/vendor/quiche/src/recovery/gcongestion/bbr2/network_model.rs +349 -76
  75. package/vendor/quiche/src/recovery/gcongestion/bbr2/probe_bw.rs +147 -195
  76. package/vendor/quiche/src/recovery/gcongestion/bbr2/probe_rtt.rs +29 -27
  77. package/vendor/quiche/src/recovery/gcongestion/bbr2/rtt_jump_detector/global_min.rs +180 -0
  78. package/vendor/quiche/src/recovery/gcongestion/bbr2/rtt_jump_detector/global_min_tests.rs +221 -0
  79. package/vendor/quiche/src/recovery/gcongestion/bbr2/rtt_jump_detector/hmm.rs +395 -0
  80. package/vendor/quiche/src/recovery/gcongestion/bbr2/rtt_jump_detector/hmm_tests.rs +473 -0
  81. package/vendor/quiche/src/recovery/gcongestion/bbr2/rtt_jump_detector/mod.rs +175 -0
  82. package/vendor/quiche/src/recovery/gcongestion/bbr2/startup.rs +33 -26
  83. package/vendor/quiche/src/recovery/gcongestion/bbr2.rs +107 -60
  84. package/vendor/quiche/src/recovery/gcongestion/mod.rs +64 -11
  85. package/vendor/quiche/src/recovery/gcongestion/pacer.rs +34 -25
  86. package/vendor/quiche/src/recovery/gcongestion/recovery.rs +81 -86
  87. package/vendor/quiche/src/recovery/mod.rs +414 -173
  88. package/vendor/quiche/src/recovery/rtt.rs +8 -5
  89. package/vendor/quiche/src/stream/mod.rs +864 -133
  90. package/vendor/quiche/src/stream/recv_buf.rs +471 -172
  91. package/vendor/quiche/src/stream/send_buf.rs +338 -81
  92. package/vendor/quiche/src/test_utils.rs +78 -64
  93. package/vendor/quiche/src/tests.rs +2559 -1335
  94. package/vendor/quiche/src/tls/boringssl.rs +60 -63
  95. package/vendor/quiche/src/tls/mod.rs +146 -193
  96. 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, config: &mut h3::Config,
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, quic_conn: &mut 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, quic_conn: &mut Connection,
229
- headers: *const Header, headers_len: size_t, fin: bool,
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, quic_conn: &mut Connection, stream_id: u64,
243
- headers: *const Header, headers_len: size_t, fin: bool,
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, quic_conn: &mut Connection, stream_id: u64,
257
- headers: *const Header, headers_len: size_t, priority: &Priority, fin: bool,
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, quic_conn: &mut Connection, stream_id: u64,
277
- headers: *const Header, headers_len: size_t, is_trailer_section: bool,
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, quic_conn: &mut Connection, stream_id: u64,
298
- body: *const u8, body_len: size_t, fin: bool,
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, quic_conn: &mut Connection, stream_id: u64,
316
- out: *mut u8, out_len: size_t,
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, quic_conn: &mut Connection, id: u64,
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, priority_len: size_t, parsed: &mut Priority,
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, quic_conn: &mut Connection, stream_id: u64,
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, prioritized_element_id: u64,
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, quic_conn: &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();