rwebtransport 0.1.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/Cargo.lock +666 -0
- package/Cargo.toml +31 -0
- package/LICENSE +202 -0
- package/NOTICE +41 -0
- package/README.md +550 -0
- package/crates/echo-server/Cargo.toml +20 -0
- package/crates/echo-server/src/main.rs +666 -0
- package/crates/native/Cargo.toml +23 -0
- package/crates/native/src/config.rs +129 -0
- package/crates/native/src/driver.rs +463 -0
- package/crates/native/src/lib.rs +821 -0
- package/crates/native/src/server.rs +718 -0
- package/crates/native/src/session.rs +1191 -0
- package/crates/native/src/tls.rs +96 -0
- package/crates/wtcore/Cargo.toml +15 -0
- package/crates/wtcore/src/h3.rs +226 -0
- package/crates/wtcore/src/lib.rs +9 -0
- package/dist/datagrams.d.ts +16 -0
- package/dist/errors.d.ts +10 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +1512 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +1473 -0
- package/dist/index.mjs.map +1 -0
- package/dist/loader.d.ts +2 -0
- package/dist/native.d.ts +226 -0
- package/dist/server.d.ts +44 -0
- package/dist/streams.d.ts +14 -0
- package/dist/types.d.ts +24 -0
- package/dist/webtransport.d.ts +20 -0
- package/package.json +79 -0
- package/prebuilds/win32-x64/rwebtransport.node +0 -0
- package/scripts/bench.mjs +180 -0
- package/scripts/build.js +67 -0
- package/scripts/postinstall.js +67 -0
- package/scripts/setup-unix.sh +129 -0
- package/scripts/setup-windows.ps1 +229 -0
- package/vendor/quiche/AGENTS.md +75 -0
- package/vendor/quiche/COPYING +23 -0
- package/vendor/quiche/Cargo.lock +1212 -0
- package/vendor/quiche/Cargo.toml +215 -0
- package/vendor/quiche/README.md +466 -0
- package/vendor/quiche/examples/Makefile +46 -0
- package/vendor/quiche/examples/README.md +20 -0
- package/vendor/quiche/examples/cert-big.crt +90 -0
- package/vendor/quiche/examples/cert.crt +18 -0
- package/vendor/quiche/examples/cert.key +28 -0
- package/vendor/quiche/examples/client.c +343 -0
- package/vendor/quiche/examples/client.rs +281 -0
- package/vendor/quiche/examples/gen-certs.sh +15 -0
- package/vendor/quiche/examples/http3-client.c +473 -0
- package/vendor/quiche/examples/http3-client.rs +349 -0
- package/vendor/quiche/examples/http3-server.c +614 -0
- package/vendor/quiche/examples/http3-server.rs +680 -0
- package/vendor/quiche/examples/qpack-decode.rs +87 -0
- package/vendor/quiche/examples/qpack-encode.rs +88 -0
- package/vendor/quiche/examples/rootca.crt +21 -0
- package/vendor/quiche/examples/server.c +529 -0
- package/vendor/quiche/examples/server.rs +529 -0
- package/vendor/quiche/include/quiche.h +1282 -0
- package/vendor/quiche/quiche.svg +1 -0
- package/vendor/quiche/src/buffers.rs +105 -0
- package/vendor/quiche/src/build.rs +66 -0
- package/vendor/quiche/src/cid.rs +1079 -0
- package/vendor/quiche/src/crypto/boringssl.rs +373 -0
- package/vendor/quiche/src/crypto/mod.rs +671 -0
- package/vendor/quiche/src/dgram.rs +118 -0
- package/vendor/quiche/src/error.rs +263 -0
- package/vendor/quiche/src/ffi.rs +2290 -0
- package/vendor/quiche/src/flowcontrol.rs +246 -0
- package/vendor/quiche/src/frame.rs +2172 -0
- package/vendor/quiche/src/h3/AGENTS.md +54 -0
- package/vendor/quiche/src/h3/ffi.rs +442 -0
- package/vendor/quiche/src/h3/frame.rs +1404 -0
- package/vendor/quiche/src/h3/mod.rs +8223 -0
- package/vendor/quiche/src/h3/qpack/decoder.rs +288 -0
- package/vendor/quiche/src/h3/qpack/encoder.rs +235 -0
- package/vendor/quiche/src/h3/qpack/mod.rs +202 -0
- package/vendor/quiche/src/h3/qpack/static_table.rs +323 -0
- package/vendor/quiche/src/h3/stream.rs +1595 -0
- package/vendor/quiche/src/lib.rs +9556 -0
- package/vendor/quiche/src/minmax.rs +446 -0
- package/vendor/quiche/src/packet.rs +2334 -0
- package/vendor/quiche/src/path.rs +1374 -0
- package/vendor/quiche/src/pmtud.rs +652 -0
- package/vendor/quiche/src/rand.rs +64 -0
- package/vendor/quiche/src/range_buf.rs +186 -0
- package/vendor/quiche/src/ranges.rs +755 -0
- package/vendor/quiche/src/recovery/AGENTS.md +80 -0
- package/vendor/quiche/src/recovery/bandwidth.rs +565 -0
- package/vendor/quiche/src/recovery/bytes_in_flight.rs +179 -0
- package/vendor/quiche/src/recovery/congestion/cubic.rs +1038 -0
- package/vendor/quiche/src/recovery/congestion/delivery_rate.rs +514 -0
- package/vendor/quiche/src/recovery/congestion/hystart.rs +241 -0
- package/vendor/quiche/src/recovery/congestion/mod.rs +361 -0
- package/vendor/quiche/src/recovery/congestion/prr.rs +238 -0
- package/vendor/quiche/src/recovery/congestion/recovery.rs +1170 -0
- package/vendor/quiche/src/recovery/congestion/reno.rs +291 -0
- package/vendor/quiche/src/recovery/congestion/test_sender.rs +201 -0
- package/vendor/quiche/src/recovery/gcongestion/bbr/bandwidth_sampler.rs +1947 -0
- package/vendor/quiche/src/recovery/gcongestion/bbr/windowed_filter.rs +158 -0
- package/vendor/quiche/src/recovery/gcongestion/bbr.rs +37 -0
- package/vendor/quiche/src/recovery/gcongestion/bbr2/drain.rs +120 -0
- package/vendor/quiche/src/recovery/gcongestion/bbr2/mode.rs +318 -0
- package/vendor/quiche/src/recovery/gcongestion/bbr2/network_model.rs +784 -0
- package/vendor/quiche/src/recovery/gcongestion/bbr2/probe_bw.rs +729 -0
- package/vendor/quiche/src/recovery/gcongestion/bbr2/probe_rtt.rs +175 -0
- package/vendor/quiche/src/recovery/gcongestion/bbr2/startup.rs +190 -0
- package/vendor/quiche/src/recovery/gcongestion/bbr2.rs +855 -0
- package/vendor/quiche/src/recovery/gcongestion/mod.rs +275 -0
- package/vendor/quiche/src/recovery/gcongestion/pacer.rs +294 -0
- package/vendor/quiche/src/recovery/gcongestion/recovery.rs +1384 -0
- package/vendor/quiche/src/recovery/mod.rs +3086 -0
- package/vendor/quiche/src/recovery/rtt.rs +152 -0
- package/vendor/quiche/src/stream/mod.rs +2210 -0
- package/vendor/quiche/src/stream/recv_buf.rs +1236 -0
- package/vendor/quiche/src/stream/send_buf.rs +849 -0
- package/vendor/quiche/src/test_utils.rs +681 -0
- package/vendor/quiche/src/tests.rs +12922 -0
- package/vendor/quiche/src/tls/boringssl.rs +375 -0
- package/vendor/quiche/src/tls/mod.rs +1245 -0
- package/vendor/quiche/src/transport_params.rs +628 -0
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
// Copyright (C) 2019, Cloudflare, Inc.
|
|
2
|
+
// All rights reserved.
|
|
3
|
+
//
|
|
4
|
+
// Redistribution and use in source and binary forms, with or without
|
|
5
|
+
// modification, are permitted provided that the following conditions are
|
|
6
|
+
// met:
|
|
7
|
+
//
|
|
8
|
+
// * Redistributions of source code must retain the above copyright notice,
|
|
9
|
+
// this list of conditions and the following disclaimer.
|
|
10
|
+
//
|
|
11
|
+
// * Redistributions in binary form must reproduce the above copyright
|
|
12
|
+
// notice, this list of conditions and the following disclaimer in the
|
|
13
|
+
// documentation and/or other materials provided with the distribution.
|
|
14
|
+
//
|
|
15
|
+
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
|
|
16
|
+
// IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
|
17
|
+
// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
18
|
+
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
|
19
|
+
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
|
20
|
+
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
|
21
|
+
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
|
22
|
+
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
|
23
|
+
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
24
|
+
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
25
|
+
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
26
|
+
|
|
27
|
+
#[macro_use]
|
|
28
|
+
extern crate log;
|
|
29
|
+
|
|
30
|
+
use std::fs::File;
|
|
31
|
+
|
|
32
|
+
use std::io::prelude::*;
|
|
33
|
+
|
|
34
|
+
use quiche::h3::NameValue;
|
|
35
|
+
|
|
36
|
+
use quiche::h3::qpack;
|
|
37
|
+
|
|
38
|
+
fn main() {
|
|
39
|
+
// TODO: parse params from file name.
|
|
40
|
+
|
|
41
|
+
let mut args = std::env::args();
|
|
42
|
+
|
|
43
|
+
let cmd = &args.next().unwrap();
|
|
44
|
+
|
|
45
|
+
if args.len() != 1 {
|
|
46
|
+
println!("Usage: {cmd} FILE");
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
let mut file = File::open(args.next().unwrap()).unwrap();
|
|
51
|
+
|
|
52
|
+
let mut dec = qpack::Decoder::new();
|
|
53
|
+
|
|
54
|
+
loop {
|
|
55
|
+
let mut stream_id: [u8; 8] = [0; 8];
|
|
56
|
+
let mut len: [u8; 4] = [0; 4];
|
|
57
|
+
|
|
58
|
+
let _ = file.read(&mut stream_id).unwrap();
|
|
59
|
+
let stream_id = u64::from_be_bytes(stream_id);
|
|
60
|
+
|
|
61
|
+
let _ = file.read(&mut len).unwrap();
|
|
62
|
+
let len = u32::from_be_bytes(len) as usize;
|
|
63
|
+
|
|
64
|
+
let mut data = vec![0; len];
|
|
65
|
+
|
|
66
|
+
let data_len = file.read(&mut data).unwrap();
|
|
67
|
+
|
|
68
|
+
if data_len == 0 {
|
|
69
|
+
break;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
debug!("Got stream={stream_id} len={len}");
|
|
73
|
+
|
|
74
|
+
if stream_id == 0 {
|
|
75
|
+
dec.control(&mut data[..len]).unwrap();
|
|
76
|
+
continue;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
for hdr in dec.decode(&data[..len], u64::MAX).unwrap() {
|
|
80
|
+
let name = std::str::from_utf8(hdr.name()).unwrap();
|
|
81
|
+
let value = std::str::from_utf8(hdr.value()).unwrap();
|
|
82
|
+
println!("{name}\t{value}");
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
println!();
|
|
86
|
+
}
|
|
87
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
// Copyright (C) 2019, Cloudflare, Inc.
|
|
2
|
+
// All rights reserved.
|
|
3
|
+
//
|
|
4
|
+
// Redistribution and use in source and binary forms, with or without
|
|
5
|
+
// modification, are permitted provided that the following conditions are
|
|
6
|
+
// met:
|
|
7
|
+
//
|
|
8
|
+
// * Redistributions of source code must retain the above copyright notice,
|
|
9
|
+
// this list of conditions and the following disclaimer.
|
|
10
|
+
//
|
|
11
|
+
// * Redistributions in binary form must reproduce the above copyright
|
|
12
|
+
// notice, this list of conditions and the following disclaimer in the
|
|
13
|
+
// documentation and/or other materials provided with the distribution.
|
|
14
|
+
//
|
|
15
|
+
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
|
|
16
|
+
// IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
|
17
|
+
// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
18
|
+
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
|
19
|
+
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
|
20
|
+
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
|
21
|
+
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
|
22
|
+
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
|
23
|
+
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
24
|
+
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
25
|
+
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
26
|
+
|
|
27
|
+
#[macro_use]
|
|
28
|
+
extern crate log;
|
|
29
|
+
|
|
30
|
+
use std::fs::File;
|
|
31
|
+
|
|
32
|
+
use std::io::prelude::*;
|
|
33
|
+
use std::io::BufReader;
|
|
34
|
+
|
|
35
|
+
use quiche::h3;
|
|
36
|
+
|
|
37
|
+
fn main() {
|
|
38
|
+
let mut args = std::env::args();
|
|
39
|
+
|
|
40
|
+
let cmd = &args.next().unwrap();
|
|
41
|
+
|
|
42
|
+
if args.len() != 1 {
|
|
43
|
+
println!("Usage: {cmd} FILE");
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
let file = File::open(args.next().unwrap()).unwrap();
|
|
48
|
+
let file = BufReader::new(&file);
|
|
49
|
+
|
|
50
|
+
let mut enc = h3::qpack::Encoder::new();
|
|
51
|
+
|
|
52
|
+
let mut headers: Vec<h3::Header> = Vec::new();
|
|
53
|
+
|
|
54
|
+
let mut stream_id = 1u64;
|
|
55
|
+
|
|
56
|
+
for line in file.lines().map(Result::unwrap) {
|
|
57
|
+
if line.starts_with('#') {
|
|
58
|
+
continue;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
if line.is_empty() {
|
|
62
|
+
let mut out = [0u8; 65535];
|
|
63
|
+
|
|
64
|
+
let len = enc.encode(&headers, &mut out).unwrap();
|
|
65
|
+
|
|
66
|
+
debug!("Writing header block stream={stream_id} len={len}");
|
|
67
|
+
|
|
68
|
+
std::io::stdout()
|
|
69
|
+
.write_all(&stream_id.to_be_bytes())
|
|
70
|
+
.unwrap();
|
|
71
|
+
std::io::stdout()
|
|
72
|
+
.write_all(&(len as u32).to_be_bytes())
|
|
73
|
+
.unwrap();
|
|
74
|
+
std::io::stdout().write_all(&out[..len]).unwrap();
|
|
75
|
+
|
|
76
|
+
stream_id += 1;
|
|
77
|
+
|
|
78
|
+
headers.clear();
|
|
79
|
+
|
|
80
|
+
continue;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
let name = line.split('\t').next().unwrap();
|
|
84
|
+
let value = line.split('\t').next_back().unwrap();
|
|
85
|
+
|
|
86
|
+
headers.push(h3::Header::new(name.as_bytes(), value.as_bytes()));
|
|
87
|
+
}
|
|
88
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
-----BEGIN CERTIFICATE-----
|
|
2
|
+
MIIDazCCAlOgAwIBAgIUAxoIpwJReHnJMSdGsRjjKRMdg/AwDQYJKoZIhvcNAQEL
|
|
3
|
+
BQAwRTELMAkGA1UEBhMCQVUxEzARBgNVBAgMClNvbWUtU3RhdGUxITAfBgNVBAoM
|
|
4
|
+
GEludGVybmV0IFdpZGdpdHMgUHR5IEx0ZDAeFw0yMDAzMjMxNjA3NTRaFw00NzA4
|
|
5
|
+
MDkxNjA3NTRaMEUxCzAJBgNVBAYTAkFVMRMwEQYDVQQIDApTb21lLVN0YXRlMSEw
|
|
6
|
+
HwYDVQQKDBhJbnRlcm5ldCBXaWRnaXRzIFB0eSBMdGQwggEiMA0GCSqGSIb3DQEB
|
|
7
|
+
AQUAA4IBDwAwggEKAoIBAQCzwqx42InprkvjNlkfJNHY/FKJam6VG2D25SBeW0cw
|
|
8
|
+
1Il38xLA9YQYTiSFePfLBt4cLnK3Na+opqg/2A9PG0iY9tpj5w2TmPnvWD+4AN5Y
|
|
9
|
+
+KFwT9mGgbWSJ3vl2r/H5KU7qqBmfXPGYMHhIFU0objRKc40qww/tUCa8j3G4a5l
|
|
10
|
+
zcKc2LpGeeeKtcpExJSkscXKNlMCLTIXcDVuX+i43KCacvKBg+hwNML8Jwg6pE9Y
|
|
11
|
+
kvxJbnl8IfApexHKSrP6Kie9BiB4tVvbjGmQaiGM3zQAbTuaPD+le1ZYGnoxjzn6
|
|
12
|
+
+cWpcPWPNEmM+zVWavIQD5rLxNW4dA4FhczLfGf1Cra7AgMBAAGjUzBRMB0GA1Ud
|
|
13
|
+
DgQWBBRQ+lQtDANNRd9cfskISijXoCSiiDAfBgNVHSMEGDAWgBRQ+lQtDANNRd9c
|
|
14
|
+
fskISijXoCSiiDAPBgNVHRMBAf8EBTADAQH/MA0GCSqGSIb3DQEBCwUAA4IBAQCK
|
|
15
|
+
dfuwKWM8iou5wSNZIND433CiXpa24ZEIesurAJ6Y9QzQlbS/K6Kp/tM4gr/kqzfe
|
|
16
|
+
i8dkUtCPKBCTDQ1nuQ4Wgf9hVnoN/uct7eYKoO7gJtySdP0TqHNDtDoHPMglHN04
|
|
17
|
+
vjf4A1HOECbCjAt9PD46as65Tbjbs2wT6pdcYkHWLHLQ25I13yKK2bSNgXBYTbD0
|
|
18
|
+
xQIF2nw8f+CnHk4Ho2+NFJ2gl8DKfELXevI11F2eoQIcJauLM4gFhAjHWwpRmU5W
|
|
19
|
+
pE3qMq2LzzmDnaBli7vDGJcUnyk1upUS5vM9+RKZYjH8aVydBzXvmnkP+rFYwwIt
|
|
20
|
+
GwgB/MplEB8BXUTaVYB+
|
|
21
|
+
-----END CERTIFICATE-----
|