From 76f9be18a8afc1863f81f90e90ecb05004af4e01 Mon Sep 17 00:00:00 2001 From: Nathan Shaaban <86252985+ctrlaltf24@users.noreply.github.com> Date: Thu, 19 Sep 2024 19:24:47 -0700 Subject: [PATCH 01/15] feat: add features for other tls types Turned out to be rather easy due to all tls being handled by our dependencies. Don't love the _fallback-tls feature, however with it we can use cargo-all-features, which helps reduce feature related bugs. Downside of cargo-all-features is it takes a long time to execute. Fixes: #407, #366 --- .github/workflows/build.yml | 5 +- .github/workflows/test.yml | 13 +- Cargo.lock | 502 ++++++++++++++++-- engineio/Cargo.toml | 42 +- engineio/src/asynchronous/async_socket.rs | 74 ++- .../asynchronous/async_transports/polling.rs | 4 +- .../async_transports/websocket_secure.rs | 9 +- .../src/asynchronous/client/async_client.rs | 4 +- engineio/src/asynchronous/client/builder.rs | 6 +- engineio/src/asynchronous/transport.rs | 1 - engineio/src/client/client.rs | 9 +- engineio/src/lib.rs | 16 + engineio/src/transports/polling.rs | 4 +- engineio/src/transports/websocket_secure.rs | 4 +- socketio/Cargo.toml | 42 +- socketio/src/asynchronous/client/builder.rs | 6 +- socketio/src/client/builder.rs | 6 +- 17 files changed, 645 insertions(+), 102 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 13caad64..7215e796 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -35,8 +35,11 @@ jobs: ~/.cargo/git/db/ key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} + - name: Install cargo-all-features + run: cargo install cargo-all-features + - name: Build - run: cargo build --verbose --all-features + run: cargo build-all-features --verbose - name: Linting run: cargo clippy --verbose --all-features - name: Check formatting diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 9fa22700..c2c0161a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -48,5 +48,14 @@ jobs: ~/.cargo/git/db/ key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} - - name: Run testsuite - run: cargo test --verbose --features "async" + - name: Install cargo-all-features + run: cargo install cargo-all-features + + - name: Run unit tests + run: cargo test-all-features --verbose --lib --examples + + - name: Run doc tests + run: cargo test-all-features --verbose --lib --examples --doc + + - name: Run integration tests + run: cargo test --verbose --features "async" --benches --tests diff --git a/Cargo.lock b/Cargo.lock index f56605df..a39b2d1b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -112,6 +112,33 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" +[[package]] +name = "aws-lc-rs" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f95446d919226d587817a7d21379e6eb099b97b45110a7f272a444ca5c54070" +dependencies = [ + "aws-lc-sys", + "mirai-annotations", + "paste", + "zeroize", +] + +[[package]] +name = "aws-lc-sys" +version = "0.21.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b3ddc4a5b231dd6958b140ff3151b6412b3f4321fab354f399eec8f14b06df62" +dependencies = [ + "bindgen", + "cc", + "cmake", + "dunce", + "fs_extra", + "libc", + "paste", +] + [[package]] name = "backoff" version = "0.4.0" @@ -144,6 +171,29 @@ version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9475866fec1451be56a3c2400fd081ff546538961565ccb5b7142cbd22bc7a51" +[[package]] +name = "bindgen" +version = "0.69.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a00dc851838a2120612785d195287475a3ac45514741da670b735818822129a0" +dependencies = [ + "bitflags 2.6.0", + "cexpr", + "clang-sys", + "itertools", + "lazy_static", + "lazycell", + "log", + "prettyplease", + "proc-macro2", + "quote", + "regex", + "rustc-hash", + "shlex", + "syn 2.0.48", + "which", +] + [[package]] name = "bitflags" version = "1.3.2" @@ -152,9 +202,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.3.3" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "630be753d4e58660abd17930c71b647fe46c27ea6b63cc59e1e3851406972e42" +checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" [[package]] name = "block-buffer" @@ -259,11 +309,22 @@ checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5" [[package]] name = "cc" -version = "1.0.71" +version = "1.1.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79c2681d6594606957bbb8631c4b90a7fcaaa72cdb714743a437b156d6a7eedd" +checksum = "07b1695e2c7e8fc85310cde85aeaab7e3097f593c91d209d3f9df76c928100f0" dependencies = [ "jobserver", + "libc", + "shlex", +] + +[[package]] +name = "cexpr" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766" +dependencies = [ + "nom", ] [[package]] @@ -314,6 +375,17 @@ dependencies = [ "half", ] +[[package]] +name = "clang-sys" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b023947811758c97c59bf9d1c188fd619ad4718dcaa767947df1cadb14f39f4" +dependencies = [ + "glob", + "libc", + "libloading", +] + [[package]] name = "clap" version = "2.34.0" @@ -354,6 +426,15 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2da6da31387c7e4ef160ffab6d5e7f00c42626fe39aea70a7b0f1773f7dd6c1b" +[[package]] +name = "cmake" +version = "0.1.51" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb1e43aa7fd152b1f968787f7dbcdeb306d1867ff373c69955211876c053f91a" +dependencies = [ + "cc", +] + [[package]] name = "codespan-reporting" version = "0.11.1" @@ -615,6 +696,12 @@ dependencies = [ "crypto-common", ] +[[package]] +name = "dunce" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92773504d58c093f6de2459af4af33faa518c13451eb8f2b5698ed3d36e7c813" + [[package]] name = "either" version = "1.6.1" @@ -644,7 +731,7 @@ checksum = "4bcfec3a70f97c962c307b2d2c56e358cf1d00b558d74262b5f929ee8cc7e73a" dependencies = [ "errno-dragonfly", "libc", - "windows-sys", + "windows-sys 0.48.0", ] [[package]] @@ -712,6 +799,12 @@ dependencies = [ "percent-encoding", ] +[[package]] +name = "fs_extra" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42703706b716c37f96a77aea830392ad231f44c9e9a67872fa5548707e11b11c" + [[package]] name = "futures" version = "0.3.17" @@ -813,13 +906,13 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.3" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fcd999463524c52659517fe2cea98493cfe485d10565e7b0fb07dbba7ad2753" +checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" dependencies = [ "cfg-if", "libc", - "wasi 0.10.2+wasi-snapshot-preview1", + "wasi", ] [[package]] @@ -854,6 +947,12 @@ dependencies = [ "url", ] +[[package]] +name = "glob" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" + [[package]] name = "gzip-header" version = "0.3.0" @@ -921,6 +1020,15 @@ version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" +[[package]] +name = "home" +version = "0.5.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3d1354bf6b7235cb4a0576c2619fd4ed18183f689b12b006a0ee7329eeff9a5" +dependencies = [ + "windows-sys 0.52.0", +] + [[package]] name = "http" version = "1.1.0" @@ -997,6 +1105,23 @@ dependencies = [ "want", ] +[[package]] +name = "hyper-rustls" +version = "0.26.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0bea761b46ae2b24eb4aef630d8d1c398157b6fc29e6350ecf090a0b70c952c" +dependencies = [ + "futures-util", + "http", + "hyper", + "hyper-util", + "rustls 0.22.4", + "rustls-pki-types", + "tokio", + "tokio-rustls", + "tower-service", +] + [[package]] name = "hyper-tls" version = "0.6.0" @@ -1105,7 +1230,7 @@ checksum = "eae7b9aee968036d54dce06cebaefd919e4472e753296daccd6d344e3e2df0c2" dependencies = [ "hermit-abi 0.3.1", "libc", - "windows-sys", + "windows-sys 0.48.0", ] [[package]] @@ -1121,8 +1246,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "24fddda5af7e54bf7da53067d6e802dbcc381d0a8eef629df528e3ebf68755cb" dependencies = [ "hermit-abi 0.3.1", - "rustix 0.38.1", - "windows-sys", + "rustix 0.38.25", + "windows-sys 0.48.0", ] [[package]] @@ -1142,9 +1267,9 @@ checksum = "1aab8fc367588b89dcee83ab0fd66b72b50b72fa1904d7095045ace2b0c81c35" [[package]] name = "jobserver" -version = "0.1.25" +version = "0.1.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "068b1ee6743e4d11fb9c6a1e6064b3693a1b600e7f5f5988047d98b3dc9fb90b" +checksum = "48d1dbcbbeb6a7fec7e059840aa538bd62aaccf972c7346c4d9d2059312853d0" dependencies = [ "libc", ] @@ -1164,11 +1289,17 @@ version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" +[[package]] +name = "lazycell" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" + [[package]] name = "libc" -version = "0.2.149" +version = "0.2.158" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a08173bc88b7955d1b3145aa561539096c421ac8debde8cbc3612ec635fee29b" +checksum = "d8adc4bb1803a324070e64a98ae98f38934d91957a99cfb3a43dcbc01bc56439" [[package]] name = "libgit2-sys" @@ -1184,6 +1315,16 @@ dependencies = [ "pkg-config", ] +[[package]] +name = "libloading" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4979f22fdb869068da03c9f7528f8297c6fd2606bc3a4affe42e6a823fdb8da4" +dependencies = [ + "cfg-if", + "windows-targets 0.52.6", +] + [[package]] name = "libssh2-sys" version = "0.2.23" @@ -1227,9 +1368,9 @@ checksum = "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519" [[package]] name = "linux-raw-sys" -version = "0.4.3" +version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09fc20d2ca12cb9f044c93e3bd6d32d523e6e2ec3db4f7b2939cd99026ecd3f0" +checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" [[package]] name = "lock_api" @@ -1292,6 +1433,12 @@ version = "0.3.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2a60c7ce501c71e03a9c9c0d35b861413ae925bd979cc7a4e30d060069aaac8d" +[[package]] +name = "minimal-lexical" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" + [[package]] name = "miniz_oxide" version = "0.6.2" @@ -1317,10 +1464,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a4a650543ca06a924e8b371db273b2756685faae30f8487da1b56505a8f78b0c" dependencies = [ "libc", - "wasi 0.11.0+wasi-snapshot-preview1", - "windows-sys", + "wasi", + "windows-sys 0.48.0", ] +[[package]] +name = "mirai-annotations" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9be0862c1b3f26a88803c4a49de6889c10e608b3ee9344e6ef5b45fb37ad3d1" + [[package]] name = "native-tls" version = "0.2.12" @@ -1351,6 +1504,16 @@ dependencies = [ "memoffset", ] +[[package]] +name = "nom" +version = "7.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" +dependencies = [ + "memchr", + "minimal-lexical", +] + [[package]] name = "num-integer" version = "0.1.45" @@ -1416,7 +1579,7 @@ version = "0.10.66" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9529f4786b70a3e8c61e11179af17ab6188ad8d0ded78c5529441ed39d4bd9c1" dependencies = [ - "bitflags 2.3.3", + "bitflags 2.6.0", "cfg-if", "foreign-types", "libc", @@ -1442,6 +1605,15 @@ version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "28988d872ab76095a6e6ac88d99b54fd267702734fd7ffe610ca27f533ddb95a" +[[package]] +name = "openssl-src" +version = "300.3.2+3.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a211a18d945ef7e648cc6e0058f4c548ee46aab922ea203e0d30e966ea23647b" +dependencies = [ + "cc", +] + [[package]] name = "openssl-sys" version = "0.9.103" @@ -1450,6 +1622,7 @@ checksum = "7f9e8deee91df40a943c71b917e5874b951d32a802526c85721ce3b776c929d6" dependencies = [ "cc", "libc", + "openssl-src", "pkg-config", "vcpkg", ] @@ -1474,9 +1647,15 @@ dependencies = [ "libc", "redox_syscall 0.4.1", "smallvec", - "windows-targets", + "windows-targets 0.48.0", ] +[[package]] +name = "paste" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" + [[package]] name = "percent-encoding" version = "2.3.1" @@ -1555,6 +1734,16 @@ version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c3ca011bd0129ff4ae15cd04c4eef202cadf6c51c21e47aba319b4e0501db741" +[[package]] +name = "prettyplease" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d3928fb5db768cb86f891ff014f0144589297e3c6a1aba6ed7cecfdace270c7" +dependencies = [ + "proc-macro2", + "syn 2.0.48", +] + [[package]] name = "proc-macro2" version = "1.0.78" @@ -1713,6 +1902,7 @@ dependencies = [ "http-body", "http-body-util", "hyper", + "hyper-rustls", "hyper-tls", "hyper-util", "ipnet", @@ -1723,7 +1913,9 @@ dependencies = [ "once_cell", "percent-encoding", "pin-project-lite", + "rustls 0.22.4", "rustls-pemfile", + "rustls-pki-types", "serde", "serde_json", "serde_urlencoded", @@ -1731,6 +1923,7 @@ dependencies = [ "system-configuration", "tokio", "tokio-native-tls", + "tokio-rustls", "tokio-util", "tower-service", "url", @@ -1738,9 +1931,25 @@ dependencies = [ "wasm-bindgen-futures", "wasm-streams", "web-sys", + "webpki-roots", "winreg", ] +[[package]] +name = "ring" +version = "0.17.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c17fa4cb658e3583423e915b9f3acc01cceaee1860e33d59ebae66adc3a2dc0d" +dependencies = [ + "cc", + "cfg-if", + "getrandom", + "libc", + "spin", + "untrusted", + "windows-sys 0.52.0", +] + [[package]] name = "rust_engineio" version = "0.6.0" @@ -1756,6 +1965,7 @@ dependencies = [ "lazy_static", "native-tls", "reqwest", + "rustls 0.22.4", "serde", "serde_json", "thiserror", @@ -1776,10 +1986,12 @@ dependencies = [ "bytes", "cargo-tarpaulin", "futures-util", + "getrandom", "log", "native-tls", "rand", "rust_engineio", + "rustls 0.23.13", "serde", "serde_json", "serial_test", @@ -1794,6 +2006,12 @@ version = "0.1.21" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ef03e0a2b150c7a90d01faf6254c9c48a41e95fb2a8c2ac1c6f0d2b9aefc342" +[[package]] +name = "rustc-hash" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" + [[package]] name = "rustc_version" version = "0.4.0" @@ -1814,20 +2032,62 @@ dependencies = [ "io-lifetimes", "libc", "linux-raw-sys 0.3.8", - "windows-sys", + "windows-sys 0.48.0", ] [[package]] name = "rustix" -version = "0.38.1" +version = "0.38.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbc6396159432b5c8490d4e301d8c705f61860b8b6c863bf79942ce5401968f3" +checksum = "dc99bc2d4f1fed22595588a013687477aedf3cdcfb26558c559edb67b4d9b22e" dependencies = [ - "bitflags 2.3.3", + "bitflags 2.6.0", "errno", "libc", - "linux-raw-sys 0.4.3", - "windows-sys", + "linux-raw-sys 0.4.14", + "windows-sys 0.48.0", +] + +[[package]] +name = "rustls" +version = "0.22.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf4ef73721ac7bcd79b2b315da7779d8fc09718c6b3d2d1b2d94850eb8c18432" +dependencies = [ + "log", + "ring", + "rustls-pki-types", + "rustls-webpki", + "subtle", + "zeroize", +] + +[[package]] +name = "rustls" +version = "0.23.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2dabaac7466917e566adb06783a81ca48944c6898a1b08b9374106dd671f4c8" +dependencies = [ + "aws-lc-rs", + "log", + "once_cell", + "rustls-pki-types", + "rustls-webpki", + "subtle", + "zeroize", +] + +[[package]] +name = "rustls-native-certs" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5bfb394eeed242e909609f56089eecfe5fda225042e8b171791b9c95f5931e5" +dependencies = [ + "openssl-probe", + "rustls-pemfile", + "rustls-pki-types", + "schannel", + "security-framework", ] [[package]] @@ -1842,9 +2102,21 @@ dependencies = [ [[package]] name = "rustls-pki-types" -version = "1.4.1" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc0a2ce646f8655401bb81e7927b812614bd5d91dbc968696be50603510fcaf0" + +[[package]] +name = "rustls-webpki" +version = "0.102.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ecd36cc4259e3e4514335c4a138c6b43171a8d61d8f5c9348f9fc7529416f247" +checksum = "64ca1bc8749bd4cf37b5ce386cc146580777b4e8572c7b97baf22c83f444bee9" +dependencies = [ + "aws-lc-rs", + "ring", + "rustls-pki-types", + "untrusted", +] [[package]] name = "ryu" @@ -2004,6 +2276,12 @@ dependencies = [ "lazy_static", ] +[[package]] +name = "shlex" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" + [[package]] name = "slab" version = "0.4.5" @@ -2033,9 +2311,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7b5fac59a5cb5dd637972e5fca70daf0523c9067fcdc4842f053dae04a18f8e9" dependencies = [ "libc", - "windows-sys", + "windows-sys 0.48.0", ] +[[package]] +name = "spin" +version = "0.9.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" + [[package]] name = "stable_deref_trait" version = "1.2.0" @@ -2048,6 +2332,12 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" +[[package]] +name = "subtle" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" + [[package]] name = "syn" version = "1.0.107" @@ -2108,7 +2398,7 @@ dependencies = [ "fastrand", "redox_syscall 0.3.5", "rustix 0.37.25", - "windows-sys", + "windows-sys 0.48.0", ] [[package]] @@ -2207,7 +2497,7 @@ dependencies = [ "pin-project-lite", "socket2 0.5.5", "tokio-macros", - "windows-sys", + "windows-sys 0.48.0", ] [[package]] @@ -2231,6 +2521,17 @@ dependencies = [ "tokio", ] +[[package]] +name = "tokio-rustls" +version = "0.25.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "775e0c0f0adb3a2f22a00c4745d728b479985fc15ee7ca6a2608388c5569860f" +dependencies = [ + "rustls 0.22.4", + "rustls-pki-types", + "tokio", +] + [[package]] name = "tokio-tungstenite" version = "0.21.0" @@ -2240,9 +2541,14 @@ dependencies = [ "futures-util", "log", "native-tls", + "rustls 0.22.4", + "rustls-native-certs", + "rustls-pki-types", "tokio", "tokio-native-tls", + "tokio-rustls", "tungstenite", + "webpki-roots", ] [[package]] @@ -2367,6 +2673,8 @@ dependencies = [ "log", "native-tls", "rand", + "rustls 0.22.4", + "rustls-pki-types", "sha1", "thiserror", "url", @@ -2406,6 +2714,12 @@ version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b" +[[package]] +name = "untrusted" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" + [[package]] name = "url" version = "2.5.2" @@ -2468,12 +2782,6 @@ dependencies = [ "try-lock", ] -[[package]] -name = "wasi" -version = "0.10.2+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6" - [[package]] name = "wasi" version = "0.11.0+wasi-snapshot-preview1" @@ -2569,6 +2877,27 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "webpki-roots" +version = "0.26.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "841c67bff177718f1d4dfefde8d8f0e78f9b6589319ba88312f567fc5841a958" +dependencies = [ + "rustls-pki-types", +] + +[[package]] +name = "which" +version = "4.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87ba24419a2078cd2b0f2ede2691b6c66d8e47836da3b6db8265ebad47afbfc7" +dependencies = [ + "either", + "home", + "once_cell", + "rustix 0.38.25", +] + [[package]] name = "winapi" version = "0.3.9" @@ -2606,7 +2935,16 @@ version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" dependencies = [ - "windows-targets", + "windows-targets 0.48.0", +] + +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets 0.52.6", ] [[package]] @@ -2615,13 +2953,29 @@ version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7b1eb6f0cd7c80c79759c929114ef071b87354ce476d9d94271031c0497adfd5" dependencies = [ - "windows_aarch64_gnullvm", - "windows_aarch64_msvc", - "windows_i686_gnu", - "windows_i686_msvc", - "windows_x86_64_gnu", - "windows_x86_64_gnullvm", - "windows_x86_64_msvc", + "windows_aarch64_gnullvm 0.48.0", + "windows_aarch64_msvc 0.48.0", + "windows_i686_gnu 0.48.0", + "windows_i686_msvc 0.48.0", + "windows_x86_64_gnu 0.48.0", + "windows_x86_64_gnullvm 0.48.0", + "windows_x86_64_msvc 0.48.0", +] + +[[package]] +name = "windows-targets" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" +dependencies = [ + "windows_aarch64_gnullvm 0.52.6", + "windows_aarch64_msvc 0.52.6", + "windows_i686_gnu 0.52.6", + "windows_i686_gnullvm", + "windows_i686_msvc 0.52.6", + "windows_x86_64_gnu 0.52.6", + "windows_x86_64_gnullvm 0.52.6", + "windows_x86_64_msvc 0.52.6", ] [[package]] @@ -2630,42 +2984,90 @@ version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc" +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" + [[package]] name = "windows_aarch64_msvc" version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3" +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" + [[package]] name = "windows_i686_gnu" version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241" +[[package]] +name = "windows_i686_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" + [[package]] name = "windows_i686_msvc" version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00" +[[package]] +name = "windows_i686_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" + [[package]] name = "windows_x86_64_gnu" version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1" +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" + [[package]] name = "windows_x86_64_gnullvm" version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953" +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" + [[package]] name = "windows_x86_64_msvc" version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a" +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" + [[package]] name = "winreg" version = "0.52.0" @@ -2673,5 +3075,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a277a57398d4bfa075df44f501a17cfdf8542d224f0d36095a2adc7aee4ef0a5" dependencies = [ "cfg-if", - "windows-sys", + "windows-sys 0.48.0", ] + +[[package]] +name = "zeroize" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" diff --git a/engineio/Cargo.toml b/engineio/Cargo.toml index 74e8ccab..b091a5de 100644 --- a/engineio/Cargo.toml +++ b/engineio/Cargo.toml @@ -16,19 +16,20 @@ all-features = true [dependencies] base64 = "0.22.0" bytes = "1" -reqwest = { version = "0.12.4", features = ["blocking", "native-tls", "stream"] } +reqwest = { version = "0.12.4", features = ["blocking", "stream"] } adler32 = "1.2.0" serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" http = "1.1.0" -tokio-tungstenite = { version = "0.21.0", features = ["native-tls"] } +tokio-tungstenite = { version = "0.21.0", features = [] } tungstenite = "0.21.0" tokio = "1.37.0" futures-util = { version = "0.3", default-features = false, features = ["sink"] } async-trait = "0.1.81" async-stream = "0.3.5" thiserror = "1.0" -native-tls = "0.2.12" +native-tls = { version = "^0.2", optional = true } +rustls = { version = "^0.22", optional = true } url = "2.5.2" [dev-dependencies] @@ -51,6 +52,39 @@ harness = false bench = false [features] -default = ["async"] +default = ["async", "native-tls"] async-callbacks = [] async = ["async-callbacks"] +native-tls = ["tokio-tungstenite/native-tls", "_native-tls"] +native-tls-vendored = ["tokio-tungstenite/native-tls-vendored", "_native-tls"] +rustls-tls-native-roots = ["tokio-tungstenite/rustls-tls-native-roots", "_rustls-tls"] +rustls-tls-webpki-roots = ["tokio-tungstenite/rustls-tls-webpki-roots", "_rustls-tls"] +# These features are for internal use only +_native-tls = ["dep:native-tls", "reqwest/native-tls"] +_rustls-tls = ["dep:rustls", "reqwest/rustls-tls"] + +# This is an internal feature to allow us to build using cargo-all-features and guaranteing that we always have one TLS implementation +# Do not use this feature directly +_fallback-tls = ["native-tls"] + +[lints.rust] +unexpected_cfgs = { level = "warn", check-cfg = ['cfg(tarpaulin)'] } + +[package.metadata.cargo-all-features] +skip_optional_dependencies = true +skip_feature_sets = [ + # Don't allow both at once + ["_native-tls", "_rustls-tls"], + # No need to compile with both native-tls options + ["native-tls", "native-tls-vendored"], + # No need to compile with both rustls options + ["rustls-tls-native-roots", "rustls-tls-webpki-roots"], + # Don't compile with both native-tls and rustls + ["native-tls", "rustls-tls-native-roots"], + ["native-tls", "rustls-tls-webpki-roots"], + ["native-tls-vendored", "rustls-tls-native-roots"], + ["native-tls-vendored", "rustls-tls-webpki-roots"], +] +always_include_features = ["_fallback-tls"] +# Don't use the internal features in the build matrix +denylist = ["_native-tls", "_rustls-tls"] diff --git a/engineio/src/asynchronous/async_socket.rs b/engineio/src/asynchronous/async_socket.rs index 8718e0ea..72612e39 100644 --- a/engineio/src/asynchronous/async_socket.rs +++ b/engineio/src/asynchronous/async_socket.rs @@ -13,48 +13,56 @@ use futures_util::{stream, Stream, StreamExt}; use tokio::{runtime::Handle, sync::Mutex, time::Instant}; use crate::{ - asynchronous::{callback::OptionalCallback, transport::AsyncTransportType}, + asynchronous::transport::AsyncTransportType, error::Result, packet::{HandshakePacket, Payload}, Error, Packet, PacketId, }; +#[cfg(feature = "async-callbacks")] +use super::callback::OptionalCallback; #[derive(Clone)] pub struct Socket { handle: Handle, transport: Arc>, transport_raw: AsyncTransportType, - on_close: OptionalCallback<()>, - on_data: OptionalCallback, - on_error: OptionalCallback, - on_open: OptionalCallback<()>, - on_packet: OptionalCallback, connected: Arc, last_ping: Arc>, last_pong: Arc>, connection_data: Arc, max_ping_timeout: u64, + // Bellow are the fields that are only used when the async-callbacks feature is enabled. + #[cfg(feature = "async-callbacks")] + on_close: OptionalCallback<()>, + #[cfg(feature = "async-callbacks")] + on_data: OptionalCallback, + #[cfg(feature = "async-callbacks")] + on_error: OptionalCallback, + #[cfg(feature = "async-callbacks")] + on_open: OptionalCallback<()>, + #[cfg(feature = "async-callbacks")] + on_packet: OptionalCallback, } impl Socket { pub(crate) fn new( transport: AsyncTransportType, handshake: HandshakePacket, + #[cfg(feature = "async-callbacks")] on_close: OptionalCallback<()>, + #[cfg(feature = "async-callbacks")] on_data: OptionalCallback, + #[cfg(feature = "async-callbacks")] on_error: OptionalCallback, + #[cfg(feature = "async-callbacks")] on_open: OptionalCallback<()>, + #[cfg(feature = "async-callbacks")] on_packet: OptionalCallback, ) -> Self { let max_ping_timeout = handshake.ping_interval + handshake.ping_timeout; Socket { handle: Handle::current(), - on_close, - on_data, - on_error, - on_open, - on_packet, transport: Arc::new(Mutex::new(transport.clone())), transport_raw: transport, connected: Arc::new(AtomicBool::default()), @@ -62,6 +70,16 @@ impl Socket { last_pong: Arc::new(Mutex::new(Instant::now())), connection_data: Arc::new(handshake), max_ping_timeout, + #[cfg(feature = "async-callbacks")] + on_close, + #[cfg(feature = "async-callbacks")] + on_data, + #[cfg(feature = "async-callbacks")] + on_error, + #[cfg(feature = "async-callbacks")] + on_open, + #[cfg(feature = "async-callbacks")] + on_packet, } } @@ -71,6 +89,7 @@ impl Socket { // SAFETY: Has valid handshake due to type self.connected.store(true, Ordering::Release); + #[cfg(feature = "async-callbacks")] if let Some(on_open) = self.on_open.as_ref() { let on_open = on_open.clone(); self.handle.spawn(async move { on_open(()).await }); @@ -85,18 +104,22 @@ impl Socket { Ok(()) } - /// A helper method that distributes + /// A helper method that distributes the incoming packets to the appropriate callbacks. pub(super) async fn handle_incoming_packet(&self, packet: Packet) -> Result<()> { // check for the appropriate action or callback + #[cfg(feature = "async-callbacks")] self.handle_packet(packet.clone()); match packet.packet_id { PacketId::MessageBinary => { + #[cfg(feature = "async-callbacks")] self.handle_data(packet.data.clone()); } PacketId::Message => { + #[cfg(feature = "async-callbacks")] self.handle_data(packet.data.clone()); } PacketId::Close => { + #[cfg(feature = "async-callbacks")] self.handle_close(); } PacketId::Upgrade => { @@ -144,6 +167,7 @@ impl Socket { } pub async fn disconnect(&self) -> Result<()> { + #[cfg(feature = "async-callbacks")] if let Some(on_close) = self.on_close.as_ref() { let on_close = on_close.clone(); self.handle.spawn(async move { on_close(()).await }); @@ -188,6 +212,7 @@ impl Socket { /// Calls the error callback with a given message. #[inline] + #[cfg(feature = "async-callbacks")] fn call_error_callback(&self, text: String) { if let Some(on_error) = self.on_error.as_ref() { let on_error = on_error.clone(); @@ -195,6 +220,9 @@ impl Socket { } } + #[cfg(not(feature = "async-callbacks"))] + fn call_error_callback(&self, _text: String) {} + // Check if the underlying transport client is connected. pub(crate) fn is_connected(&self) -> bool { self.connected.load(Ordering::Acquire) @@ -221,6 +249,7 @@ impl Socket { } } + #[cfg(feature = "async-callbacks")] pub(crate) fn handle_packet(&self, packet: Packet) { if let Some(on_packet) = self.on_packet.as_ref() { let on_packet = on_packet.clone(); @@ -228,6 +257,7 @@ impl Socket { } } + #[cfg(feature = "async-callbacks")] pub(crate) fn handle_data(&self, data: Bytes) { if let Some(on_data) = self.on_data.as_ref() { let on_data = on_data.clone(); @@ -235,6 +265,7 @@ impl Socket { } } + #[cfg(feature = "async-callbacks")] pub(crate) fn handle_close(&self) { if let Some(on_close) = self.on_close.as_ref() { let on_close = on_close.clone(); @@ -278,17 +309,22 @@ impl Socket { #[cfg_attr(tarpaulin, ignore)] impl Debug for Socket { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - f.debug_struct("Socket") + let mut debug = f.debug_struct("Socket"); + let debug = debug .field("transport", &self.transport) + .field("connected", &self.connected) + .field("last_ping", &self.last_ping) + .field("last_pong", &self.last_pong) + .field("connection_data", &self.connection_data); + + #[cfg(feature = "async-callbacks")] + debug .field("on_close", &self.on_close) .field("on_data", &self.on_data) .field("on_error", &self.on_error) .field("on_open", &self.on_open) - .field("on_packet", &self.on_packet) - .field("connected", &self.connected) - .field("last_ping", &self.last_ping) - .field("last_pong", &self.last_pong) - .field("connection_data", &self.connection_data) - .finish() + .field("on_packet", &self.on_packet); + + debug.finish() } } diff --git a/engineio/src/asynchronous/async_transports/polling.rs b/engineio/src/asynchronous/async_transports/polling.rs index d88f1e89..96508122 100644 --- a/engineio/src/asynchronous/async_transports/polling.rs +++ b/engineio/src/asynchronous/async_transports/polling.rs @@ -5,7 +5,6 @@ use base64::{engine::general_purpose, Engine as _}; use bytes::{BufMut, Bytes, BytesMut}; use futures_util::{Stream, StreamExt}; use http::HeaderMap; -use native_tls::TlsConnector; use reqwest::{Client, ClientBuilder, Response}; use std::fmt::Debug; use std::time::SystemTime; @@ -15,6 +14,7 @@ use url::Url; use crate::asynchronous::generator::StreamGenerator; use crate::{asynchronous::transport::AsyncTransport, error::Result, Error}; +use crate::TlsConfig; /// An asynchronous polling type. Makes use of the nonblocking reqwest types and /// methods. @@ -28,7 +28,7 @@ pub struct PollingTransport { impl PollingTransport { pub fn new( base_url: Url, - tls_config: Option, + tls_config: Option, opening_headers: Option, ) -> Self { let client = match (tls_config, opening_headers) { diff --git a/engineio/src/asynchronous/async_transports/websocket_secure.rs b/engineio/src/asynchronous/async_transports/websocket_secure.rs index cfd707a0..da13ca68 100644 --- a/engineio/src/asynchronous/async_transports/websocket_secure.rs +++ b/engineio/src/asynchronous/async_transports/websocket_secure.rs @@ -9,7 +9,6 @@ use bytes::Bytes; use futures_util::Stream; use futures_util::StreamExt; use http::HeaderMap; -use native_tls::TlsConnector; use tokio::sync::RwLock; use tokio_tungstenite::connect_async_tls_with_config; use tokio_tungstenite::Connector; @@ -17,6 +16,7 @@ use tungstenite::client::IntoClientRequest; use url::Url; use super::websocket_general::AsyncWebsocketGeneralTransport; +use crate::TlsConfig; /// An asynchronous websocket transport type. /// This type only allows for secure websocket @@ -32,7 +32,7 @@ impl WebsocketSecureTransport { /// Tls connector and an URL. pub(crate) async fn new( base_url: Url, - tls_config: Option, + tls_config: Option, headers: Option, ) -> Result { let mut url = base_url; @@ -56,7 +56,12 @@ impl WebsocketSecureTransport { req, None, /*disable_nagle=*/ false, + #[cfg(all(feature = "_native-tls", not(feature = "_rustls-tls")))] tls_config.map(Connector::NativeTls), + #[cfg(feature = "_rustls-tls")] + tls_config.map(Arc::new).map(Connector::Rustls), + #[cfg(not(any(feature = "_native-tls", feature = "_rustls-tls")))] + None, ) .await?; diff --git a/engineio/src/asynchronous/client/async_client.rs b/engineio/src/asynchronous/client/async_client.rs index 99b0d0dd..8f1b5faa 100644 --- a/engineio/src/asynchronous/client/async_client.rs +++ b/engineio/src/asynchronous/client/async_client.rs @@ -95,7 +95,7 @@ mod test { use crate::{asynchronous::ClientBuilder, header::HeaderMap, packet::PacketId, Error}; use bytes::Bytes; use futures_util::StreamExt; - use native_tls::TlsConnector; + use crate::TlsConfig; use url::Url; /// The purpose of this test is to check whether the Client is properly cloneable or not. @@ -384,7 +384,7 @@ mod test { let _ = builder(url.clone()) .tls_config( - TlsConnector::builder() + TlsConfig::builder() .danger_accept_invalid_certs(true) .build() .unwrap(), diff --git a/engineio/src/asynchronous/client/builder.rs b/engineio/src/asynchronous/client/builder.rs index 50dc9be2..b9bea417 100644 --- a/engineio/src/asynchronous/client/builder.rs +++ b/engineio/src/asynchronous/client/builder.rs @@ -9,10 +9,10 @@ use crate::{ header::HeaderMap, packet::HandshakePacket, Error, Packet, ENGINE_IO_VERSION, + TlsConfig, }; use bytes::Bytes; use futures_util::{future::BoxFuture, StreamExt}; -use native_tls::TlsConnector; use url::Url; use super::Client; @@ -20,7 +20,7 @@ use super::Client; #[derive(Clone, Debug)] pub struct ClientBuilder { url: Url, - tls_config: Option, + tls_config: Option, headers: Option, handshake: Option, on_error: OptionalCallback, @@ -54,7 +54,7 @@ impl ClientBuilder { } /// Specify transport's tls config - pub fn tls_config(mut self, tls_config: TlsConnector) -> Self { + pub fn tls_config(mut self, tls_config: TlsConfig) -> Self { self.tls_config = Some(tls_config); self } diff --git a/engineio/src/asynchronous/transport.rs b/engineio/src/asynchronous/transport.rs index 7d33376f..ca520c8a 100644 --- a/engineio/src/asynchronous/transport.rs +++ b/engineio/src/asynchronous/transport.rs @@ -59,7 +59,6 @@ impl From for AsyncTransportType { } } -#[cfg(feature = "async")] impl AsyncTransportType { pub fn as_transport(&self) -> &(dyn AsyncTransport + Send) { match self { diff --git a/engineio/src/client/client.rs b/engineio/src/client/client.rs index dc22ff77..d04f4dc4 100644 --- a/engineio/src/client/client.rs +++ b/engineio/src/client/client.rs @@ -7,9 +7,8 @@ use crate::error::{Error, Result}; use crate::header::HeaderMap; use crate::packet::{HandshakePacket, Packet, PacketId}; use crate::transports::{PollingTransport, WebsocketSecureTransport, WebsocketTransport}; -use crate::ENGINE_IO_VERSION; +use crate::{ENGINE_IO_VERSION, TlsConfig}; use bytes::Bytes; -use native_tls::TlsConnector; use std::convert::TryFrom; use std::convert::TryInto; use std::fmt::Debug; @@ -30,7 +29,7 @@ pub struct Client { #[derive(Clone, Debug)] pub struct ClientBuilder { url: Url, - tls_config: Option, + tls_config: Option, headers: Option, handshake: Option, on_error: OptionalCallback, @@ -64,7 +63,7 @@ impl ClientBuilder { } /// Specify transport's tls config - pub fn tls_config(mut self, tls_config: TlsConnector) -> Self { + pub fn tls_config(mut self, tls_config: TlsConfig) -> Self { self.tls_config = Some(tls_config); self } @@ -650,7 +649,7 @@ mod test { let _ = builder(url.clone()) .tls_config( - TlsConnector::builder() + TlsConfig::builder() .danger_accept_invalid_certs(true) .build() .unwrap(), diff --git a/engineio/src/lib.rs b/engineio/src/lib.rs index 2ac5787d..467bb12e 100644 --- a/engineio/src/lib.rs +++ b/engineio/src/lib.rs @@ -99,6 +99,22 @@ pub use client::{Client, ClientBuilder}; pub use error::Error; pub use packet::{Packet, PacketId}; +// Re-export TLS configurations to make sockio integration easier +#[cfg(all(feature = "_native-tls", not(feature = "_rustls-tls")))] +#[doc(hidden)] +pub use native_tls::TlsConnector as TlsConfig; +#[doc(hidden)] +#[cfg(feature = "_rustls-tls")] +pub use rustls::ClientConfig as TlsConfig; + +// Both native-tls and rustls is not supported at the same time +#[cfg(not(feature = "_fallback-tls"))] +#[cfg(all(feature = "_native-tls", feature = "_rustls-tls"))] +compile_error!("Both native-tls and rustls features are enabled. Please enable only one of them."); + +#[cfg(not(any(feature = "_native-tls", feature = "_rustls-tls")))] +compile_error!("No TLS feature is enabled. Please enable either native-tls or rustls."); + #[cfg(test)] pub(crate) mod test { use super::*; diff --git a/engineio/src/transports/polling.rs b/engineio/src/transports/polling.rs index 26aee87b..c2c2ffd8 100644 --- a/engineio/src/transports/polling.rs +++ b/engineio/src/transports/polling.rs @@ -1,8 +1,8 @@ use crate::error::{Error, Result}; use crate::transport::Transport; +use crate::TlsConfig; use base64::{engine::general_purpose, Engine as _}; use bytes::{BufMut, Bytes, BytesMut}; -use native_tls::TlsConnector; use reqwest::{ blocking::{Client, ClientBuilder}, header::HeaderMap, @@ -21,7 +21,7 @@ impl PollingTransport { /// Creates an instance of `PollingTransport`. pub fn new( base_url: Url, - tls_config: Option, + tls_config: Option, opening_headers: Option, ) -> Self { let client = match (tls_config, opening_headers) { diff --git a/engineio/src/transports/websocket_secure.rs b/engineio/src/transports/websocket_secure.rs index 345e0880..04fff99f 100644 --- a/engineio/src/transports/websocket_secure.rs +++ b/engineio/src/transports/websocket_secure.rs @@ -6,10 +6,10 @@ use crate::{ error::Result, transport::Transport, Error, + TlsConfig, }; use bytes::Bytes; use http::HeaderMap; -use native_tls::TlsConnector; use std::{sync::Arc, time::Duration}; use tokio::runtime::Runtime; use url::Url; @@ -24,7 +24,7 @@ impl WebsocketSecureTransport { /// Creates an instance of `WebsocketSecureTransport`. pub fn new( base_url: Url, - tls_config: Option, + tls_config: Option, headers: Option, ) -> Result { let runtime = tokio::runtime::Builder::new_current_thread() diff --git a/socketio/Cargo.toml b/socketio/Cargo.toml index aa8c27af..14b21913 100644 --- a/socketio/Cargo.toml +++ b/socketio/Cargo.toml @@ -14,7 +14,7 @@ license = "MIT" all-features = true [dependencies] -rust_engineio = { version = "0.6.0", path = "../engineio" } +rust_engineio = { version = "0.6.0", path = "../engineio", default-features = false} base64 = "0.22.0" bytes = "1" backoff = "0.4" @@ -22,13 +22,15 @@ rand = "0.8.5" adler32 = "1.2.0" serde_json = "1.0" thiserror = "1.0" -native-tls = "0.2.12" url = "2.5.2" tokio = { version = "1.37.0", optional = true } futures-util = { version = "0.3", default-features = false, features = ["sink"], optional = true } async-stream = { version = "0.3.5", optional = true } log = "0.4.22" serde = "1.0.209" +native-tls = { version = "0.2", optional = true } +rustls = { version = "0.23", optional = true } +getrandom = "0.2.10" [dev-dependencies] cargo-tarpaulin = "0.18.5" @@ -40,11 +42,43 @@ version = "1.37.0" features = ["macros", "rt-multi-thread"] [features] -default = [] +default = ["native-tls"] async-callbacks = ["rust_engineio/async-callbacks"] async = ["async-callbacks", "rust_engineio/async", "tokio", "futures-util", "async-stream"] +native-tls = ["rust_engineio/native-tls", "_native-tls"] +native-tls-vendored = ["rust_engineio/native-tls-vendored", "_native-tls"] +rustls-tls-native-roots = ["rust_engineio/rustls-tls-native-roots", "_rustls-tls"] +rustls-tls-webpki-roots = ["rust_engineio/rustls-tls-webpki-roots", "_rustls-tls"] +_native-tls = ["dep:native-tls"] +_rustls-tls = ["dep:rustls"] + +# This is an internal feature to allow us to build using cargo-all-features and guaranteing that we always have one TLS implementation +# Do not use this feature directly +_fallback-tls = ["native-tls", "rust_engineio/_fallback-tls"] [[example]] name = "async" path = "examples/async.rs" -required-features = ["async"] +required-features = ["async", "native-tls"] + +[lints.rust] +unexpected_cfgs = { level = "warn", check-cfg = ['cfg(tarpaulin)'] } + +[package.metadata.cargo-all-features] +skip_optional_dependencies = true +skip_feature_sets = [ + # Don't allow both at once + ["_native-tls", "_rustls-tls"], + # No need to compile with both native-tls options + ["native-tls", "native-tls-vendored"], + # No need to compile with both rustls options + ["rustls-tls-native-roots", "rustls-tls-webpki-roots"], + # Don't compile with both native-tls and rustls + ["native-tls", "rustls-tls-native-roots"], + ["native-tls", "rustls-tls-webpki-roots"], + ["native-tls-vendored", "rustls-tls-native-roots"], + ["native-tls-vendored", "rustls-tls-webpki-roots"], +] +always_include_features = ["_fallback-tls"] +# Don't use the internal features in the build matrix +denylist = ["_native-tls", "_rustls-tls"] diff --git a/socketio/src/asynchronous/client/builder.rs b/socketio/src/asynchronous/client/builder.rs index 44710e19..293bebe3 100644 --- a/socketio/src/asynchronous/client/builder.rs +++ b/socketio/src/asynchronous/client/builder.rs @@ -1,9 +1,9 @@ use futures_util::future::BoxFuture; use log::trace; -use native_tls::TlsConnector; use rust_engineio::{ asynchronous::ClientBuilder as EngineIoClientBuilder, header::{HeaderMap, HeaderValue}, + TlsConfig, }; use std::collections::HashMap; use url::Url; @@ -28,7 +28,7 @@ pub struct ClientBuilder { pub(crate) on_any: Option>, pub(crate) on_reconnect: Option>, pub(crate) namespace: String, - tls_config: Option, + tls_config: Option, opening_headers: Option, transport_type: TransportType, pub(crate) auth: Option, @@ -285,7 +285,7 @@ impl ClientBuilder { /// .await; /// } /// ``` - pub fn tls_config(mut self, tls_config: TlsConnector) -> Self { + pub fn tls_config(mut self, tls_config: TlsConfig) -> Self { self.tls_config = Some(tls_config); self } diff --git a/socketio/src/client/builder.rs b/socketio/src/client/builder.rs index 724971f0..6112f2a1 100644 --- a/socketio/src/client/builder.rs +++ b/socketio/src/client/builder.rs @@ -2,9 +2,9 @@ use super::super::{event::Event, payload::Payload}; use super::callback::Callback; use super::client::Client; use crate::RawClient; -use native_tls::TlsConnector; use rust_engineio::client::ClientBuilder as EngineIoClientBuilder; use rust_engineio::header::{HeaderMap, HeaderValue}; +use rust_engineio::TlsConfig; use url::Url; use crate::client::callback::{SocketAnyCallback, SocketCallback}; @@ -37,7 +37,7 @@ pub struct ClientBuilder { on: Arc>>>, on_any: Arc>>>, namespace: String, - tls_config: Option, + tls_config: Option, opening_headers: Option, transport_type: TransportType, auth: Option, @@ -227,7 +227,7 @@ impl ClientBuilder { /// .connect(); /// /// ``` - pub fn tls_config(mut self, tls_config: TlsConnector) -> Self { + pub fn tls_config(mut self, tls_config: TlsConfig) -> Self { self.tls_config = Some(tls_config); self } From 1802e35b569a43fef57cfcf18acfe6a4d2c16bed Mon Sep 17 00:00:00 2001 From: Nathan Shaaban <86252985+ctrlaltf24@users.noreply.github.com> Date: Fri, 20 Sep 2024 03:02:52 +0000 Subject: [PATCH 02/15] style: cargo fmt --- engineio/src/asynchronous/async_socket.rs | 21 +++++++------------ .../asynchronous/async_transports/polling.rs | 2 +- .../src/asynchronous/client/async_client.rs | 2 +- engineio/src/asynchronous/client/builder.rs | 3 +-- engineio/src/client/client.rs | 2 +- engineio/src/transports/websocket_secure.rs | 3 +-- 6 files changed, 13 insertions(+), 20 deletions(-) diff --git a/engineio/src/asynchronous/async_socket.rs b/engineio/src/asynchronous/async_socket.rs index 72612e39..42cc101c 100644 --- a/engineio/src/asynchronous/async_socket.rs +++ b/engineio/src/asynchronous/async_socket.rs @@ -12,14 +12,14 @@ use bytes::Bytes; use futures_util::{stream, Stream, StreamExt}; use tokio::{runtime::Handle, sync::Mutex, time::Instant}; +#[cfg(feature = "async-callbacks")] +use super::callback::OptionalCallback; use crate::{ asynchronous::transport::AsyncTransportType, error::Result, packet::{HandshakePacket, Payload}, Error, Packet, PacketId, }; -#[cfg(feature = "async-callbacks")] -use super::callback::OptionalCallback; #[derive(Clone)] pub struct Socket { @@ -48,16 +48,11 @@ impl Socket { pub(crate) fn new( transport: AsyncTransportType, handshake: HandshakePacket, - #[cfg(feature = "async-callbacks")] - on_close: OptionalCallback<()>, - #[cfg(feature = "async-callbacks")] - on_data: OptionalCallback, - #[cfg(feature = "async-callbacks")] - on_error: OptionalCallback, - #[cfg(feature = "async-callbacks")] - on_open: OptionalCallback<()>, - #[cfg(feature = "async-callbacks")] - on_packet: OptionalCallback, + #[cfg(feature = "async-callbacks")] on_close: OptionalCallback<()>, + #[cfg(feature = "async-callbacks")] on_data: OptionalCallback, + #[cfg(feature = "async-callbacks")] on_error: OptionalCallback, + #[cfg(feature = "async-callbacks")] on_open: OptionalCallback<()>, + #[cfg(feature = "async-callbacks")] on_packet: OptionalCallback, ) -> Self { let max_ping_timeout = handshake.ping_interval + handshake.ping_timeout; @@ -324,7 +319,7 @@ impl Debug for Socket { .field("on_error", &self.on_error) .field("on_open", &self.on_open) .field("on_packet", &self.on_packet); - + debug.finish() } } diff --git a/engineio/src/asynchronous/async_transports/polling.rs b/engineio/src/asynchronous/async_transports/polling.rs index 96508122..4aff5954 100644 --- a/engineio/src/asynchronous/async_transports/polling.rs +++ b/engineio/src/asynchronous/async_transports/polling.rs @@ -13,8 +13,8 @@ use tokio::sync::RwLock; use url::Url; use crate::asynchronous::generator::StreamGenerator; -use crate::{asynchronous::transport::AsyncTransport, error::Result, Error}; use crate::TlsConfig; +use crate::{asynchronous::transport::AsyncTransport, error::Result, Error}; /// An asynchronous polling type. Makes use of the nonblocking reqwest types and /// methods. diff --git a/engineio/src/asynchronous/client/async_client.rs b/engineio/src/asynchronous/client/async_client.rs index 8f1b5faa..0d5c9c1c 100644 --- a/engineio/src/asynchronous/client/async_client.rs +++ b/engineio/src/asynchronous/client/async_client.rs @@ -92,10 +92,10 @@ impl Debug for Client { mod test { use super::*; + use crate::TlsConfig; use crate::{asynchronous::ClientBuilder, header::HeaderMap, packet::PacketId, Error}; use bytes::Bytes; use futures_util::StreamExt; - use crate::TlsConfig; use url::Url; /// The purpose of this test is to check whether the Client is properly cloneable or not. diff --git a/engineio/src/asynchronous/client/builder.rs b/engineio/src/asynchronous/client/builder.rs index b9bea417..87228325 100644 --- a/engineio/src/asynchronous/client/builder.rs +++ b/engineio/src/asynchronous/client/builder.rs @@ -8,8 +8,7 @@ use crate::{ error::Result, header::HeaderMap, packet::HandshakePacket, - Error, Packet, ENGINE_IO_VERSION, - TlsConfig, + Error, Packet, TlsConfig, ENGINE_IO_VERSION, }; use bytes::Bytes; use futures_util::{future::BoxFuture, StreamExt}; diff --git a/engineio/src/client/client.rs b/engineio/src/client/client.rs index d04f4dc4..1c82003e 100644 --- a/engineio/src/client/client.rs +++ b/engineio/src/client/client.rs @@ -7,7 +7,7 @@ use crate::error::{Error, Result}; use crate::header::HeaderMap; use crate::packet::{HandshakePacket, Packet, PacketId}; use crate::transports::{PollingTransport, WebsocketSecureTransport, WebsocketTransport}; -use crate::{ENGINE_IO_VERSION, TlsConfig}; +use crate::{TlsConfig, ENGINE_IO_VERSION}; use bytes::Bytes; use std::convert::TryFrom; use std::convert::TryInto; diff --git a/engineio/src/transports/websocket_secure.rs b/engineio/src/transports/websocket_secure.rs index 04fff99f..3291d787 100644 --- a/engineio/src/transports/websocket_secure.rs +++ b/engineio/src/transports/websocket_secure.rs @@ -5,8 +5,7 @@ use crate::{ }, error::Result, transport::Transport, - Error, - TlsConfig, + Error, TlsConfig, }; use bytes::Bytes; use http::HeaderMap; From bc8f6d341e37f82268f9a888e3e883149d355de1 Mon Sep 17 00:00:00 2001 From: Nathan Shaaban <86252985+ctrlaltf24@users.noreply.github.com> Date: Fri, 20 Sep 2024 04:39:12 +0000 Subject: [PATCH 03/15] ci: fix most of the tests There's still an error with ci. engineio/src/lib.rs/test/tls_connector doesn't function the same as native-tls one (as it properly validates hostnames) Needs further investigation as to why the hostname shows as invalid in ci. If we no longer need that, then this PR can be merged. --- .github/workflows/test.yml | 2 +- Cargo.lock | 255 ++++-------------- engineio/Cargo.toml | 6 +- .../async_transports/websocket_secure.rs | 2 +- engineio/src/client/client.rs | 7 +- engineio/src/lib.rs | 38 ++- socketio/Cargo.toml | 7 +- socketio/src/asynchronous/client/builder.rs | 3 +- socketio/src/client/builder.rs | 3 +- socketio/src/client/raw_client.rs | 30 ++- socketio/src/lib.rs | 17 ++ 11 files changed, 128 insertions(+), 242 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c2c0161a..a9fc774a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -55,7 +55,7 @@ jobs: run: cargo test-all-features --verbose --lib --examples - name: Run doc tests - run: cargo test-all-features --verbose --lib --examples --doc + run: cargo test-all-features --verbose --doc - name: Run integration tests run: cargo test --verbose --features "async" --benches --tests diff --git a/Cargo.lock b/Cargo.lock index a39b2d1b..8fd4714a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -112,33 +112,6 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" -[[package]] -name = "aws-lc-rs" -version = "1.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f95446d919226d587817a7d21379e6eb099b97b45110a7f272a444ca5c54070" -dependencies = [ - "aws-lc-sys", - "mirai-annotations", - "paste", - "zeroize", -] - -[[package]] -name = "aws-lc-sys" -version = "0.21.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3ddc4a5b231dd6958b140ff3151b6412b3f4321fab354f399eec8f14b06df62" -dependencies = [ - "bindgen", - "cc", - "cmake", - "dunce", - "fs_extra", - "libc", - "paste", -] - [[package]] name = "backoff" version = "0.4.0" @@ -171,29 +144,6 @@ version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9475866fec1451be56a3c2400fd081ff546538961565ccb5b7142cbd22bc7a51" -[[package]] -name = "bindgen" -version = "0.69.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a00dc851838a2120612785d195287475a3ac45514741da670b735818822129a0" -dependencies = [ - "bitflags 2.6.0", - "cexpr", - "clang-sys", - "itertools", - "lazy_static", - "lazycell", - "log", - "prettyplease", - "proc-macro2", - "quote", - "regex", - "rustc-hash", - "shlex", - "syn 2.0.48", - "which", -] - [[package]] name = "bitflags" version = "1.3.2" @@ -318,15 +268,6 @@ dependencies = [ "shlex", ] -[[package]] -name = "cexpr" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766" -dependencies = [ - "nom", -] - [[package]] name = "cfg-if" version = "1.0.0" @@ -375,17 +316,6 @@ dependencies = [ "half", ] -[[package]] -name = "clang-sys" -version = "1.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b023947811758c97c59bf9d1c188fd619ad4718dcaa767947df1cadb14f39f4" -dependencies = [ - "glob", - "libc", - "libloading", -] - [[package]] name = "clap" version = "2.34.0" @@ -426,15 +356,6 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2da6da31387c7e4ef160ffab6d5e7f00c42626fe39aea70a7b0f1773f7dd6c1b" -[[package]] -name = "cmake" -version = "0.1.51" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb1e43aa7fd152b1f968787f7dbcdeb306d1867ff373c69955211876c053f91a" -dependencies = [ - "cc", -] - [[package]] name = "codespan-reporting" version = "0.11.1" @@ -696,12 +617,6 @@ dependencies = [ "crypto-common", ] -[[package]] -name = "dunce" -version = "1.0.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92773504d58c093f6de2459af4af33faa518c13451eb8f2b5698ed3d36e7c813" - [[package]] name = "either" version = "1.6.1" @@ -799,12 +714,6 @@ dependencies = [ "percent-encoding", ] -[[package]] -name = "fs_extra" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42703706b716c37f96a77aea830392ad231f44c9e9a67872fa5548707e11b11c" - [[package]] name = "futures" version = "0.3.17" @@ -947,12 +856,6 @@ dependencies = [ "url", ] -[[package]] -name = "glob" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" - [[package]] name = "gzip-header" version = "0.3.0" @@ -1020,15 +923,6 @@ version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" -[[package]] -name = "home" -version = "0.5.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3d1354bf6b7235cb4a0576c2619fd4ed18183f689b12b006a0ee7329eeff9a5" -dependencies = [ - "windows-sys 0.52.0", -] - [[package]] name = "http" version = "1.1.0" @@ -1115,7 +1009,7 @@ dependencies = [ "http", "hyper", "hyper-util", - "rustls 0.22.4", + "rustls", "rustls-pki-types", "tokio", "tokio-rustls", @@ -1289,12 +1183,6 @@ version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" -[[package]] -name = "lazycell" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" - [[package]] name = "libc" version = "0.2.158" @@ -1315,16 +1203,6 @@ dependencies = [ "pkg-config", ] -[[package]] -name = "libloading" -version = "0.8.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4979f22fdb869068da03c9f7528f8297c6fd2606bc3a4affe42e6a823fdb8da4" -dependencies = [ - "cfg-if", - "windows-targets 0.52.6", -] - [[package]] name = "libssh2-sys" version = "0.2.23" @@ -1433,12 +1311,6 @@ version = "0.3.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2a60c7ce501c71e03a9c9c0d35b861413ae925bd979cc7a4e30d060069aaac8d" -[[package]] -name = "minimal-lexical" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" - [[package]] name = "miniz_oxide" version = "0.6.2" @@ -1468,12 +1340,6 @@ dependencies = [ "windows-sys 0.48.0", ] -[[package]] -name = "mirai-annotations" -version = "1.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9be0862c1b3f26a88803c4a49de6889c10e608b3ee9344e6ef5b45fb37ad3d1" - [[package]] name = "native-tls" version = "0.2.12" @@ -1504,16 +1370,6 @@ dependencies = [ "memoffset", ] -[[package]] -name = "nom" -version = "7.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" -dependencies = [ - "memchr", - "minimal-lexical", -] - [[package]] name = "num-integer" version = "0.1.45" @@ -1650,12 +1506,6 @@ dependencies = [ "windows-targets 0.48.0", ] -[[package]] -name = "paste" -version = "1.0.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" - [[package]] name = "percent-encoding" version = "2.3.1" @@ -1734,16 +1584,6 @@ version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c3ca011bd0129ff4ae15cd04c4eef202cadf6c51c21e47aba319b4e0501db741" -[[package]] -name = "prettyplease" -version = "0.2.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d3928fb5db768cb86f891ff014f0144589297e3c6a1aba6ed7cecfdace270c7" -dependencies = [ - "proc-macro2", - "syn 2.0.48", -] - [[package]] name = "proc-macro2" version = "1.0.78" @@ -1913,7 +1753,7 @@ dependencies = [ "once_cell", "percent-encoding", "pin-project-lite", - "rustls 0.22.4", + "rustls", "rustls-pemfile", "rustls-pki-types", "serde", @@ -1935,6 +1775,21 @@ dependencies = [ "winreg", ] +[[package]] +name = "ring" +version = "0.16.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3053cf52e236a3ed746dfc745aa9cacf1b791d846bdaf412f60a8d7d6e17c8fc" +dependencies = [ + "cc", + "libc", + "once_cell", + "spin 0.5.2", + "untrusted 0.7.1", + "web-sys", + "winapi", +] + [[package]] name = "ring" version = "0.17.8" @@ -1945,8 +1800,8 @@ dependencies = [ "cfg-if", "getrandom", "libc", - "spin", - "untrusted", + "spin 0.9.8", + "untrusted 0.9.0", "windows-sys 0.52.0", ] @@ -1965,7 +1820,8 @@ dependencies = [ "lazy_static", "native-tls", "reqwest", - "rustls 0.22.4", + "rustls", + "rustls-pemfile", "serde", "serde_json", "thiserror", @@ -1973,6 +1829,7 @@ dependencies = [ "tokio-tungstenite", "tungstenite", "url", + "webpki", ] [[package]] @@ -1991,7 +1848,7 @@ dependencies = [ "native-tls", "rand", "rust_engineio", - "rustls 0.23.13", + "rustls", "serde", "serde_json", "serial_test", @@ -2006,12 +1863,6 @@ version = "0.1.21" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ef03e0a2b150c7a90d01faf6254c9c48a41e95fb2a8c2ac1c6f0d2b9aefc342" -[[package]] -name = "rustc-hash" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" - [[package]] name = "rustc_version" version = "0.4.0" @@ -2055,22 +1906,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bf4ef73721ac7bcd79b2b315da7779d8fc09718c6b3d2d1b2d94850eb8c18432" dependencies = [ "log", - "ring", - "rustls-pki-types", - "rustls-webpki", - "subtle", - "zeroize", -] - -[[package]] -name = "rustls" -version = "0.23.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2dabaac7466917e566adb06783a81ca48944c6898a1b08b9374106dd671f4c8" -dependencies = [ - "aws-lc-rs", - "log", - "once_cell", + "ring 0.17.8", "rustls-pki-types", "rustls-webpki", "subtle", @@ -2112,10 +1948,9 @@ version = "0.102.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "64ca1bc8749bd4cf37b5ce386cc146580777b4e8572c7b97baf22c83f444bee9" dependencies = [ - "aws-lc-rs", - "ring", + "ring 0.17.8", "rustls-pki-types", - "untrusted", + "untrusted 0.9.0", ] [[package]] @@ -2314,6 +2149,12 @@ dependencies = [ "windows-sys 0.48.0", ] +[[package]] +name = "spin" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" + [[package]] name = "spin" version = "0.9.8" @@ -2527,7 +2368,7 @@ version = "0.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "775e0c0f0adb3a2f22a00c4745d728b479985fc15ee7ca6a2608388c5569860f" dependencies = [ - "rustls 0.22.4", + "rustls", "rustls-pki-types", "tokio", ] @@ -2541,7 +2382,7 @@ dependencies = [ "futures-util", "log", "native-tls", - "rustls 0.22.4", + "rustls", "rustls-native-certs", "rustls-pki-types", "tokio", @@ -2673,7 +2514,7 @@ dependencies = [ "log", "native-tls", "rand", - "rustls 0.22.4", + "rustls", "rustls-pki-types", "sha1", "thiserror", @@ -2714,6 +2555,12 @@ version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b" +[[package]] +name = "untrusted" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" + [[package]] name = "untrusted" version = "0.9.0" @@ -2878,24 +2725,22 @@ dependencies = [ ] [[package]] -name = "webpki-roots" -version = "0.26.6" +name = "webpki" +version = "0.21.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "841c67bff177718f1d4dfefde8d8f0e78f9b6589319ba88312f567fc5841a958" +checksum = "b8e38c0608262c46d4a56202ebabdeb094cef7e560ca7a226c6bf055188aa4ea" dependencies = [ - "rustls-pki-types", + "ring 0.16.20", + "untrusted 0.7.1", ] [[package]] -name = "which" -version = "4.4.2" +name = "webpki-roots" +version = "0.26.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87ba24419a2078cd2b0f2ede2691b6c66d8e47836da3b6db8265ebad47afbfc7" +checksum = "841c67bff177718f1d4dfefde8d8f0e78f9b6589319ba88312f567fc5841a958" dependencies = [ - "either", - "home", - "once_cell", - "rustix 0.38.25", + "rustls-pki-types", ] [[package]] diff --git a/engineio/Cargo.toml b/engineio/Cargo.toml index b091a5de..c5bf9b97 100644 --- a/engineio/Cargo.toml +++ b/engineio/Cargo.toml @@ -30,6 +30,10 @@ async-stream = "0.3.5" thiserror = "1.0" native-tls = { version = "^0.2", optional = true } rustls = { version = "^0.22", optional = true } +# rustls-pemfile is only needed for unit tests +rustls-pemfile = { version = "2", optional = true } +# webpki is only needed for unit tests +webpki = { version = "0.21", optional = true } url = "2.5.2" [dev-dependencies] @@ -61,7 +65,7 @@ rustls-tls-native-roots = ["tokio-tungstenite/rustls-tls-native-roots", "_rustls rustls-tls-webpki-roots = ["tokio-tungstenite/rustls-tls-webpki-roots", "_rustls-tls"] # These features are for internal use only _native-tls = ["dep:native-tls", "reqwest/native-tls"] -_rustls-tls = ["dep:rustls", "reqwest/rustls-tls"] +_rustls-tls = ["dep:rustls", "reqwest/rustls-tls", "dep:rustls-pemfile", "dep:webpki"] # This is an internal feature to allow us to build using cargo-all-features and guaranteing that we always have one TLS implementation # Do not use this feature directly diff --git a/engineio/src/asynchronous/async_transports/websocket_secure.rs b/engineio/src/asynchronous/async_transports/websocket_secure.rs index da13ca68..0e073152 100644 --- a/engineio/src/asynchronous/async_transports/websocket_secure.rs +++ b/engineio/src/asynchronous/async_transports/websocket_secure.rs @@ -61,7 +61,7 @@ impl WebsocketSecureTransport { #[cfg(feature = "_rustls-tls")] tls_config.map(Arc::new).map(Connector::Rustls), #[cfg(not(any(feature = "_native-tls", feature = "_rustls-tls")))] - None, + compile_error!("Either feature `_native-tls` or `_rustls-tls` must be enabled"), ) .await?; diff --git a/engineio/src/client/client.rs b/engineio/src/client/client.rs index 1c82003e..b37614de 100644 --- a/engineio/src/client/client.rs +++ b/engineio/src/client/client.rs @@ -376,7 +376,7 @@ impl<'a> Iterator for Iter<'a> { #[cfg(test)] mod test { - use crate::packet::PacketId; + use crate::{packet::PacketId, test::tls_connector}; use super::*; @@ -649,10 +649,7 @@ mod test { let _ = builder(url.clone()) .tls_config( - TlsConfig::builder() - .danger_accept_invalid_certs(true) - .build() - .unwrap(), + tls_connector()? ) .build()?; let _ = builder(url).headers(headers).build()?; diff --git a/engineio/src/lib.rs b/engineio/src/lib.rs index 467bb12e..3d92e4cc 100644 --- a/engineio/src/lib.rs +++ b/engineio/src/lib.rs @@ -99,13 +99,14 @@ pub use client::{Client, ClientBuilder}; pub use error::Error; pub use packet::{Packet, PacketId}; -// Re-export TLS configurations to make sockio integration easier +// Re-export TLS configurations. This is the same as the socket.io logic. +// Needed in both crates so the compiler can know this is a re-export. #[cfg(all(feature = "_native-tls", not(feature = "_rustls-tls")))] #[doc(hidden)] -pub use native_tls::TlsConnector as TlsConfig; +pub(crate) use native_tls::TlsConnector as TlsConfig; #[doc(hidden)] #[cfg(feature = "_rustls-tls")] -pub use rustls::ClientConfig as TlsConfig; +pub(crate) use rustls::ClientConfig as TlsConfig; // Both native-tls and rustls is not supported at the same time #[cfg(not(feature = "_fallback-tls"))] @@ -118,24 +119,39 @@ compile_error!("No TLS feature is enabled. Please enable either native-tls or ru #[cfg(test)] pub(crate) mod test { use super::*; + #[cfg(feature = "_native-tls")] use native_tls::TlsConnector; const CERT_PATH: &str = "../ci/cert/ca.crt"; + #[cfg(all(feature = "_native-tls", not(feature = "_rustls-tls")))] use native_tls::Certificate; use std::fs::File; use std::io::Read; - pub(crate) fn tls_connector() -> error::Result { + pub(crate) fn tls_connector() -> error::Result { let cert_path = std::env::var("CA_CERT_PATH").unwrap_or_else(|_| CERT_PATH.to_owned()); let mut cert_file = File::open(cert_path)?; let mut buf = vec![]; cert_file.read_to_end(&mut buf)?; - let cert: Certificate = Certificate::from_pem(&buf[..]).unwrap(); - Ok(TlsConnector::builder() - // ONLY USE FOR TESTING! - .danger_accept_invalid_hostnames(true) - .add_root_certificate(cert) - .build() - .unwrap()) + #[cfg(all(feature = "_native-tls", not(feature = "_rustls-tls")))] + { + let cert: Certificate = Certificate::from_pem(&buf[..]).unwrap(); + Ok(TlsConnector::builder() + // ONLY USE FOR TESTING! + .danger_accept_invalid_hostnames(true) + .add_root_certificate(cert) + .build() + .unwrap()) + } + #[cfg(feature = "_rustls-tls")] + { + let mut root_store = rustls::RootCertStore::empty(); + for cert in rustls_pemfile::certs(&mut buf.as_slice()) { + root_store.add(cert.expect("Invalid PEM cert")).expect("Failed to add cert to store"); + } + let mut config = rustls::ClientConfig::builder().with_root_certificates(root_store).with_no_client_auth(); + config.enable_sni = false; + Ok(config) + } } /// The `engine.io` server for testing runs on port 4201 const SERVER_URL: &str = "http://localhost:4201"; diff --git a/socketio/Cargo.toml b/socketio/Cargo.toml index 14b21913..230adbb7 100644 --- a/socketio/Cargo.toml +++ b/socketio/Cargo.toml @@ -29,7 +29,7 @@ async-stream = { version = "0.3.5", optional = true } log = "0.4.22" serde = "1.0.209" native-tls = { version = "0.2", optional = true } -rustls = { version = "0.23", optional = true } +rustls = { version = "0.22", optional = true } getrandom = "0.2.10" [dev-dependencies] @@ -61,6 +61,11 @@ name = "async" path = "examples/async.rs" required-features = ["async", "native-tls"] +[[example]] +name = "secure" +path = "examples/secure.rs" +required-features = ["native-tls"] + [lints.rust] unexpected_cfgs = { level = "warn", check-cfg = ['cfg(tarpaulin)'] } diff --git a/socketio/src/asynchronous/client/builder.rs b/socketio/src/asynchronous/client/builder.rs index 293bebe3..1b4f6cc1 100644 --- a/socketio/src/asynchronous/client/builder.rs +++ b/socketio/src/asynchronous/client/builder.rs @@ -3,12 +3,11 @@ use log::trace; use rust_engineio::{ asynchronous::ClientBuilder as EngineIoClientBuilder, header::{HeaderMap, HeaderValue}, - TlsConfig, }; use std::collections::HashMap; use url::Url; -use crate::{error::Result, Event, Payload, TransportType}; +use crate::{error::Result, Event, Payload, TransportType, TlsConfig}; use super::{ callback::{ diff --git a/socketio/src/client/builder.rs b/socketio/src/client/builder.rs index 6112f2a1..e7241d8e 100644 --- a/socketio/src/client/builder.rs +++ b/socketio/src/client/builder.rs @@ -1,10 +1,9 @@ use super::super::{event::Event, payload::Payload}; use super::callback::Callback; use super::client::Client; -use crate::RawClient; +use crate::{RawClient, TlsConfig}; use rust_engineio::client::ClientBuilder as EngineIoClientBuilder; use rust_engineio::header::{HeaderMap, HeaderValue}; -use rust_engineio::TlsConfig; use url::Url; use crate::client::callback::{SocketAnyCallback, SocketCallback}; diff --git a/socketio/src/client/raw_client.rs b/socketio/src/client/raw_client.rs index 0686683f..7dd93796 100644 --- a/socketio/src/client/raw_client.rs +++ b/socketio/src/client/raw_client.rs @@ -418,10 +418,24 @@ mod test { use super::*; use crate::{client::TransportType, payload::Payload, ClientBuilder}; use bytes::Bytes; - use native_tls::TlsConnector; use serde_json::json; use std::time::Duration; + #[cfg(feature = "_native-tls")] + fn tls_config() -> native_tls::TlsConnector { + native_tls::TlsConnector::builder() + .use_sni(true) + .build() + .expect("Found illegal configuration") + } + + #[cfg(feature = "_rustls-tls")] + fn tls_config() -> rustls::ClientConfig { + rustls::ClientConfig::builder() + .with_root_certificates(rustls::RootCertStore::empty()) + .with_no_client_auth() + } + #[test] fn socket_io_integration() -> Result<()> { let url = crate::test::socket_io_server(); @@ -474,14 +488,9 @@ mod test { // test socket build logic let socket_builder = ClientBuilder::new(url); - let tls_connector = TlsConnector::builder() - .use_sni(true) - .build() - .expect("Found illegal configuration"); - let socket = socket_builder .namespace("/admin") - .tls_config(tls_connector) + .tls_config(tls_config()) .opening_header("accept-encoding", "application/json") .on("test", |str, _| println!("Received: {:#?}", str)) .on("message", |payload, _| println!("{:#?}", payload)) @@ -515,14 +524,9 @@ mod test { // test socket build logic let socket_builder = ClientBuilder::new(url); - let tls_connector = TlsConnector::builder() - .use_sni(true) - .build() - .expect("Found illegal configuration"); - let socket = socket_builder .namespace("/admin") - .tls_config(tls_connector) + .tls_config(tls_config()) .opening_header("accept-encoding", "application/json") .on("test", |str, _| println!("Received: {:#?}", str)) .on("message", |payload, _| println!("{:#?}", payload)) diff --git a/socketio/src/lib.rs b/socketio/src/lib.rs index b913eb4d..f3ca50b4 100644 --- a/socketio/src/lib.rs +++ b/socketio/src/lib.rs @@ -199,6 +199,23 @@ pub use client::{ClientBuilder, RawClient, TransportType}; #[deprecated(since = "0.3.0-alpha-2", note = "Socket renamed to Client")] pub use client::{ClientBuilder as SocketBuilder, RawClient as Socket}; +// Re-export TLS configurations. This is the same as the engine.io logic. +// Needed here so it knows it's actually a re-import, not a new type. +#[cfg(all(feature = "_native-tls", not(feature = "_rustls-tls")))] +#[doc(hidden)] +pub use native_tls::TlsConnector as TlsConfig; +#[doc(hidden)] +#[cfg(feature = "_rustls-tls")] +pub use rustls::ClientConfig as TlsConfig; + +// Both native-tls and rustls is not supported at the same time +#[cfg(not(feature = "_fallback-tls"))] +#[cfg(all(feature = "_native-tls", feature = "_rustls-tls"))] +compile_error!("Both native-tls and rustls features are enabled. Please enable only one of them."); + +#[cfg(not(any(feature = "_native-tls", feature = "_rustls-tls")))] +compile_error!("No TLS feature is enabled. Please enable either native-tls or rustls."); + #[cfg(test)] pub(crate) mod test { use url::Url; From b09d376900f4951d4ae01b99a45087c47a101554 Mon Sep 17 00:00:00 2001 From: Nathan Shaaban <86252985+ctrlaltf24@users.noreply.github.com> Date: Thu, 19 Sep 2024 19:24:47 -0700 Subject: [PATCH 04/15] feat: add features for other tls types Turned out to be rather easy due to all tls being handled by our dependencies. Don't love the _fallback-tls feature, however with it we can use cargo-all-features, which helps reduce feature related bugs. Downside of cargo-all-features is it takes a long time to execute. Fixes: #407, #366 --- .github/workflows/build.yml | 5 +- .github/workflows/test.yml | 13 +- Cargo.lock | 391 ++++++++++++++++-- engineio/Cargo.toml | 42 +- engineio/src/asynchronous/async_socket.rs | 74 +++- .../asynchronous/async_transports/polling.rs | 4 +- .../async_transports/websocket_secure.rs | 9 +- .../src/asynchronous/client/async_client.rs | 4 +- engineio/src/asynchronous/client/builder.rs | 6 +- engineio/src/asynchronous/transport.rs | 1 - engineio/src/client/client.rs | 9 +- engineio/src/lib.rs | 16 + engineio/src/transports/polling.rs | 4 +- engineio/src/transports/websocket_secure.rs | 4 +- socketio/Cargo.toml | 44 +- socketio/src/asynchronous/client/builder.rs | 4 +- socketio/src/client/builder.rs | 6 +- 17 files changed, 553 insertions(+), 83 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 13caad64..7215e796 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -35,8 +35,11 @@ jobs: ~/.cargo/git/db/ key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} + - name: Install cargo-all-features + run: cargo install cargo-all-features + - name: Build - run: cargo build --verbose --all-features + run: cargo build-all-features --verbose - name: Linting run: cargo clippy --verbose --all-features - name: Check formatting diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 9fa22700..c2c0161a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -48,5 +48,14 @@ jobs: ~/.cargo/git/db/ key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} - - name: Run testsuite - run: cargo test --verbose --features "async" + - name: Install cargo-all-features + run: cargo install cargo-all-features + + - name: Run unit tests + run: cargo test-all-features --verbose --lib --examples + + - name: Run doc tests + run: cargo test-all-features --verbose --lib --examples --doc + + - name: Run integration tests + run: cargo test --verbose --features "async" --benches --tests diff --git a/Cargo.lock b/Cargo.lock index e121b146..83b385c9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -112,6 +112,33 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" +[[package]] +name = "aws-lc-rs" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f95446d919226d587817a7d21379e6eb099b97b45110a7f272a444ca5c54070" +dependencies = [ + "aws-lc-sys", + "mirai-annotations", + "paste", + "zeroize", +] + +[[package]] +name = "aws-lc-sys" +version = "0.21.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b3ddc4a5b231dd6958b140ff3151b6412b3f4321fab354f399eec8f14b06df62" +dependencies = [ + "bindgen", + "cc", + "cmake", + "dunce", + "fs_extra", + "libc", + "paste", +] + [[package]] name = "backoff" version = "0.4.0" @@ -144,6 +171,29 @@ version = "0.22.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" +[[package]] +name = "bindgen" +version = "0.69.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a00dc851838a2120612785d195287475a3ac45514741da670b735818822129a0" +dependencies = [ + "bitflags 2.6.0", + "cexpr", + "clang-sys", + "itertools", + "lazy_static", + "lazycell", + "log", + "prettyplease", + "proc-macro2", + "quote", + "regex", + "rustc-hash", + "shlex", + "syn 2.0.89", + "which", +] + [[package]] name = "bitflags" version = "1.3.2" @@ -152,9 +202,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.3.3" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "630be753d4e58660abd17930c71b647fe46c27ea6b63cc59e1e3851406972e42" +checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" [[package]] name = "block-buffer" @@ -259,11 +309,22 @@ checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5" [[package]] name = "cc" -version = "1.0.71" +version = "1.1.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79c2681d6594606957bbb8631c4b90a7fcaaa72cdb714743a437b156d6a7eedd" +checksum = "07b1695e2c7e8fc85310cde85aeaab7e3097f593c91d209d3f9df76c928100f0" dependencies = [ "jobserver", + "libc", + "shlex", +] + +[[package]] +name = "cexpr" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766" +dependencies = [ + "nom", ] [[package]] @@ -314,6 +375,17 @@ dependencies = [ "half", ] +[[package]] +name = "clang-sys" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b023947811758c97c59bf9d1c188fd619ad4718dcaa767947df1cadb14f39f4" +dependencies = [ + "glob", + "libc", + "libloading", +] + [[package]] name = "clap" version = "2.34.0" @@ -354,6 +426,15 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2da6da31387c7e4ef160ffab6d5e7f00c42626fe39aea70a7b0f1773f7dd6c1b" +[[package]] +name = "cmake" +version = "0.1.51" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb1e43aa7fd152b1f968787f7dbcdeb306d1867ff373c69955211876c053f91a" +dependencies = [ + "cc", +] + [[package]] name = "codespan-reporting" version = "0.11.1" @@ -626,6 +707,12 @@ dependencies = [ "syn 2.0.89", ] +[[package]] +name = "dunce" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92773504d58c093f6de2459af4af33faa518c13451eb8f2b5698ed3d36e7c813" + [[package]] name = "either" version = "1.6.1" @@ -723,6 +810,12 @@ dependencies = [ "percent-encoding", ] +[[package]] +name = "fs_extra" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42703706b716c37f96a77aea830392ad231f44c9e9a67872fa5548707e11b11c" + [[package]] name = "futures" version = "0.3.17" @@ -824,13 +917,13 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.3" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fcd999463524c52659517fe2cea98493cfe485d10565e7b0fb07dbba7ad2753" +checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" dependencies = [ "cfg-if", "libc", - "wasi 0.10.2+wasi-snapshot-preview1", + "wasi", ] [[package]] @@ -865,6 +958,12 @@ dependencies = [ "url", ] +[[package]] +name = "glob" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" + [[package]] name = "gzip-header" version = "0.3.0" @@ -932,6 +1031,15 @@ version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" +[[package]] +name = "home" +version = "0.5.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3d1354bf6b7235cb4a0576c2619fd4ed18183f689b12b006a0ee7329eeff9a5" +dependencies = [ + "windows-sys 0.52.0", +] + [[package]] name = "http" version = "1.1.0" @@ -1008,6 +1116,23 @@ dependencies = [ "want", ] +[[package]] +name = "hyper-rustls" +version = "0.26.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0bea761b46ae2b24eb4aef630d8d1c398157b6fc29e6350ecf090a0b70c952c" +dependencies = [ + "futures-util", + "http", + "hyper", + "hyper-util", + "rustls 0.22.4", + "rustls-pki-types", + "tokio", + "tokio-rustls", + "tower-service", +] + [[package]] name = "hyper-tls" version = "0.6.0" @@ -1261,7 +1386,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "24fddda5af7e54bf7da53067d6e802dbcc381d0a8eef629df528e3ebf68755cb" dependencies = [ "hermit-abi 0.3.9", - "rustix 0.38.1", + "rustix 0.38.25", "windows-sys 0.48.0", ] @@ -1282,9 +1407,9 @@ checksum = "1aab8fc367588b89dcee83ab0fd66b72b50b72fa1904d7095045ace2b0c81c35" [[package]] name = "jobserver" -version = "0.1.25" +version = "0.1.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "068b1ee6743e4d11fb9c6a1e6064b3693a1b600e7f5f5988047d98b3dc9fb90b" +checksum = "48d1dbcbbeb6a7fec7e059840aa538bd62aaccf972c7346c4d9d2059312853d0" dependencies = [ "libc", ] @@ -1304,11 +1429,17 @@ version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" +[[package]] +name = "lazycell" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" + [[package]] name = "libc" -version = "0.2.149" +version = "0.2.158" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a08173bc88b7955d1b3145aa561539096c421ac8debde8cbc3612ec635fee29b" +checksum = "d8adc4bb1803a324070e64a98ae98f38934d91957a99cfb3a43dcbc01bc56439" [[package]] name = "libgit2-sys" @@ -1324,6 +1455,16 @@ dependencies = [ "pkg-config", ] +[[package]] +name = "libloading" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4979f22fdb869068da03c9f7528f8297c6fd2606bc3a4affe42e6a823fdb8da4" +dependencies = [ + "cfg-if", + "windows-targets 0.52.6", +] + [[package]] name = "libssh2-sys" version = "0.2.23" @@ -1367,9 +1508,9 @@ checksum = "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519" [[package]] name = "linux-raw-sys" -version = "0.4.3" +version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09fc20d2ca12cb9f044c93e3bd6d32d523e6e2ec3db4f7b2939cd99026ecd3f0" +checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" [[package]] name = "litemap" @@ -1438,6 +1579,12 @@ version = "0.3.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2a60c7ce501c71e03a9c9c0d35b861413ae925bd979cc7a4e30d060069aaac8d" +[[package]] +name = "minimal-lexical" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" + [[package]] name = "miniz_oxide" version = "0.6.2" @@ -1464,10 +1611,16 @@ checksum = "80e04d1dcff3aae0704555fe5fee3bcfaf3d1fdf8a7e521d5b9d2b42acb52cec" dependencies = [ "hermit-abi 0.3.9", "libc", - "wasi 0.11.0+wasi-snapshot-preview1", + "wasi", "windows-sys 0.52.0", ] +[[package]] +name = "mirai-annotations" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9be0862c1b3f26a88803c4a49de6889c10e608b3ee9344e6ef5b45fb37ad3d1" + [[package]] name = "native-tls" version = "0.2.12" @@ -1498,6 +1651,16 @@ dependencies = [ "memoffset", ] +[[package]] +name = "nom" +version = "7.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" +dependencies = [ + "memchr", + "minimal-lexical", +] + [[package]] name = "num-integer" version = "0.1.45" @@ -1563,7 +1726,7 @@ version = "0.10.66" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9529f4786b70a3e8c61e11179af17ab6188ad8d0ded78c5529441ed39d4bd9c1" dependencies = [ - "bitflags 2.3.3", + "bitflags 2.6.0", "cfg-if", "foreign-types", "libc", @@ -1589,6 +1752,15 @@ version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "28988d872ab76095a6e6ac88d99b54fd267702734fd7ffe610ca27f533ddb95a" +[[package]] +name = "openssl-src" +version = "300.3.2+3.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a211a18d945ef7e648cc6e0058f4c548ee46aab922ea203e0d30e966ea23647b" +dependencies = [ + "cc", +] + [[package]] name = "openssl-sys" version = "0.9.103" @@ -1597,6 +1769,7 @@ checksum = "7f9e8deee91df40a943c71b917e5874b951d32a802526c85721ce3b776c929d6" dependencies = [ "cc", "libc", + "openssl-src", "pkg-config", "vcpkg", ] @@ -1624,6 +1797,12 @@ dependencies = [ "windows-targets 0.48.0", ] +[[package]] +name = "paste" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" + [[package]] name = "percent-encoding" version = "2.3.1" @@ -1702,6 +1881,16 @@ version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c3ca011bd0129ff4ae15cd04c4eef202cadf6c51c21e47aba319b4e0501db741" +[[package]] +name = "prettyplease" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d3928fb5db768cb86f891ff014f0144589297e3c6a1aba6ed7cecfdace270c7" +dependencies = [ + "proc-macro2", + "syn 2.0.89", +] + [[package]] name = "proc-macro2" version = "1.0.92" @@ -1860,6 +2049,7 @@ dependencies = [ "http-body", "http-body-util", "hyper", + "hyper-rustls", "hyper-tls", "hyper-util", "ipnet", @@ -1870,7 +2060,9 @@ dependencies = [ "once_cell", "percent-encoding", "pin-project-lite", + "rustls 0.22.4", "rustls-pemfile", + "rustls-pki-types", "serde", "serde_json", "serde_urlencoded", @@ -1878,6 +2070,7 @@ dependencies = [ "system-configuration", "tokio", "tokio-native-tls", + "tokio-rustls", "tokio-util", "tower-service", "url", @@ -1885,9 +2078,25 @@ dependencies = [ "wasm-bindgen-futures", "wasm-streams", "web-sys", + "webpki-roots", "winreg", ] +[[package]] +name = "ring" +version = "0.17.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c17fa4cb658e3583423e915b9f3acc01cceaee1860e33d59ebae66adc3a2dc0d" +dependencies = [ + "cc", + "cfg-if", + "getrandom", + "libc", + "spin", + "untrusted", + "windows-sys 0.52.0", +] + [[package]] name = "rust_engineio" version = "0.6.0" @@ -1903,6 +2112,7 @@ dependencies = [ "lazy_static", "native-tls", "reqwest", + "rustls 0.22.4", "serde", "serde_json", "thiserror", @@ -1923,10 +2133,12 @@ dependencies = [ "bytes", "cargo-tarpaulin", "futures-util", + "getrandom", "log", "native-tls", "rand", "rust_engineio", + "rustls 0.23.13", "serde", "serde_json", "serial_test", @@ -1941,6 +2153,12 @@ version = "0.1.21" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ef03e0a2b150c7a90d01faf6254c9c48a41e95fb2a8c2ac1c6f0d2b9aefc342" +[[package]] +name = "rustc-hash" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" + [[package]] name = "rustc_version" version = "0.4.0" @@ -1966,17 +2184,59 @@ dependencies = [ [[package]] name = "rustix" -version = "0.38.1" +version = "0.38.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbc6396159432b5c8490d4e301d8c705f61860b8b6c863bf79942ce5401968f3" +checksum = "dc99bc2d4f1fed22595588a013687477aedf3cdcfb26558c559edb67b4d9b22e" dependencies = [ - "bitflags 2.3.3", + "bitflags 2.6.0", "errno", "libc", - "linux-raw-sys 0.4.3", + "linux-raw-sys 0.4.14", "windows-sys 0.48.0", ] +[[package]] +name = "rustls" +version = "0.22.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf4ef73721ac7bcd79b2b315da7779d8fc09718c6b3d2d1b2d94850eb8c18432" +dependencies = [ + "log", + "ring", + "rustls-pki-types", + "rustls-webpki", + "subtle", + "zeroize", +] + +[[package]] +name = "rustls" +version = "0.23.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2dabaac7466917e566adb06783a81ca48944c6898a1b08b9374106dd671f4c8" +dependencies = [ + "aws-lc-rs", + "log", + "once_cell", + "rustls-pki-types", + "rustls-webpki", + "subtle", + "zeroize", +] + +[[package]] +name = "rustls-native-certs" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5bfb394eeed242e909609f56089eecfe5fda225042e8b171791b9c95f5931e5" +dependencies = [ + "openssl-probe", + "rustls-pemfile", + "rustls-pki-types", + "schannel", + "security-framework", +] + [[package]] name = "rustls-pemfile" version = "2.1.2" @@ -1989,9 +2249,21 @@ dependencies = [ [[package]] name = "rustls-pki-types" -version = "1.4.1" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc0a2ce646f8655401bb81e7927b812614bd5d91dbc968696be50603510fcaf0" + +[[package]] +name = "rustls-webpki" +version = "0.102.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ecd36cc4259e3e4514335c4a138c6b43171a8d61d8f5c9348f9fc7529416f247" +checksum = "64ca1bc8749bd4cf37b5ce386cc146580777b4e8572c7b97baf22c83f444bee9" +dependencies = [ + "aws-lc-rs", + "ring", + "rustls-pki-types", + "untrusted", +] [[package]] name = "ryu" @@ -2151,6 +2423,12 @@ dependencies = [ "lazy_static", ] +[[package]] +name = "shlex" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" + [[package]] name = "slab" version = "0.4.5" @@ -2183,6 +2461,12 @@ dependencies = [ "windows-sys 0.48.0", ] +[[package]] +name = "spin" +version = "0.9.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" + [[package]] name = "stable_deref_trait" version = "1.2.0" @@ -2195,6 +2479,12 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" +[[package]] +name = "subtle" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" + [[package]] name = "syn" version = "1.0.107" @@ -2383,6 +2673,17 @@ dependencies = [ "tokio", ] +[[package]] +name = "tokio-rustls" +version = "0.25.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "775e0c0f0adb3a2f22a00c4745d728b479985fc15ee7ca6a2608388c5569860f" +dependencies = [ + "rustls 0.22.4", + "rustls-pki-types", + "tokio", +] + [[package]] name = "tokio-tungstenite" version = "0.21.0" @@ -2392,9 +2693,14 @@ dependencies = [ "futures-util", "log", "native-tls", + "rustls 0.22.4", + "rustls-native-certs", + "rustls-pki-types", "tokio", "tokio-native-tls", + "tokio-rustls", "tungstenite", + "webpki-roots", ] [[package]] @@ -2519,6 +2825,8 @@ dependencies = [ "log", "native-tls", "rand", + "rustls 0.22.4", + "rustls-pki-types", "sha1", "thiserror", "url", @@ -2543,6 +2851,12 @@ version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b" +[[package]] +name = "untrusted" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" + [[package]] name = "url" version = "2.5.4" @@ -2617,12 +2931,6 @@ dependencies = [ "try-lock", ] -[[package]] -name = "wasi" -version = "0.10.2+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6" - [[package]] name = "wasi" version = "0.11.0+wasi-snapshot-preview1" @@ -2718,6 +3026,27 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "webpki-roots" +version = "0.26.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "841c67bff177718f1d4dfefde8d8f0e78f9b6589319ba88312f567fc5841a958" +dependencies = [ + "rustls-pki-types", +] + +[[package]] +name = "which" +version = "4.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87ba24419a2078cd2b0f2ede2691b6c66d8e47836da3b6db8265ebad47afbfc7" +dependencies = [ + "either", + "home", + "once_cell", + "rustix 0.38.25", +] + [[package]] name = "winapi" version = "0.3.9" @@ -2955,6 +3284,12 @@ dependencies = [ "synstructure", ] +[[package]] +name = "zeroize" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" + [[package]] name = "zerovec" version = "0.10.4" diff --git a/engineio/Cargo.toml b/engineio/Cargo.toml index b38c5a6c..8e35de45 100644 --- a/engineio/Cargo.toml +++ b/engineio/Cargo.toml @@ -16,19 +16,20 @@ all-features = true [dependencies] base64 = "0.22.1" bytes = "1" -reqwest = { version = "0.12.4", features = ["blocking", "native-tls", "stream"] } +reqwest = { version = "0.12.4", features = ["blocking", "stream"] } adler32 = "1.2.0" serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" http = "1.1.0" -tokio-tungstenite = { version = "0.21.0", features = ["native-tls"] } +tokio-tungstenite = { version = "0.21.0", features = [] } tungstenite = "0.21.0" tokio = "1.40.0" futures-util = { version = "0.3", default-features = false, features = ["sink"] } async-trait = "0.1.83" async-stream = "0.3.6" thiserror = "1.0" -native-tls = "0.2.12" +native-tls = { version = "^0.2", optional = true } +rustls = { version = "^0.22", optional = true } url = "2.5.4" [dev-dependencies] @@ -51,6 +52,39 @@ harness = false bench = false [features] -default = ["async"] +default = ["async", "native-tls"] async-callbacks = [] async = ["async-callbacks"] +native-tls = ["tokio-tungstenite/native-tls", "_native-tls"] +native-tls-vendored = ["tokio-tungstenite/native-tls-vendored", "_native-tls"] +rustls-tls-native-roots = ["tokio-tungstenite/rustls-tls-native-roots", "_rustls-tls"] +rustls-tls-webpki-roots = ["tokio-tungstenite/rustls-tls-webpki-roots", "_rustls-tls"] +# These features are for internal use only +_native-tls = ["dep:native-tls", "reqwest/native-tls"] +_rustls-tls = ["dep:rustls", "reqwest/rustls-tls"] + +# This is an internal feature to allow us to build using cargo-all-features and guaranteing that we always have one TLS implementation +# Do not use this feature directly +_fallback-tls = ["native-tls"] + +[lints.rust] +unexpected_cfgs = { level = "warn", check-cfg = ['cfg(tarpaulin)'] } + +[package.metadata.cargo-all-features] +skip_optional_dependencies = true +skip_feature_sets = [ + # Don't allow both at once + ["_native-tls", "_rustls-tls"], + # No need to compile with both native-tls options + ["native-tls", "native-tls-vendored"], + # No need to compile with both rustls options + ["rustls-tls-native-roots", "rustls-tls-webpki-roots"], + # Don't compile with both native-tls and rustls + ["native-tls", "rustls-tls-native-roots"], + ["native-tls", "rustls-tls-webpki-roots"], + ["native-tls-vendored", "rustls-tls-native-roots"], + ["native-tls-vendored", "rustls-tls-webpki-roots"], +] +always_include_features = ["_fallback-tls"] +# Don't use the internal features in the build matrix +denylist = ["_native-tls", "_rustls-tls"] diff --git a/engineio/src/asynchronous/async_socket.rs b/engineio/src/asynchronous/async_socket.rs index 8718e0ea..72612e39 100644 --- a/engineio/src/asynchronous/async_socket.rs +++ b/engineio/src/asynchronous/async_socket.rs @@ -13,48 +13,56 @@ use futures_util::{stream, Stream, StreamExt}; use tokio::{runtime::Handle, sync::Mutex, time::Instant}; use crate::{ - asynchronous::{callback::OptionalCallback, transport::AsyncTransportType}, + asynchronous::transport::AsyncTransportType, error::Result, packet::{HandshakePacket, Payload}, Error, Packet, PacketId, }; +#[cfg(feature = "async-callbacks")] +use super::callback::OptionalCallback; #[derive(Clone)] pub struct Socket { handle: Handle, transport: Arc>, transport_raw: AsyncTransportType, - on_close: OptionalCallback<()>, - on_data: OptionalCallback, - on_error: OptionalCallback, - on_open: OptionalCallback<()>, - on_packet: OptionalCallback, connected: Arc, last_ping: Arc>, last_pong: Arc>, connection_data: Arc, max_ping_timeout: u64, + // Bellow are the fields that are only used when the async-callbacks feature is enabled. + #[cfg(feature = "async-callbacks")] + on_close: OptionalCallback<()>, + #[cfg(feature = "async-callbacks")] + on_data: OptionalCallback, + #[cfg(feature = "async-callbacks")] + on_error: OptionalCallback, + #[cfg(feature = "async-callbacks")] + on_open: OptionalCallback<()>, + #[cfg(feature = "async-callbacks")] + on_packet: OptionalCallback, } impl Socket { pub(crate) fn new( transport: AsyncTransportType, handshake: HandshakePacket, + #[cfg(feature = "async-callbacks")] on_close: OptionalCallback<()>, + #[cfg(feature = "async-callbacks")] on_data: OptionalCallback, + #[cfg(feature = "async-callbacks")] on_error: OptionalCallback, + #[cfg(feature = "async-callbacks")] on_open: OptionalCallback<()>, + #[cfg(feature = "async-callbacks")] on_packet: OptionalCallback, ) -> Self { let max_ping_timeout = handshake.ping_interval + handshake.ping_timeout; Socket { handle: Handle::current(), - on_close, - on_data, - on_error, - on_open, - on_packet, transport: Arc::new(Mutex::new(transport.clone())), transport_raw: transport, connected: Arc::new(AtomicBool::default()), @@ -62,6 +70,16 @@ impl Socket { last_pong: Arc::new(Mutex::new(Instant::now())), connection_data: Arc::new(handshake), max_ping_timeout, + #[cfg(feature = "async-callbacks")] + on_close, + #[cfg(feature = "async-callbacks")] + on_data, + #[cfg(feature = "async-callbacks")] + on_error, + #[cfg(feature = "async-callbacks")] + on_open, + #[cfg(feature = "async-callbacks")] + on_packet, } } @@ -71,6 +89,7 @@ impl Socket { // SAFETY: Has valid handshake due to type self.connected.store(true, Ordering::Release); + #[cfg(feature = "async-callbacks")] if let Some(on_open) = self.on_open.as_ref() { let on_open = on_open.clone(); self.handle.spawn(async move { on_open(()).await }); @@ -85,18 +104,22 @@ impl Socket { Ok(()) } - /// A helper method that distributes + /// A helper method that distributes the incoming packets to the appropriate callbacks. pub(super) async fn handle_incoming_packet(&self, packet: Packet) -> Result<()> { // check for the appropriate action or callback + #[cfg(feature = "async-callbacks")] self.handle_packet(packet.clone()); match packet.packet_id { PacketId::MessageBinary => { + #[cfg(feature = "async-callbacks")] self.handle_data(packet.data.clone()); } PacketId::Message => { + #[cfg(feature = "async-callbacks")] self.handle_data(packet.data.clone()); } PacketId::Close => { + #[cfg(feature = "async-callbacks")] self.handle_close(); } PacketId::Upgrade => { @@ -144,6 +167,7 @@ impl Socket { } pub async fn disconnect(&self) -> Result<()> { + #[cfg(feature = "async-callbacks")] if let Some(on_close) = self.on_close.as_ref() { let on_close = on_close.clone(); self.handle.spawn(async move { on_close(()).await }); @@ -188,6 +212,7 @@ impl Socket { /// Calls the error callback with a given message. #[inline] + #[cfg(feature = "async-callbacks")] fn call_error_callback(&self, text: String) { if let Some(on_error) = self.on_error.as_ref() { let on_error = on_error.clone(); @@ -195,6 +220,9 @@ impl Socket { } } + #[cfg(not(feature = "async-callbacks"))] + fn call_error_callback(&self, _text: String) {} + // Check if the underlying transport client is connected. pub(crate) fn is_connected(&self) -> bool { self.connected.load(Ordering::Acquire) @@ -221,6 +249,7 @@ impl Socket { } } + #[cfg(feature = "async-callbacks")] pub(crate) fn handle_packet(&self, packet: Packet) { if let Some(on_packet) = self.on_packet.as_ref() { let on_packet = on_packet.clone(); @@ -228,6 +257,7 @@ impl Socket { } } + #[cfg(feature = "async-callbacks")] pub(crate) fn handle_data(&self, data: Bytes) { if let Some(on_data) = self.on_data.as_ref() { let on_data = on_data.clone(); @@ -235,6 +265,7 @@ impl Socket { } } + #[cfg(feature = "async-callbacks")] pub(crate) fn handle_close(&self) { if let Some(on_close) = self.on_close.as_ref() { let on_close = on_close.clone(); @@ -278,17 +309,22 @@ impl Socket { #[cfg_attr(tarpaulin, ignore)] impl Debug for Socket { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - f.debug_struct("Socket") + let mut debug = f.debug_struct("Socket"); + let debug = debug .field("transport", &self.transport) + .field("connected", &self.connected) + .field("last_ping", &self.last_ping) + .field("last_pong", &self.last_pong) + .field("connection_data", &self.connection_data); + + #[cfg(feature = "async-callbacks")] + debug .field("on_close", &self.on_close) .field("on_data", &self.on_data) .field("on_error", &self.on_error) .field("on_open", &self.on_open) - .field("on_packet", &self.on_packet) - .field("connected", &self.connected) - .field("last_ping", &self.last_ping) - .field("last_pong", &self.last_pong) - .field("connection_data", &self.connection_data) - .finish() + .field("on_packet", &self.on_packet); + + debug.finish() } } diff --git a/engineio/src/asynchronous/async_transports/polling.rs b/engineio/src/asynchronous/async_transports/polling.rs index d88f1e89..96508122 100644 --- a/engineio/src/asynchronous/async_transports/polling.rs +++ b/engineio/src/asynchronous/async_transports/polling.rs @@ -5,7 +5,6 @@ use base64::{engine::general_purpose, Engine as _}; use bytes::{BufMut, Bytes, BytesMut}; use futures_util::{Stream, StreamExt}; use http::HeaderMap; -use native_tls::TlsConnector; use reqwest::{Client, ClientBuilder, Response}; use std::fmt::Debug; use std::time::SystemTime; @@ -15,6 +14,7 @@ use url::Url; use crate::asynchronous::generator::StreamGenerator; use crate::{asynchronous::transport::AsyncTransport, error::Result, Error}; +use crate::TlsConfig; /// An asynchronous polling type. Makes use of the nonblocking reqwest types and /// methods. @@ -28,7 +28,7 @@ pub struct PollingTransport { impl PollingTransport { pub fn new( base_url: Url, - tls_config: Option, + tls_config: Option, opening_headers: Option, ) -> Self { let client = match (tls_config, opening_headers) { diff --git a/engineio/src/asynchronous/async_transports/websocket_secure.rs b/engineio/src/asynchronous/async_transports/websocket_secure.rs index cfd707a0..da13ca68 100644 --- a/engineio/src/asynchronous/async_transports/websocket_secure.rs +++ b/engineio/src/asynchronous/async_transports/websocket_secure.rs @@ -9,7 +9,6 @@ use bytes::Bytes; use futures_util::Stream; use futures_util::StreamExt; use http::HeaderMap; -use native_tls::TlsConnector; use tokio::sync::RwLock; use tokio_tungstenite::connect_async_tls_with_config; use tokio_tungstenite::Connector; @@ -17,6 +16,7 @@ use tungstenite::client::IntoClientRequest; use url::Url; use super::websocket_general::AsyncWebsocketGeneralTransport; +use crate::TlsConfig; /// An asynchronous websocket transport type. /// This type only allows for secure websocket @@ -32,7 +32,7 @@ impl WebsocketSecureTransport { /// Tls connector and an URL. pub(crate) async fn new( base_url: Url, - tls_config: Option, + tls_config: Option, headers: Option, ) -> Result { let mut url = base_url; @@ -56,7 +56,12 @@ impl WebsocketSecureTransport { req, None, /*disable_nagle=*/ false, + #[cfg(all(feature = "_native-tls", not(feature = "_rustls-tls")))] tls_config.map(Connector::NativeTls), + #[cfg(feature = "_rustls-tls")] + tls_config.map(Arc::new).map(Connector::Rustls), + #[cfg(not(any(feature = "_native-tls", feature = "_rustls-tls")))] + None, ) .await?; diff --git a/engineio/src/asynchronous/client/async_client.rs b/engineio/src/asynchronous/client/async_client.rs index 99b0d0dd..8f1b5faa 100644 --- a/engineio/src/asynchronous/client/async_client.rs +++ b/engineio/src/asynchronous/client/async_client.rs @@ -95,7 +95,7 @@ mod test { use crate::{asynchronous::ClientBuilder, header::HeaderMap, packet::PacketId, Error}; use bytes::Bytes; use futures_util::StreamExt; - use native_tls::TlsConnector; + use crate::TlsConfig; use url::Url; /// The purpose of this test is to check whether the Client is properly cloneable or not. @@ -384,7 +384,7 @@ mod test { let _ = builder(url.clone()) .tls_config( - TlsConnector::builder() + TlsConfig::builder() .danger_accept_invalid_certs(true) .build() .unwrap(), diff --git a/engineio/src/asynchronous/client/builder.rs b/engineio/src/asynchronous/client/builder.rs index 50dc9be2..b9bea417 100644 --- a/engineio/src/asynchronous/client/builder.rs +++ b/engineio/src/asynchronous/client/builder.rs @@ -9,10 +9,10 @@ use crate::{ header::HeaderMap, packet::HandshakePacket, Error, Packet, ENGINE_IO_VERSION, + TlsConfig, }; use bytes::Bytes; use futures_util::{future::BoxFuture, StreamExt}; -use native_tls::TlsConnector; use url::Url; use super::Client; @@ -20,7 +20,7 @@ use super::Client; #[derive(Clone, Debug)] pub struct ClientBuilder { url: Url, - tls_config: Option, + tls_config: Option, headers: Option, handshake: Option, on_error: OptionalCallback, @@ -54,7 +54,7 @@ impl ClientBuilder { } /// Specify transport's tls config - pub fn tls_config(mut self, tls_config: TlsConnector) -> Self { + pub fn tls_config(mut self, tls_config: TlsConfig) -> Self { self.tls_config = Some(tls_config); self } diff --git a/engineio/src/asynchronous/transport.rs b/engineio/src/asynchronous/transport.rs index 7d33376f..ca520c8a 100644 --- a/engineio/src/asynchronous/transport.rs +++ b/engineio/src/asynchronous/transport.rs @@ -59,7 +59,6 @@ impl From for AsyncTransportType { } } -#[cfg(feature = "async")] impl AsyncTransportType { pub fn as_transport(&self) -> &(dyn AsyncTransport + Send) { match self { diff --git a/engineio/src/client/client.rs b/engineio/src/client/client.rs index dc22ff77..d04f4dc4 100644 --- a/engineio/src/client/client.rs +++ b/engineio/src/client/client.rs @@ -7,9 +7,8 @@ use crate::error::{Error, Result}; use crate::header::HeaderMap; use crate::packet::{HandshakePacket, Packet, PacketId}; use crate::transports::{PollingTransport, WebsocketSecureTransport, WebsocketTransport}; -use crate::ENGINE_IO_VERSION; +use crate::{ENGINE_IO_VERSION, TlsConfig}; use bytes::Bytes; -use native_tls::TlsConnector; use std::convert::TryFrom; use std::convert::TryInto; use std::fmt::Debug; @@ -30,7 +29,7 @@ pub struct Client { #[derive(Clone, Debug)] pub struct ClientBuilder { url: Url, - tls_config: Option, + tls_config: Option, headers: Option, handshake: Option, on_error: OptionalCallback, @@ -64,7 +63,7 @@ impl ClientBuilder { } /// Specify transport's tls config - pub fn tls_config(mut self, tls_config: TlsConnector) -> Self { + pub fn tls_config(mut self, tls_config: TlsConfig) -> Self { self.tls_config = Some(tls_config); self } @@ -650,7 +649,7 @@ mod test { let _ = builder(url.clone()) .tls_config( - TlsConnector::builder() + TlsConfig::builder() .danger_accept_invalid_certs(true) .build() .unwrap(), diff --git a/engineio/src/lib.rs b/engineio/src/lib.rs index 2ac5787d..467bb12e 100644 --- a/engineio/src/lib.rs +++ b/engineio/src/lib.rs @@ -99,6 +99,22 @@ pub use client::{Client, ClientBuilder}; pub use error::Error; pub use packet::{Packet, PacketId}; +// Re-export TLS configurations to make sockio integration easier +#[cfg(all(feature = "_native-tls", not(feature = "_rustls-tls")))] +#[doc(hidden)] +pub use native_tls::TlsConnector as TlsConfig; +#[doc(hidden)] +#[cfg(feature = "_rustls-tls")] +pub use rustls::ClientConfig as TlsConfig; + +// Both native-tls and rustls is not supported at the same time +#[cfg(not(feature = "_fallback-tls"))] +#[cfg(all(feature = "_native-tls", feature = "_rustls-tls"))] +compile_error!("Both native-tls and rustls features are enabled. Please enable only one of them."); + +#[cfg(not(any(feature = "_native-tls", feature = "_rustls-tls")))] +compile_error!("No TLS feature is enabled. Please enable either native-tls or rustls."); + #[cfg(test)] pub(crate) mod test { use super::*; diff --git a/engineio/src/transports/polling.rs b/engineio/src/transports/polling.rs index 26aee87b..c2c2ffd8 100644 --- a/engineio/src/transports/polling.rs +++ b/engineio/src/transports/polling.rs @@ -1,8 +1,8 @@ use crate::error::{Error, Result}; use crate::transport::Transport; +use crate::TlsConfig; use base64::{engine::general_purpose, Engine as _}; use bytes::{BufMut, Bytes, BytesMut}; -use native_tls::TlsConnector; use reqwest::{ blocking::{Client, ClientBuilder}, header::HeaderMap, @@ -21,7 +21,7 @@ impl PollingTransport { /// Creates an instance of `PollingTransport`. pub fn new( base_url: Url, - tls_config: Option, + tls_config: Option, opening_headers: Option, ) -> Self { let client = match (tls_config, opening_headers) { diff --git a/engineio/src/transports/websocket_secure.rs b/engineio/src/transports/websocket_secure.rs index 345e0880..04fff99f 100644 --- a/engineio/src/transports/websocket_secure.rs +++ b/engineio/src/transports/websocket_secure.rs @@ -6,10 +6,10 @@ use crate::{ error::Result, transport::Transport, Error, + TlsConfig, }; use bytes::Bytes; use http::HeaderMap; -use native_tls::TlsConnector; use std::{sync::Arc, time::Duration}; use tokio::runtime::Runtime; use url::Url; @@ -24,7 +24,7 @@ impl WebsocketSecureTransport { /// Creates an instance of `WebsocketSecureTransport`. pub fn new( base_url: Url, - tls_config: Option, + tls_config: Option, headers: Option, ) -> Result { let runtime = tokio::runtime::Builder::new_current_thread() diff --git a/socketio/Cargo.toml b/socketio/Cargo.toml index 8e9b3deb..7433e05d 100644 --- a/socketio/Cargo.toml +++ b/socketio/Cargo.toml @@ -14,7 +14,7 @@ license = "MIT" all-features = true [dependencies] -rust_engineio = { version = "0.6.0", path = "../engineio" } +rust_engineio = { version = "0.6.0", path = "../engineio", default-features = false} base64 = "0.22.1" bytes = "1" backoff = "0.4" @@ -22,13 +22,15 @@ rand = "0.8.5" adler32 = "1.2.0" serde_json = "1.0" thiserror = "1.0" -native-tls = "0.2.12" url = "2.5.4" tokio = { version = "1.40.0", optional = true } futures-util = { version = "0.3", default-features = false, features = ["sink"], optional = true } async-stream = { version = "0.3.6", optional = true } log = "0.4.22" -serde = "1.0.215" +serde = "1.0.209" +native-tls = { version = "0.2", optional = true } +rustls = { version = "0.23", optional = true } +getrandom = "0.2.10" [dev-dependencies] cargo-tarpaulin = "0.18.5" @@ -40,11 +42,43 @@ version = "1.40.0" features = ["macros", "rt-multi-thread"] [features] -default = [] +default = ["native-tls"] async-callbacks = ["rust_engineio/async-callbacks"] async = ["async-callbacks", "rust_engineio/async", "tokio", "futures-util", "async-stream"] +native-tls = ["rust_engineio/native-tls", "_native-tls"] +native-tls-vendored = ["rust_engineio/native-tls-vendored", "_native-tls"] +rustls-tls-native-roots = ["rust_engineio/rustls-tls-native-roots", "_rustls-tls"] +rustls-tls-webpki-roots = ["rust_engineio/rustls-tls-webpki-roots", "_rustls-tls"] +_native-tls = ["dep:native-tls"] +_rustls-tls = ["dep:rustls"] + +# This is an internal feature to allow us to build using cargo-all-features and guaranteing that we always have one TLS implementation +# Do not use this feature directly +_fallback-tls = ["native-tls", "rust_engineio/_fallback-tls"] [[example]] name = "async" path = "examples/async.rs" -required-features = ["async"] +required-features = ["async", "native-tls"] + +[lints.rust] +unexpected_cfgs = { level = "warn", check-cfg = ['cfg(tarpaulin)'] } + +[package.metadata.cargo-all-features] +skip_optional_dependencies = true +skip_feature_sets = [ + # Don't allow both at once + ["_native-tls", "_rustls-tls"], + # No need to compile with both native-tls options + ["native-tls", "native-tls-vendored"], + # No need to compile with both rustls options + ["rustls-tls-native-roots", "rustls-tls-webpki-roots"], + # Don't compile with both native-tls and rustls + ["native-tls", "rustls-tls-native-roots"], + ["native-tls", "rustls-tls-webpki-roots"], + ["native-tls-vendored", "rustls-tls-native-roots"], + ["native-tls-vendored", "rustls-tls-webpki-roots"], +] +always_include_features = ["_fallback-tls"] +# Don't use the internal features in the build matrix +denylist = ["_native-tls", "_rustls-tls"] diff --git a/socketio/src/asynchronous/client/builder.rs b/socketio/src/asynchronous/client/builder.rs index 1d5f8bbb..8c8da0ae 100644 --- a/socketio/src/asynchronous/client/builder.rs +++ b/socketio/src/asynchronous/client/builder.rs @@ -1,9 +1,9 @@ use futures_util::future::BoxFuture; use log::trace; -use native_tls::TlsConnector; use rust_engineio::{ asynchronous::ClientBuilder as EngineIoClientBuilder, header::{HeaderMap, HeaderValue}, + TlsConfig, }; use std::collections::HashMap; use url::Url; @@ -286,7 +286,7 @@ impl ClientBuilder { /// .await; /// } /// ``` - pub fn tls_config(mut self, tls_config: TlsConnector) -> Self { + pub fn tls_config(mut self, tls_config: TlsConfig) -> Self { self.tls_config = Some(tls_config); self } diff --git a/socketio/src/client/builder.rs b/socketio/src/client/builder.rs index 724971f0..6112f2a1 100644 --- a/socketio/src/client/builder.rs +++ b/socketio/src/client/builder.rs @@ -2,9 +2,9 @@ use super::super::{event::Event, payload::Payload}; use super::callback::Callback; use super::client::Client; use crate::RawClient; -use native_tls::TlsConnector; use rust_engineio::client::ClientBuilder as EngineIoClientBuilder; use rust_engineio::header::{HeaderMap, HeaderValue}; +use rust_engineio::TlsConfig; use url::Url; use crate::client::callback::{SocketAnyCallback, SocketCallback}; @@ -37,7 +37,7 @@ pub struct ClientBuilder { on: Arc>>>, on_any: Arc>>>, namespace: String, - tls_config: Option, + tls_config: Option, opening_headers: Option, transport_type: TransportType, auth: Option, @@ -227,7 +227,7 @@ impl ClientBuilder { /// .connect(); /// /// ``` - pub fn tls_config(mut self, tls_config: TlsConnector) -> Self { + pub fn tls_config(mut self, tls_config: TlsConfig) -> Self { self.tls_config = Some(tls_config); self } From cc3493d9f7d2ac4bc5b773e91d97c63e1555e223 Mon Sep 17 00:00:00 2001 From: Nathan Shaaban <86252985+ctrlaltf24@users.noreply.github.com> Date: Fri, 20 Sep 2024 03:02:52 +0000 Subject: [PATCH 05/15] style: cargo fmt --- engineio/src/asynchronous/async_socket.rs | 21 +++++++------------ .../asynchronous/async_transports/polling.rs | 2 +- .../src/asynchronous/client/async_client.rs | 2 +- engineio/src/asynchronous/client/builder.rs | 3 +-- engineio/src/client/client.rs | 2 +- engineio/src/transports/websocket_secure.rs | 3 +-- 6 files changed, 13 insertions(+), 20 deletions(-) diff --git a/engineio/src/asynchronous/async_socket.rs b/engineio/src/asynchronous/async_socket.rs index 72612e39..42cc101c 100644 --- a/engineio/src/asynchronous/async_socket.rs +++ b/engineio/src/asynchronous/async_socket.rs @@ -12,14 +12,14 @@ use bytes::Bytes; use futures_util::{stream, Stream, StreamExt}; use tokio::{runtime::Handle, sync::Mutex, time::Instant}; +#[cfg(feature = "async-callbacks")] +use super::callback::OptionalCallback; use crate::{ asynchronous::transport::AsyncTransportType, error::Result, packet::{HandshakePacket, Payload}, Error, Packet, PacketId, }; -#[cfg(feature = "async-callbacks")] -use super::callback::OptionalCallback; #[derive(Clone)] pub struct Socket { @@ -48,16 +48,11 @@ impl Socket { pub(crate) fn new( transport: AsyncTransportType, handshake: HandshakePacket, - #[cfg(feature = "async-callbacks")] - on_close: OptionalCallback<()>, - #[cfg(feature = "async-callbacks")] - on_data: OptionalCallback, - #[cfg(feature = "async-callbacks")] - on_error: OptionalCallback, - #[cfg(feature = "async-callbacks")] - on_open: OptionalCallback<()>, - #[cfg(feature = "async-callbacks")] - on_packet: OptionalCallback, + #[cfg(feature = "async-callbacks")] on_close: OptionalCallback<()>, + #[cfg(feature = "async-callbacks")] on_data: OptionalCallback, + #[cfg(feature = "async-callbacks")] on_error: OptionalCallback, + #[cfg(feature = "async-callbacks")] on_open: OptionalCallback<()>, + #[cfg(feature = "async-callbacks")] on_packet: OptionalCallback, ) -> Self { let max_ping_timeout = handshake.ping_interval + handshake.ping_timeout; @@ -324,7 +319,7 @@ impl Debug for Socket { .field("on_error", &self.on_error) .field("on_open", &self.on_open) .field("on_packet", &self.on_packet); - + debug.finish() } } diff --git a/engineio/src/asynchronous/async_transports/polling.rs b/engineio/src/asynchronous/async_transports/polling.rs index 96508122..4aff5954 100644 --- a/engineio/src/asynchronous/async_transports/polling.rs +++ b/engineio/src/asynchronous/async_transports/polling.rs @@ -13,8 +13,8 @@ use tokio::sync::RwLock; use url::Url; use crate::asynchronous::generator::StreamGenerator; -use crate::{asynchronous::transport::AsyncTransport, error::Result, Error}; use crate::TlsConfig; +use crate::{asynchronous::transport::AsyncTransport, error::Result, Error}; /// An asynchronous polling type. Makes use of the nonblocking reqwest types and /// methods. diff --git a/engineio/src/asynchronous/client/async_client.rs b/engineio/src/asynchronous/client/async_client.rs index 8f1b5faa..0d5c9c1c 100644 --- a/engineio/src/asynchronous/client/async_client.rs +++ b/engineio/src/asynchronous/client/async_client.rs @@ -92,10 +92,10 @@ impl Debug for Client { mod test { use super::*; + use crate::TlsConfig; use crate::{asynchronous::ClientBuilder, header::HeaderMap, packet::PacketId, Error}; use bytes::Bytes; use futures_util::StreamExt; - use crate::TlsConfig; use url::Url; /// The purpose of this test is to check whether the Client is properly cloneable or not. diff --git a/engineio/src/asynchronous/client/builder.rs b/engineio/src/asynchronous/client/builder.rs index b9bea417..87228325 100644 --- a/engineio/src/asynchronous/client/builder.rs +++ b/engineio/src/asynchronous/client/builder.rs @@ -8,8 +8,7 @@ use crate::{ error::Result, header::HeaderMap, packet::HandshakePacket, - Error, Packet, ENGINE_IO_VERSION, - TlsConfig, + Error, Packet, TlsConfig, ENGINE_IO_VERSION, }; use bytes::Bytes; use futures_util::{future::BoxFuture, StreamExt}; diff --git a/engineio/src/client/client.rs b/engineio/src/client/client.rs index d04f4dc4..1c82003e 100644 --- a/engineio/src/client/client.rs +++ b/engineio/src/client/client.rs @@ -7,7 +7,7 @@ use crate::error::{Error, Result}; use crate::header::HeaderMap; use crate::packet::{HandshakePacket, Packet, PacketId}; use crate::transports::{PollingTransport, WebsocketSecureTransport, WebsocketTransport}; -use crate::{ENGINE_IO_VERSION, TlsConfig}; +use crate::{TlsConfig, ENGINE_IO_VERSION}; use bytes::Bytes; use std::convert::TryFrom; use std::convert::TryInto; diff --git a/engineio/src/transports/websocket_secure.rs b/engineio/src/transports/websocket_secure.rs index 04fff99f..3291d787 100644 --- a/engineio/src/transports/websocket_secure.rs +++ b/engineio/src/transports/websocket_secure.rs @@ -5,8 +5,7 @@ use crate::{ }, error::Result, transport::Transport, - Error, - TlsConfig, + Error, TlsConfig, }; use bytes::Bytes; use http::HeaderMap; From 5def3656f06bd33eb1df233f360bfef3d47f28de Mon Sep 17 00:00:00 2001 From: Nathan Shaaban <86252985+ctrlaltf24@users.noreply.github.com> Date: Fri, 20 Sep 2024 04:39:12 +0000 Subject: [PATCH 06/15] ci: fix most of the tests There's still an error with ci. engineio/src/lib.rs/test/tls_connector doesn't function the same as native-tls one (as it properly validates hostnames) Needs further investigation as to why the hostname shows as invalid in ci. If we no longer need that, then this PR can be merged. --- .github/workflows/test.yml | 2 +- Cargo.lock | 1520 +++++++---------- engineio/Cargo.toml | 6 +- .../async_transports/websocket_secure.rs | 2 +- engineio/src/client/client.rs | 7 +- engineio/src/lib.rs | 38 +- socketio/Cargo.toml | 7 +- socketio/src/asynchronous/client/builder.rs | 3 +- socketio/src/client/builder.rs | 3 +- socketio/src/client/raw_client.rs | 30 +- socketio/src/lib.rs | 17 + 11 files changed, 728 insertions(+), 907 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c2c0161a..a9fc774a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -55,7 +55,7 @@ jobs: run: cargo test-all-features --verbose --lib --examples - name: Run doc tests - run: cargo test-all-features --verbose --lib --examples --doc + run: cargo test-all-features --verbose --doc - name: Run integration tests run: cargo test --verbose --features "async" --benches --tests diff --git a/Cargo.lock b/Cargo.lock index 83b385c9..8f13f5fd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,18 +4,18 @@ version = 3 [[package]] name = "addr2line" -version = "0.21.0" +version = "0.24.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb" +checksum = "dfbe277e56a376000877090da837660b4427aad530e3028d44e0bffe4f89a1c1" dependencies = [ - "gimli 0.28.1", + "gimli 0.31.1", ] [[package]] -name = "adler" -version = "1.0.2" +name = "adler2" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" +checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627" [[package]] name = "adler32" @@ -25,13 +25,19 @@ checksum = "aae1277d39aeec15cb388266ecc24b11c80469deae6067e17a1a7aa9e5c1f234" [[package]] name = "aho-corasick" -version = "0.7.18" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e37cfd5e7657ada45f742d6e99ca5788580b5c529dc78faf11ece6dc702656f" +checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" dependencies = [ "memchr", ] +[[package]] +name = "android-tzdata" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0" + [[package]] name = "android_system_properties" version = "0.1.5" @@ -58,9 +64,9 @@ dependencies = [ [[package]] name = "anstyle" -version = "1.0.1" +version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a30da5c5f2d5e72842e00bcb57657162cdabef0931f40e2deb9b4140440cecd" +checksum = "55cc3b69f167a1ef2e161439aa98aed94e6028e5f9a59be9a6ffb47aef1651f9" [[package]] name = "async-stream" @@ -81,7 +87,7 @@ checksum = "c7c24de15d275a1ecfd47a380fb4d5ec9bfe0933f309ed5e705b775596a3574d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -92,9 +98,15 @@ checksum = "721cae7de5c34fbb2acd27e21e6d2cf7b886dce0c27388d46c4e6c47ea4318dd" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.90", ] +[[package]] +name = "atomic-waker" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" + [[package]] name = "atty" version = "0.2.14" @@ -108,36 +120,9 @@ dependencies = [ [[package]] name = "autocfg" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" - -[[package]] -name = "aws-lc-rs" -version = "1.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f95446d919226d587817a7d21379e6eb099b97b45110a7f272a444ca5c54070" -dependencies = [ - "aws-lc-sys", - "mirai-annotations", - "paste", - "zeroize", -] - -[[package]] -name = "aws-lc-sys" -version = "0.21.2" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3ddc4a5b231dd6958b140ff3151b6412b3f4321fab354f399eec8f14b06df62" -dependencies = [ - "bindgen", - "cc", - "cmake", - "dunce", - "fs_extra", - "libc", - "paste", -] +checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" [[package]] name = "backoff" @@ -152,17 +137,17 @@ dependencies = [ [[package]] name = "backtrace" -version = "0.3.69" +version = "0.3.74" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2089b7e3f35b9dd2d0ed921ead4f6d318c27680d4a5bd167b3ee120edb105837" +checksum = "8d82cb332cdfaed17ae235a638438ac4d4839913cc2af585c3c6746e8f8bee1a" dependencies = [ "addr2line", - "cc", "cfg-if", "libc", - "miniz_oxide 0.7.2", - "object 0.32.2", + "miniz_oxide", + "object 0.36.5", "rustc-demangle", + "windows-targets", ] [[package]] @@ -171,29 +156,6 @@ version = "0.22.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" -[[package]] -name = "bindgen" -version = "0.69.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a00dc851838a2120612785d195287475a3ac45514741da670b735818822129a0" -dependencies = [ - "bitflags 2.6.0", - "cexpr", - "clang-sys", - "itertools", - "lazy_static", - "lazycell", - "log", - "prettyplease", - "proc-macro2", - "quote", - "regex", - "rustc-hash", - "shlex", - "syn 2.0.89", - "which", -] - [[package]] name = "bitflags" version = "1.3.2" @@ -208,45 +170,45 @@ checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" [[package]] name = "block-buffer" -version = "0.10.2" +version = "0.10.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0bf7fe51849ea569fd452f37822f606a5cabb684dc918707a0193fd4664ff324" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" dependencies = [ "generic-array", ] [[package]] name = "bumpalo" -version = "3.12.0" +version = "3.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d261e256854913907f67ed06efbc3338dfe6179796deefc1ff763fc1aee5535" +checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" [[package]] name = "byteorder" -version = "1.4.3" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "bytes" -version = "1.7.1" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8318a53db07bb3f8dca91a600466bdb3f2eaadeedfdbcf02e1accbad9271ba50" +checksum = "325918d6fe32f23b19878fe4b34794ae41fc19ddbe53b10571a4874d44ffd39b" [[package]] name = "camino" -version = "1.1.2" +version = "1.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c77df041dc383319cc661b428b6961a005db4d6808d5e12536931b1ca9556055" +checksum = "8b96ec4966b5813e2c0507c1f86115c8c5abaadc3980879c3424042a02fd1ad3" dependencies = [ "serde", ] [[package]] name = "cargo-platform" -version = "0.1.2" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cbdb825da8a5df079a43676dbe042702f1707b1109f713a01420fbb4cc71fa27" +checksum = "e35af189006b9c0f00a064685c727031e3ed2d8020f7ba284d78cc2671bd36ea" dependencies = [ "serde", ] @@ -266,7 +228,7 @@ dependencies = [ "gimli 0.26.2", "git2", "humantime-serde", - "indexmap 1.7.0", + "indexmap 1.9.3", "lazy_static", "libc", "memmap", @@ -281,7 +243,7 @@ dependencies = [ "rustc_version", "serde", "serde_json", - "syn 1.0.107", + "syn 1.0.109", "toml", "tracing", "tracing-subscriber", @@ -309,50 +271,46 @@ checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5" [[package]] name = "cc" -version = "1.1.21" +version = "1.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07b1695e2c7e8fc85310cde85aeaab7e3097f593c91d209d3f9df76c928100f0" +checksum = "f34d93e62b03caf570cccc334cbc6c2fceca82f39211051345108adcba3eebdc" dependencies = [ "jobserver", "libc", "shlex", ] -[[package]] -name = "cexpr" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766" -dependencies = [ - "nom", -] - [[package]] name = "cfg-if" version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" +[[package]] +name = "cfg_aliases" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" + [[package]] name = "chrono" -version = "0.4.23" +version = "0.4.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16b0a3d9ed01224b22057780a37bb8c5dbfe1be8ba48678e7bf57ec4b385411f" +checksum = "a21f936df1771bf62b77f047b726c4625ff2e8aa607c01ec06e5a05bd8463401" dependencies = [ + "android-tzdata", "iana-time-zone", "js-sys", - "num-integer", "num-traits", - "time", "wasm-bindgen", - "winapi", + "windows-targets", ] [[package]] name = "ciborium" -version = "0.2.0" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0c137568cc60b904a7724001b35ce2630fd00d5d84805fbb608ab89509d788f" +checksum = "42e69ffd6f0917f5c029256a24d0161db17cea3997d185db0d35926308770f0e" dependencies = [ "ciborium-io", "ciborium-ll", @@ -361,31 +319,20 @@ dependencies = [ [[package]] name = "ciborium-io" -version = "0.2.0" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "346de753af073cc87b52b2083a506b38ac176a44cfb05497b622e27be899b369" +checksum = "05afea1e0a06c9be33d539b876f1ce3692f4afea2cb41f740e7743225ed1c757" [[package]] name = "ciborium-ll" -version = "0.2.0" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "213030a2b5a4e0c0892b6652260cf6ccac84827b83a85a534e178e3906c4cf1b" +checksum = "57663b653d948a338bfb3eeba9bb2fd5fcfaecb9e199e87e1eda4d9e8b240fd9" dependencies = [ "ciborium-io", "half", ] -[[package]] -name = "clang-sys" -version = "1.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b023947811758c97c59bf9d1c188fd619ad4718dcaa767947df1cadb14f39f4" -dependencies = [ - "glob", - "libc", - "libloading", -] - [[package]] name = "clap" version = "2.34.0" @@ -403,18 +350,18 @@ dependencies = [ [[package]] name = "clap" -version = "4.3.10" +version = "4.5.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "384e169cc618c613d5e3ca6404dda77a8685a63e08660dcc64abaf7da7cb0c7a" +checksum = "fb3b4b9e5a7c7514dfa52869339ee98b3156b0bfb4e8a77c4ff4babb64b1604f" dependencies = [ "clap_builder", ] [[package]] name = "clap_builder" -version = "4.3.10" +version = "4.5.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef137bbe35aab78bdb468ccfba75a5f4d8321ae011d34063770780545176af2d" +checksum = "b17a95aa67cc7b5ebd32aa5370189aa0d79069ef1c64ce893bd30fb24bff20ec" dependencies = [ "anstyle", "clap_lex", @@ -422,34 +369,15 @@ dependencies = [ [[package]] name = "clap_lex" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2da6da31387c7e4ef160ffab6d5e7f00c42626fe39aea70a7b0f1773f7dd6c1b" - -[[package]] -name = "cmake" -version = "0.1.51" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb1e43aa7fd152b1f968787f7dbcdeb306d1867ff373c69955211876c053f91a" -dependencies = [ - "cc", -] - -[[package]] -name = "codespan-reporting" -version = "0.11.1" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3538270d33cc669650c4b093848450d380def10c331d38c768e34cac80576e6e" -dependencies = [ - "termcolor", - "unicode-width", -] +checksum = "afb84c814227b90d6895e01398aee0d8033c00e7466aca416fb6a8e0eb19d8a7" [[package]] name = "core-foundation" -version = "0.9.3" +version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "194a7a9e6de53fa55116934067c844d9d749312f75c6f6d0980e8c252f8c2146" +checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" dependencies = [ "core-foundation-sys", "libc", @@ -457,9 +385,9 @@ dependencies = [ [[package]] name = "core-foundation-sys" -version = "0.8.3" +version = "0.8.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc" +checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" [[package]] name = "coveralls-api" @@ -477,18 +405,18 @@ dependencies = [ [[package]] name = "cpufeatures" -version = "0.2.1" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95059428f66df56b63431fdb4e1947ed2190586af5c5a8a8b71122bdf5a7f469" +checksum = "16b80225097f2e5ae4e7179dd2266824648f3e2f49d9134d584b76389d31c4c3" dependencies = [ "libc", ] [[package]] name = "crc32fast" -version = "1.3.2" +version = "1.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d" +checksum = "a97769d94ddab943e4510d138150169a2758b5ef3eb191a9ee688de3e23ef7b3" dependencies = [ "cfg-if", ] @@ -502,7 +430,7 @@ dependencies = [ "anes", "cast", "ciborium", - "clap 4.3.10", + "clap 4.5.21", "criterion-plot", "futures", "is-terminal", @@ -531,54 +459,42 @@ dependencies = [ "itertools", ] -[[package]] -name = "crossbeam-channel" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06ed27e177f16d65f0f0c22a213e17c696ace5dd64b14258b52f9417ccb52db4" -dependencies = [ - "cfg-if", - "crossbeam-utils", -] - [[package]] name = "crossbeam-deque" -version = "0.8.1" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6455c0ca19f0d2fbf751b908d5c55c1f5cbc65e03c4225427254b46890bdde1e" +checksum = "613f8cc01fe9cf1a3eb3d7f488fd2fa8388403e97039e2f73692932e291a770d" dependencies = [ - "cfg-if", "crossbeam-epoch", "crossbeam-utils", ] [[package]] name = "crossbeam-epoch" -version = "0.9.5" +version = "0.9.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ec02e091aa634e2c3ada4a392989e7c3116673ef0ac5b72232439094d73b7fd" +checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" dependencies = [ - "cfg-if", "crossbeam-utils", - "lazy_static", - "memoffset", - "scopeguard", ] [[package]] name = "crossbeam-utils" -version = "0.8.12" +version = "0.8.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "edbafec5fa1f196ca66527c1b12c2ec4745ca14b50f1ad8f9f6f720b55d11fac" -dependencies = [ - "cfg-if", -] +checksum = "22ec99545bb0ed0ea7bb9b8e1e9122ea386ff8a48c0922e43f36d45ab09e0e80" + +[[package]] +name = "crunchy" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" [[package]] name = "crypto-common" -version = "0.1.3" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57952ca27b5e3606ff4dd79b0020231aaf9d6aa76dc05fd30137538c50bd3ce8" +checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" dependencies = [ "generic-array", "typenum", @@ -586,24 +502,24 @@ dependencies = [ [[package]] name = "curl" -version = "0.4.44" +version = "0.4.47" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "509bd11746c7ac09ebd19f0b17782eae80aadee26237658a6b4808afb5c11a22" +checksum = "d9fb4d13a1be2b58f14d60adba57c9834b78c62fd86c3e76a148f732686e9265" dependencies = [ "curl-sys", "libc", "openssl-probe", "openssl-sys", "schannel", - "socket2 0.4.10", - "winapi", + "socket2", + "windows-sys 0.52.0", ] [[package]] name = "curl-sys" -version = "0.4.59+curl-7.86.0" +version = "0.4.78+curl-8.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6cfce34829f448b08f55b7db6d0009e23e2e86a34e8c2b366269bf5799b4a407" +checksum = "8eec768341c5c7789611ae51cf6c459099f22e64a5d5d0ce4892434e33821eaf" dependencies = [ "cc", "libc", @@ -611,69 +527,14 @@ dependencies = [ "openssl-sys", "pkg-config", "vcpkg", - "winapi", -] - -[[package]] -name = "cxx" -version = "1.0.86" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51d1075c37807dcf850c379432f0df05ba52cc30f279c5cfc43cc221ce7f8579" -dependencies = [ - "cc", - "cxxbridge-flags", - "cxxbridge-macro", - "link-cplusplus", -] - -[[package]] -name = "cxx-build" -version = "1.0.62" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b49af8e551e84f85d6def97c42b8d93bc5bb0817cce96b56a472b1b19b5bfc2" -dependencies = [ - "cc", - "codespan-reporting", - "lazy_static", - "proc-macro2", - "quote", - "scratch", - "syn 1.0.107", -] - -[[package]] -name = "cxxbridge-flags" -version = "1.0.86" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61b50bc93ba22c27b0d31128d2d130a0a6b3d267ae27ef7e4fae2167dfe8781c" - -[[package]] -name = "cxxbridge-macro" -version = "1.0.86" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39e61fda7e62115119469c7b3591fd913ecca96fb766cfd3f2e2502ab7bc87a5" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.107", -] - -[[package]] -name = "dashmap" -version = "5.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c8858831f7781322e539ea39e72449c46b059638250c14344fec8d0aa6e539c" -dependencies = [ - "cfg-if", - "num_cpus", - "parking_lot", + "windows-sys 0.52.0", ] [[package]] name = "data-encoding" -version = "2.4.0" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2e66c9d817f1720209181c316d28635c050fa304f9c79e47a520882661b7308" +checksum = "e8566979429cf69b49a5c740c60791108e86440e8be149bbea4fe54d2c32d6e2" [[package]] name = "deflate" @@ -704,26 +565,20 @@ checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.90", ] -[[package]] -name = "dunce" -version = "1.0.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92773504d58c093f6de2459af4af33faa518c13451eb8f2b5698ed3d36e7c813" - [[package]] name = "either" -version = "1.6.1" +version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" +checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" [[package]] name = "encoding_rs" -version = "0.8.29" +version = "0.8.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a74ea89a0a1b98f6332de42c95baff457ada66d1cb4030f9ff151b2041a1c746" +checksum = "75030f3c4f45dafd7586dd6780965a8c7e8e285a5ecb86713e63a79c5b2766f3" dependencies = [ "cfg-if", ] @@ -736,23 +591,12 @@ checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" [[package]] name = "errno" -version = "0.3.1" +version = "0.3.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4bcfec3a70f97c962c307b2d2c56e358cf1d00b558d74262b5f929ee8cc7e73a" +checksum = "33d852cb9b869c2a9b3df2f71a3074817f01e1844f839a144f5fcef059a4eb5d" dependencies = [ - "errno-dragonfly", - "libc", - "windows-sys 0.48.0", -] - -[[package]] -name = "errno-dragonfly" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf" -dependencies = [ - "cc", "libc", + "windows-sys 0.59.0", ] [[package]] @@ -763,21 +607,18 @@ checksum = "4443176a9f2c162692bd3d352d745ef9413eec5782a80d8fd6f8a1ac692a07f7" [[package]] name = "fastrand" -version = "1.9.0" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e51093e27b0797c359783294ca4f0a911c270184cb10f85783b118614a1501be" -dependencies = [ - "instant", -] +checksum = "486f806e73c5707928240ddc295403b1b93c96a02038563881c4a2fd84b81ac4" [[package]] name = "flate2" -version = "1.0.25" +version = "1.0.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8a2db397cb1c8772f31494cb8917e48cd1e64f0fa7efac59fbd741a0a8ce841" +checksum = "c936bfdafb507ebbf50b8074c54fa31c5be9a1e7e5f467dd659697041407d07c" dependencies = [ "crc32fast", - "miniz_oxide 0.6.2", + "miniz_oxide", ] [[package]] @@ -810,17 +651,11 @@ dependencies = [ "percent-encoding", ] -[[package]] -name = "fs_extra" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42703706b716c37f96a77aea830392ad231f44c9e9a67872fa5548707e11b11c" - [[package]] name = "futures" -version = "0.3.17" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a12aa0eb539080d55c3f2d45a67c3b58b6b0773c1a3ca2dfec66d58c97fd66ca" +checksum = "65bc07b1a8bc7c85c5f2e110c476c7389b4554ba72af57d8445ea63a576b0876" dependencies = [ "futures-channel", "futures-core", @@ -849,9 +684,9 @@ checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" [[package]] name = "futures-executor" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a576fc72ae164fca6b9db127eaa9a9dda0d61316034f33a0a0d4eda41f02b01d" +checksum = "1e28d1d997f585e54aebc3f97d39e72338912123a67330d723fdbb564d646c9f" dependencies = [ "futures-core", "futures-task", @@ -872,7 +707,7 @@ checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -907,9 +742,9 @@ dependencies = [ [[package]] name = "generic-array" -version = "0.14.5" +version = "0.14.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd48d33ec7f05fbfa152300fdad764757cbded343c1aa1cff2fbaf4134851803" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" dependencies = [ "typenum", "version_check", @@ -922,8 +757,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" dependencies = [ "cfg-if", + "js-sys", "libc", "wasi", + "wasm-bindgen", ] [[package]] @@ -933,15 +770,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "22030e2c5a68ec659fde1e949a745124b48e6fa8b045b7ed5bd1fe4ccc5c4e5d" dependencies = [ "fallible-iterator", - "indexmap 1.7.0", + "indexmap 1.9.3", "stable_deref_trait", ] [[package]] name = "gimli" -version = "0.28.1" +version = "0.31.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" +checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f" [[package]] name = "git2" @@ -958,12 +795,6 @@ dependencies = [ "url", ] -[[package]] -name = "glob" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" - [[package]] name = "gzip-header" version = "0.3.0" @@ -975,17 +806,17 @@ dependencies = [ [[package]] name = "h2" -version = "0.4.4" +version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "816ec7294445779408f36fe57bc5b7fc1cf59664059096c65f905c1c61f58069" +checksum = "ccae279728d634d083c00f6099cb58f01cc99c145b84b8be2f6c74618d79922e" dependencies = [ + "atomic-waker", "bytes", "fnv", "futures-core", "futures-sink", - "futures-util", "http", - "indexmap 2.1.0", + "indexmap 2.7.0", "slab", "tokio", "tokio-util", @@ -994,21 +825,25 @@ dependencies = [ [[package]] name = "half" -version = "1.8.1" +version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3bd566f08830dd1fa75b2a5f1d8def8336de7f08b2692a9a71efbe7188aea36f" +checksum = "6dd08c532ae367adf81c312a4580bc67f1d0fe8bc9c460520283f4c0ff277888" +dependencies = [ + "cfg-if", + "crunchy", +] [[package]] name = "hashbrown" -version = "0.11.2" +version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e" +checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" [[package]] name = "hashbrown" -version = "0.14.3" +version = "0.15.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" +checksum = "bf151400ff0baff5465007dd2f3e717f3fe502074ca563069ce3a6629d07b289" [[package]] name = "hermit-abi" @@ -1021,9 +856,9 @@ dependencies = [ [[package]] name = "hermit-abi" -version = "0.3.9" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" +checksum = "fbf6a919d6cf397374f7dfeeea91d974c7c0a7221d0d0f4f20d859d329e53fcc" [[package]] name = "hex" @@ -1031,15 +866,6 @@ version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" -[[package]] -name = "home" -version = "0.5.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3d1354bf6b7235cb4a0576c2619fd4ed18183f689b12b006a0ee7329eeff9a5" -dependencies = [ - "windows-sys 0.52.0", -] - [[package]] name = "http" version = "1.1.0" @@ -1053,9 +879,9 @@ dependencies = [ [[package]] name = "http-body" -version = "1.0.0" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1cac85db508abc24a2e48553ba12a996e87244a0395ce011e62b37158745d643" +checksum = "1efedce1fb8e6913f23e0c92de8e62cd5b772a67e7b3946df930a62566c93184" dependencies = [ "bytes", "http", @@ -1063,12 +889,12 @@ dependencies = [ [[package]] name = "http-body-util" -version = "0.1.1" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0475f8b2ac86659c21b64320d5d653f9efe42acd2a4e560073ec61a155a34f1d" +checksum = "793429d76616a256bcb62c2a2ec2bed781c8307e797e2598c50010f2bee2544f" dependencies = [ "bytes", - "futures-core", + "futures-util", "http", "http-body", "pin-project-lite", @@ -1076,9 +902,9 @@ dependencies = [ [[package]] name = "httparse" -version = "1.8.0" +version = "1.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" +checksum = "7d71d3574edd2771538b901e6549113b4006ece66150fb69c0fb6d9a2adae946" [[package]] name = "humantime" @@ -1098,9 +924,9 @@ dependencies = [ [[package]] name = "hyper" -version = "1.3.0" +version = "1.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f24ce812868d86d19daa79bf3bf9175bc44ea323391147a5e3abde2a283871b" +checksum = "97818827ef4f364230e16705d4706e2897df2bb60617d6ca15d598025a3c481f" dependencies = [ "bytes", "futures-channel", @@ -1118,19 +944,20 @@ dependencies = [ [[package]] name = "hyper-rustls" -version = "0.26.0" +version = "0.27.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0bea761b46ae2b24eb4aef630d8d1c398157b6fc29e6350ecf090a0b70c952c" +checksum = "08afdbb5c31130e3034af566421053ab03787c640246a446327f550d11bcb333" dependencies = [ "futures-util", "http", "hyper", "hyper-util", - "rustls 0.22.4", + "rustls 0.23.19", "rustls-pki-types", "tokio", - "tokio-rustls", + "tokio-rustls 0.26.0", "tower-service", + "webpki-roots", ] [[package]] @@ -1151,9 +978,9 @@ dependencies = [ [[package]] name = "hyper-util" -version = "0.1.3" +version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca38ef113da30126bbff9cd1705f9273e15d45498615d138b0c20279ac7a76aa" +checksum = "df2dcfbe0677734ab2f3ffa7fa7bfd4706bfdc1ef393f2ee30184aed67e631b4" dependencies = [ "bytes", "futures-channel", @@ -1162,35 +989,33 @@ dependencies = [ "http-body", "hyper", "pin-project-lite", - "socket2 0.5.5", + "socket2", "tokio", - "tower", "tower-service", "tracing", ] [[package]] name = "iana-time-zone" -version = "0.1.53" +version = "0.1.61" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64c122667b287044802d6ce17ee2ddf13207ed924c712de9a66a5814d5b64765" +checksum = "235e081f3925a06703c2d0117ea8b91f042756fd6e7a6e5d901e8ca1a996b220" dependencies = [ "android_system_properties", "core-foundation-sys", "iana-time-zone-haiku", "js-sys", "wasm-bindgen", - "winapi", + "windows-core", ] [[package]] name = "iana-time-zone-haiku" -version = "0.1.1" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0703ae284fc167426161c2e3f1da3ea71d94b21bedbcc9494e92b28e334e3dca" +checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" dependencies = [ - "cxx", - "cxx-build", + "cc", ] [[package]] @@ -1308,7 +1133,7 @@ checksum = "1ec89e9337638ecdc08744df490b221a7399bf8d164eb52a665454e60e075ad6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -1334,76 +1159,65 @@ dependencies = [ [[package]] name = "indexmap" -version = "1.7.0" +version = "1.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc633605454125dec4b66843673f01c7df2b89479b32e0ed634e43a91cff62a5" +checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" dependencies = [ "autocfg", - "hashbrown 0.11.2", + "hashbrown 0.12.3", "serde", ] [[package]] name = "indexmap" -version = "2.1.0" +version = "2.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d530e1a18b1cb4c484e6e34556a0d948706958449fca0cab753d649f2bce3d1f" +checksum = "62f822373a4fe84d4bb149bf54e584a7f4abec90e072ed49cda0edea5b95471f" dependencies = [ "equivalent", - "hashbrown 0.14.3", + "hashbrown 0.15.2", ] [[package]] name = "instant" -version = "0.1.12" +version = "0.1.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" +checksum = "e0242819d153cba4b4b05a5a8f2a7e9bbf97b6055b2a002b395c96b5ff3c0222" dependencies = [ "cfg-if", ] -[[package]] -name = "io-lifetimes" -version = "1.0.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eae7b9aee968036d54dce06cebaefd919e4472e753296daccd6d344e3e2df0c2" -dependencies = [ - "hermit-abi 0.3.9", - "libc", - "windows-sys 0.48.0", -] - [[package]] name = "ipnet" -version = "2.3.1" +version = "2.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68f2d64f2edebec4ce84ad108148e67e1064789bee435edc5b60ad398714a3a9" +checksum = "ddc24109865250148c2e0f3d25d4f0f479571723792d3802153c60922a4fb708" [[package]] name = "is-terminal" -version = "0.4.8" +version = "0.4.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24fddda5af7e54bf7da53067d6e802dbcc381d0a8eef629df528e3ebf68755cb" +checksum = "261f68e344040fbd0edea105bef17c66edf46f984ddb1115b775ce31be948f4b" dependencies = [ - "hermit-abi 0.3.9", - "rustix 0.38.25", - "windows-sys 0.48.0", + "hermit-abi 0.4.0", + "libc", + "windows-sys 0.52.0", ] [[package]] name = "itertools" -version = "0.10.1" +version = "0.10.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69ddb889f9d0d08a67338271fa9b62996bc788c7796a5c18cf057420aaed5eaf" +checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" dependencies = [ "either", ] [[package]] name = "itoa" -version = "1.0.1" +version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1aab8fc367588b89dcee83ab0fd66b72b50b72fa1904d7095045ace2b0c81c35" +checksum = "d75a2a4b1b190afb6f5425f10f6a8f959d2ea0b9c2b1d79553551850539e4674" [[package]] name = "jobserver" @@ -1416,30 +1230,25 @@ dependencies = [ [[package]] name = "js-sys" -version = "0.3.69" +version = "0.3.74" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29c15563dc2726973df627357ce0c9ddddbea194836909d655df6a75d2cf296d" +checksum = "a865e038f7f6ed956f788f0d7d60c541fff74c7bd74272c5d4cf15c63743e705" dependencies = [ + "once_cell", "wasm-bindgen", ] [[package]] name = "lazy_static" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" - -[[package]] -name = "lazycell" -version = "1.3.0" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" +checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" [[package]] name = "libc" -version = "0.2.158" +version = "0.2.167" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8adc4bb1803a324070e64a98ae98f38934d91957a99cfb3a43dcbc01bc56439" +checksum = "09d6582e104315a817dff97f75133544b2e094ee22447d2acf4a74e189ba06fc" [[package]] name = "libgit2-sys" @@ -1455,16 +1264,6 @@ dependencies = [ "pkg-config", ] -[[package]] -name = "libloading" -version = "0.8.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4979f22fdb869068da03c9f7528f8297c6fd2606bc3a4affe42e6a823fdb8da4" -dependencies = [ - "cfg-if", - "windows-targets 0.52.6", -] - [[package]] name = "libssh2-sys" version = "0.2.23" @@ -1481,9 +1280,9 @@ dependencies = [ [[package]] name = "libz-sys" -version = "1.1.8" +version = "1.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9702761c3935f8cc2f101793272e202c72b99da8f4224a19ddcf1279a6450bbf" +checksum = "d2d16453e800a8cf6dd2fc3eb4bc99b786a9b90c663b8559a5b1a041bf89e472" dependencies = [ "cc", "libc", @@ -1491,21 +1290,6 @@ dependencies = [ "vcpkg", ] -[[package]] -name = "link-cplusplus" -version = "1.0.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ecd207c9c713c34f95a097a5b029ac2ce6010530c7b49d7fea24d977dede04f5" -dependencies = [ - "cc", -] - -[[package]] -name = "linux-raw-sys" -version = "0.3.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519" - [[package]] name = "linux-raw-sys" version = "0.4.14" @@ -1520,10 +1304,11 @@ checksum = "4ee93343901ab17bd981295f2cf0026d4ad018c7c31ba84549a4ddbb47a45104" [[package]] name = "lock_api" -version = "0.4.6" +version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88943dd7ef4a2e5a4bfa2753aaab3013e34ce2533d1996fb18ef591e315e2b3b" +checksum = "07af8b9cdd281b7915f413fa73f29ebd5d55d0d3f0155584dade1ff18cea1b17" dependencies = [ + "autocfg", "scopeguard", ] @@ -1539,7 +1324,7 @@ version = "0.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f099785f7595cc4b4553a174ce30dd7589ef93391ff414dbb67f62392b9e0ce1" dependencies = [ - "regex-automata", + "regex-automata 0.1.10", ] [[package]] @@ -1550,9 +1335,9 @@ checksum = "490cc448043f947bae3cbee9c203358d62dbee0db12107a74be5c30ccfd09771" [[package]] name = "memchr" -version = "2.4.1" +version = "2.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a" +checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" [[package]] name = "memmap" @@ -1566,61 +1351,39 @@ dependencies = [ [[package]] name = "memoffset" -version = "0.6.4" +version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59accc507f1338036a0477ef61afdae33cde60840f4dfe481319ce3ad116ddf9" +checksum = "5aa361d4faea93603064a027415f07bd8e1d5c88c9fbf68bf56a285428fd79ce" dependencies = [ "autocfg", ] [[package]] name = "mime" -version = "0.3.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a60c7ce501c71e03a9c9c0d35b861413ae925bd979cc7a4e30d060069aaac8d" - -[[package]] -name = "minimal-lexical" -version = "0.2.1" +version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" +checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" [[package]] name = "miniz_oxide" -version = "0.6.2" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b275950c28b37e794e8c55d88aeb5e139d0ce23fdbbeda68f8d7174abdf9e8fa" +checksum = "e2d80299ef12ff69b16a84bb182e3b9df68b5a91574d3d4fa6e41b65deec4df1" dependencies = [ - "adler", -] - -[[package]] -name = "miniz_oxide" -version = "0.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d811f3e15f28568be3407c8e7fdb6514c1cda3cb30683f15b6a1a1dc4ea14a7" -dependencies = [ - "adler", + "adler2", ] [[package]] name = "mio" -version = "1.0.2" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80e04d1dcff3aae0704555fe5fee3bcfaf3d1fdf8a7e521d5b9d2b42acb52cec" +checksum = "2886843bf800fba2e3377cff24abf6379b4c4d5c6681eaf9ea5b0d15090450bd" dependencies = [ - "hermit-abi 0.3.9", "libc", "wasi", "windows-sys 0.52.0", ] -[[package]] -name = "mirai-annotations" -version = "1.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9be0862c1b3f26a88803c4a49de6889c10e608b3ee9344e6ef5b45fb37ad3d1" - [[package]] name = "native-tls" version = "0.2.12" @@ -1651,45 +1414,15 @@ dependencies = [ "memoffset", ] -[[package]] -name = "nom" -version = "7.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" -dependencies = [ - "memchr", - "minimal-lexical", -] - -[[package]] -name = "num-integer" -version = "0.1.45" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" -dependencies = [ - "autocfg", - "num-traits", -] - [[package]] name = "num-traits" -version = "0.2.14" +version = "0.2.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a64b1ec5cda2586e284722486d802acf1f7dbdc623e2bfc57e65ca1cd099290" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" dependencies = [ "autocfg", ] -[[package]] -name = "num_cpus" -version = "1.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" -dependencies = [ - "hermit-abi 0.3.9", - "libc", -] - [[package]] name = "object" version = "0.24.0" @@ -1701,30 +1434,30 @@ dependencies = [ [[package]] name = "object" -version = "0.32.2" +version = "0.36.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6a622008b6e321afc04970976f62ee297fdbaa6f95318ca343e3eebb9648441" +checksum = "aedf0a2d09c573ed1d8d85b30c119153926a2b36dce0ab28322c09a117a4683e" dependencies = [ "memchr", ] [[package]] name = "once_cell" -version = "1.18.0" +version = "1.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" +checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775" [[package]] name = "oorandom" -version = "11.1.3" +version = "11.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ab1bc2a289d34bd04a330323ac98a1b4bc82c9d9fcb1e66b63caa84da26b575" +checksum = "b410bbe7e14ab526a0e86877eb47c6996a2bd7746f027ba551028c925390e4e9" [[package]] name = "openssl" -version = "0.10.66" +version = "0.10.68" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9529f4786b70a3e8c61e11179af17ab6188ad8d0ded78c5529441ed39d4bd9c1" +checksum = "6174bc48f102d208783c2c84bf931bb75927a617866870de8a4ea85597f871f5" dependencies = [ "bitflags 2.6.0", "cfg-if", @@ -1743,29 +1476,29 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] name = "openssl-probe" -version = "0.1.4" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28988d872ab76095a6e6ac88d99b54fd267702734fd7ffe610ca27f533ddb95a" +checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" [[package]] name = "openssl-src" -version = "300.3.2+3.3.2" +version = "300.4.1+3.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a211a18d945ef7e648cc6e0058f4c548ee46aab922ea203e0d30e966ea23647b" +checksum = "faa4eac4138c62414b5622d1b31c5c304f34b406b013c079c2bbc652fdd6678c" dependencies = [ "cc", ] [[package]] name = "openssl-sys" -version = "0.9.103" +version = "0.9.104" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f9e8deee91df40a943c71b917e5874b951d32a802526c85721ce3b776c929d6" +checksum = "45abf306cbf99debc8195b66b7346498d7b10c210de50418b5ccd7ceba08c741" dependencies = [ "cc", "libc", @@ -1776,9 +1509,9 @@ dependencies = [ [[package]] name = "parking_lot" -version = "0.12.1" +version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" +checksum = "f1bf18183cf54e8d6059647fc3063646a1801cf30896933ec2311622cc4b9a27" dependencies = [ "lock_api", "parking_lot_core", @@ -1786,54 +1519,28 @@ dependencies = [ [[package]] name = "parking_lot_core" -version = "0.9.9" +version = "0.9.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c42a9226546d68acdd9c0a280d17ce19bfe27a46bf68784e4066115788d008e" +checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8" dependencies = [ "cfg-if", "libc", - "redox_syscall 0.4.1", + "redox_syscall", "smallvec", - "windows-targets 0.48.0", + "windows-targets", ] -[[package]] -name = "paste" -version = "1.0.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" - [[package]] name = "percent-encoding" version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" -[[package]] -name = "pin-project" -version = "1.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6bf43b791c5b9e34c3d182969b4abb522f9343702850a2e57f460d00d09b4b3" -dependencies = [ - "pin-project-internal", -] - -[[package]] -name = "pin-project-internal" -version = "1.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.89", -] - [[package]] name = "pin-project-lite" -version = "0.2.13" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58" +checksum = "915a1e146535de9163f3987b8944ed8cf49a18bb0056bcebcdcece385cece4ff" [[package]] name = "pin-utils" @@ -1843,15 +1550,15 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] name = "pkg-config" -version = "0.3.20" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c9b1041b4387893b91ee6746cddfc28516aff326a3519fb2adf820932c5e6cb" +checksum = "953ec861398dccce10c670dfeaf3ec4911ca479e9c02154b3a215178c5f566f2" [[package]] name = "plotters" -version = "0.3.1" +version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32a3fd9ec30b9749ce28cd91f255d569591cdf937fe280c312143e3c4bad6f2a" +checksum = "5aeb6f403d7a4911efb1e33402027fc44f29b5bf6def3effcc22d7bb75f2b747" dependencies = [ "num-traits", "plotters-backend", @@ -1862,33 +1569,26 @@ dependencies = [ [[package]] name = "plotters-backend" -version = "0.3.2" +version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d88417318da0eaf0fdcdb51a0ee6c3bed624333bff8f946733049380be67ac1c" +checksum = "df42e13c12958a16b3f7f4386b9ab1f3e7933914ecea48da7139435263a4172a" [[package]] name = "plotters-svg" -version = "0.3.1" +version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "521fa9638fa597e1dc53e9412a4f9cefb01187ee1f7413076f9e6749e2885ba9" +checksum = "51bae2ac328883f7acdfea3d66a7c35751187f870bc81f94563733a154d7a670" dependencies = [ "plotters-backend", ] [[package]] name = "ppv-lite86" -version = "0.2.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3ca011bd0129ff4ae15cd04c4eef202cadf6c51c21e47aba319b4e0501db741" - -[[package]] -name = "prettyplease" -version = "0.2.17" +version = "0.2.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d3928fb5db768cb86f891ff014f0144589297e3c6a1aba6ed7cecfdace270c7" +checksum = "77957b295656769bb8ad2b6a6b09d897d94f05c41b069aede1fcdaa675eaea04" dependencies = [ - "proc-macro2", - "syn 2.0.89", + "zerocopy", ] [[package]] @@ -1924,11 +1624,63 @@ dependencies = [ "memchr", ] +[[package]] +name = "quinn" +version = "0.11.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62e96808277ec6f97351a2380e6c25114bc9e67037775464979f3037c92d05ef" +dependencies = [ + "bytes", + "pin-project-lite", + "quinn-proto", + "quinn-udp", + "rustc-hash", + "rustls 0.23.19", + "socket2", + "thiserror 2.0.3", + "tokio", + "tracing", +] + +[[package]] +name = "quinn-proto" +version = "0.11.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2fe5ef3495d7d2e377ff17b1a8ce2ee2ec2a18cde8b6ad6619d65d0701c135d" +dependencies = [ + "bytes", + "getrandom", + "rand", + "ring 0.17.8", + "rustc-hash", + "rustls 0.23.19", + "rustls-pki-types", + "slab", + "thiserror 2.0.3", + "tinyvec", + "tracing", + "web-time", +] + +[[package]] +name = "quinn-udp" +version = "0.5.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d5a626c6807713b15cac82a6acaccd6043c9a5408c24baae07611fec3f243da" +dependencies = [ + "cfg_aliases", + "libc", + "once_cell", + "socket2", + "tracing", + "windows-sys 0.59.0", +] + [[package]] name = "quote" -version = "1.0.35" +version = "1.0.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef" +checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" dependencies = [ "proc-macro2", ] @@ -1956,65 +1708,52 @@ dependencies = [ [[package]] name = "rand_core" -version = "0.6.3" +version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d34f1408f55294453790c48b2f1ebbb1c5b4b7563eb1f418bcfcfdbb06ebb4e7" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" dependencies = [ "getrandom", ] [[package]] name = "rayon" -version = "1.5.1" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c06aca804d41dbc8ba42dfd964f0d01334eceb64314b9ecf7c5fad5188a06d90" +checksum = "b418a60154510ca1a002a752ca9714984e21e4241e804d32555251faf8b78ffa" dependencies = [ - "autocfg", - "crossbeam-deque", "either", "rayon-core", ] [[package]] name = "rayon-core" -version = "1.9.1" +version = "1.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d78120e2c850279833f1dd3582f730c4ab53ed95aeaaaa862a2a5c71b1656d8e" +checksum = "1465873a3dfdaa8ae7cb14b4383657caab0b3e8a0aa9ae8e04b044854c8dfce2" dependencies = [ - "crossbeam-channel", "crossbeam-deque", "crossbeam-utils", - "lazy_static", - "num_cpus", -] - -[[package]] -name = "redox_syscall" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29" -dependencies = [ - "bitflags 1.3.2", ] [[package]] name = "redox_syscall" -version = "0.4.1" +version = "0.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" +checksum = "9b6dfecf2c74bce2466cabf93f6664d6998a69eb21e39f4207930065b27b771f" dependencies = [ - "bitflags 1.3.2", + "bitflags 2.6.0", ] [[package]] name = "regex" -version = "1.7.3" +version = "1.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b1f693b24f6ac912f4893ef08244d70b6067480d2f1a46e950c9691e6749d1d" +checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191" dependencies = [ "aho-corasick", "memchr", - "regex-syntax", + "regex-automata 0.4.9", + "regex-syntax 0.8.5", ] [[package]] @@ -2023,7 +1762,18 @@ version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132" dependencies = [ - "regex-syntax", + "regex-syntax 0.6.29", +] + +[[package]] +name = "regex-automata" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax 0.8.5", ] [[package]] @@ -2032,11 +1782,17 @@ version = "0.6.29" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" +[[package]] +name = "regex-syntax" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" + [[package]] name = "reqwest" -version = "0.12.4" +version = "0.12.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "566cafdd92868e0939d3fb961bd0dc25fcfaaed179291093b3d43e6b3150ea10" +checksum = "a77c62af46e79de0a562e1a9849205ffcb7fc1238876e9bd743357570e04046f" dependencies = [ "base64", "bytes", @@ -2060,7 +1816,8 @@ dependencies = [ "once_cell", "percent-encoding", "pin-project-lite", - "rustls 0.22.4", + "quinn", + "rustls 0.23.19", "rustls-pemfile", "rustls-pki-types", "serde", @@ -2070,7 +1827,7 @@ dependencies = [ "system-configuration", "tokio", "tokio-native-tls", - "tokio-rustls", + "tokio-rustls 0.26.0", "tokio-util", "tower-service", "url", @@ -2079,7 +1836,22 @@ dependencies = [ "wasm-streams", "web-sys", "webpki-roots", - "winreg", + "windows-registry", +] + +[[package]] +name = "ring" +version = "0.16.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3053cf52e236a3ed746dfc745aa9cacf1b791d846bdaf412f60a8d7d6e17c8fc" +dependencies = [ + "cc", + "libc", + "once_cell", + "spin 0.5.2", + "untrusted 0.7.1", + "web-sys", + "winapi", ] [[package]] @@ -2092,8 +1864,8 @@ dependencies = [ "cfg-if", "getrandom", "libc", - "spin", - "untrusted", + "spin 0.9.8", + "untrusted 0.9.0", "windows-sys 0.52.0", ] @@ -2113,13 +1885,15 @@ dependencies = [ "native-tls", "reqwest", "rustls 0.22.4", + "rustls-pemfile", "serde", "serde_json", - "thiserror", + "thiserror 1.0.69", "tokio", "tokio-tungstenite", "tungstenite", "url", + "webpki", ] [[package]] @@ -2138,61 +1912,47 @@ dependencies = [ "native-tls", "rand", "rust_engineio", - "rustls 0.23.13", + "rustls 0.22.4", "serde", "serde_json", "serial_test", - "thiserror", + "thiserror 1.0.69", "tokio", "url", ] [[package]] name = "rustc-demangle" -version = "0.1.21" +version = "0.1.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ef03e0a2b150c7a90d01faf6254c9c48a41e95fb2a8c2ac1c6f0d2b9aefc342" +checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" [[package]] name = "rustc-hash" -version = "1.1.0" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" +checksum = "c7fb8039b3032c191086b10f11f319a6e99e1e82889c5cc6046f515c9db1d497" [[package]] name = "rustc_version" -version = "0.4.0" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" +checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" dependencies = [ "semver", ] [[package]] name = "rustix" -version = "0.37.25" +version = "0.38.41" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4eb579851244c2c03e7c24f501c3432bed80b8f720af1d6e5b0e0f01555a035" -dependencies = [ - "bitflags 1.3.2", - "errno", - "io-lifetimes", - "libc", - "linux-raw-sys 0.3.8", - "windows-sys 0.48.0", -] - -[[package]] -name = "rustix" -version = "0.38.25" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc99bc2d4f1fed22595588a013687477aedf3cdcfb26558c559edb67b4d9b22e" +checksum = "d7f649912bc1495e167a6edee79151c84b1bad49748cb4f1f1167f459f6224f6" dependencies = [ "bitflags 2.6.0", "errno", "libc", - "linux-raw-sys 0.4.14", - "windows-sys 0.48.0", + "linux-raw-sys", + "windows-sys 0.52.0", ] [[package]] @@ -2202,7 +1962,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bf4ef73721ac7bcd79b2b315da7779d8fc09718c6b3d2d1b2d94850eb8c18432" dependencies = [ "log", - "ring", + "ring 0.17.8", "rustls-pki-types", "rustls-webpki", "subtle", @@ -2211,13 +1971,12 @@ dependencies = [ [[package]] name = "rustls" -version = "0.23.13" +version = "0.23.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2dabaac7466917e566adb06783a81ca48944c6898a1b08b9374106dd671f4c8" +checksum = "934b404430bb06b3fae2cba809eb45a1ab1aecd64491213d7c3301b88393f8d1" dependencies = [ - "aws-lc-rs", - "log", "once_cell", + "ring 0.17.8", "rustls-pki-types", "rustls-webpki", "subtle", @@ -2239,19 +1998,21 @@ dependencies = [ [[package]] name = "rustls-pemfile" -version = "2.1.2" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29993a25686778eb88d4189742cd713c9bce943bc54251a33509dc63cbacf73d" +checksum = "dce314e5fee3f39953d46bb63bb8a46d40c2f8fb7cc5a3b6cab2bde9721d6e50" dependencies = [ - "base64", "rustls-pki-types", ] [[package]] name = "rustls-pki-types" -version = "1.8.0" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc0a2ce646f8655401bb81e7927b812614bd5d91dbc968696be50603510fcaf0" +checksum = "16f1201b3c9a7ee8039bcadc17b7e605e2945b27eee7631788c1bd2b0643674b" +dependencies = [ + "web-time", +] [[package]] name = "rustls-webpki" @@ -2259,17 +2020,16 @@ version = "0.102.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "64ca1bc8749bd4cf37b5ce386cc146580777b4e8572c7b97baf22c83f444bee9" dependencies = [ - "aws-lc-rs", - "ring", + "ring 0.17.8", "rustls-pki-types", - "untrusted", + "untrusted 0.9.0", ] [[package]] name = "ryu" -version = "1.0.5" +version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e" +checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" [[package]] name = "same-file" @@ -2280,35 +2040,43 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "scc" +version = "2.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "66b202022bb57c049555430e11fc22fea12909276a80a4c3d368da36ac1d88ed" +dependencies = [ + "sdd", +] + [[package]] name = "schannel" -version = "0.1.19" +version = "0.1.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f05ba609c234e60bee0d547fe94a4c7e9da733d1c962cf6e59efa4cd9c8bc75" +checksum = "1f29ebaa345f945cec9fbbc532eb307f0fdad8161f281b6369539c8d84876b3d" dependencies = [ - "lazy_static", - "winapi", + "windows-sys 0.59.0", ] [[package]] name = "scopeguard" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" [[package]] -name = "scratch" -version = "1.0.3" +name = "sdd" +version = "3.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ddccb15bcce173023b3fedd9436f882a0739b8dfb45e4f6b6002bee5929f61b2" +checksum = "49c1eeaf4b6a87c7479688c6d52b9f1153cedd3c489300564f932b065c6eab95" [[package]] name = "security-framework" -version = "2.9.1" +version = "2.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fc758eb7bffce5b308734e9b0c1468893cae9ff70ebf13e7090be8dcbcc83a8" +checksum = "897b2245f0b511c87893af39b033e5ca9cce68824c4d7e7630b5a1d339658d02" dependencies = [ - "bitflags 1.3.2", + "bitflags 2.6.0", "core-foundation", "core-foundation-sys", "libc", @@ -2317,9 +2085,9 @@ dependencies = [ [[package]] name = "security-framework-sys" -version = "2.9.0" +version = "2.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f51d0c0d83bec45f16480d0ce0058397a69e48fcdc52d1dc8855fb68acbd31a7" +checksum = "fa39c7303dc58b5543c94d22c1766b0d31f2ee58306363ea622b10bbc075eaa2" dependencies = [ "core-foundation-sys", "libc", @@ -2327,9 +2095,9 @@ dependencies = [ [[package]] name = "semver" -version = "1.0.16" +version = "1.0.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58bc9567378fc7690d6b2addae4e60ac2eeea07becb2c64b9f218b53865cba2a" +checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" dependencies = [ "serde", ] @@ -2351,7 +2119,7 @@ checksum = "ad1e866f866923f252f05c889987993144fb74e722403468a4ebd70c3cd756c0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -2380,27 +2148,27 @@ dependencies = [ [[package]] name = "serial_test" -version = "3.0.0" +version = "3.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "953ad9342b3aaca7cb43c45c097dd008d4907070394bd0751a0aa8817e5a018d" +checksum = "1b258109f244e1d6891bf1053a55d63a5cd4f8f4c30cf9a1280989f80e7a1fa9" dependencies = [ - "dashmap", "futures", - "lazy_static", "log", + "once_cell", "parking_lot", + "scc", "serial_test_derive", ] [[package]] name = "serial_test_derive" -version = "3.0.0" +version = "3.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b93fb4adc70021ac1b47f7d45e8cc4169baaa7ea58483bc5b721d19a26202212" +checksum = "5d69265a08751de7844521fd15003ae0a888e035773ba05695c5c759a6f89eef" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -2416,9 +2184,9 @@ dependencies = [ [[package]] name = "sharded-slab" -version = "0.1.4" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "900fba806f70c630b0a382d0d825e17a0f19fcd059a2ade1ff237bcddf446b31" +checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6" dependencies = [ "lazy_static", ] @@ -2431,9 +2199,12 @@ checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" [[package]] name = "slab" -version = "0.4.5" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9def91fd1e018fe007022791f865d0ccc9b3a0d5001e01aabb8b40e46000afb5" +checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" +dependencies = [ + "autocfg", +] [[package]] name = "smallvec" @@ -2443,23 +2214,19 @@ checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "socket2" -version = "0.4.10" +version = "0.5.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f7916fc008ca5542385b89a3d3ce689953c143e9304a9bf8beec1de48994c0d" +checksum = "c970269d99b64e60ec3bd6ad27270092a5394c4e309314b18ae3fe575695fbe8" dependencies = [ "libc", - "winapi", + "windows-sys 0.52.0", ] [[package]] -name = "socket2" -version = "0.5.5" +name = "spin" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b5fac59a5cb5dd637972e5fca70daf0523c9067fcdc4842f053dae04a18f8e9" -dependencies = [ - "libc", - "windows-sys 0.48.0", -] +checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" [[package]] name = "spin" @@ -2487,9 +2254,9 @@ checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" [[package]] name = "syn" -version = "1.0.107" +version = "1.0.109" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f4064b5b16e03ae50984a5a8ed5d4f8803e6bc1fd170a3cda91a1be4b18e3f5" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" dependencies = [ "proc-macro2", "quote", @@ -2498,9 +2265,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.89" +version = "2.0.90" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44d46482f1c1c87acd84dea20c1bf5ebff4c757009ed6bf19cfd36fb10e92c4e" +checksum = "919d3b74a5dd0ccd15aeb8f93e7006bd9e14c295087c9896a110f490752bcf31" dependencies = [ "proc-macro2", "quote", @@ -2509,9 +2276,12 @@ dependencies = [ [[package]] name = "sync_wrapper" -version = "0.1.2" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" +checksum = "0bf256ce5efdfa370213c1dabab5935a12e49f2c58d15e9eac2870d3b4f27263" +dependencies = [ + "futures-core", +] [[package]] name = "synstructure" @@ -2521,25 +2291,25 @@ checksum = "c8af7666ab7b6390ab78131fb5b0fce11d6b7a6951602017c35fa82800708971" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] name = "system-configuration" -version = "0.5.1" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba3a3adc5c275d719af8cb4272ea1c4a6d668a777f37e115f6d11ddbc1c8e0e7" +checksum = "3c879d448e9d986b661742763247d3693ed13609438cf3d006f51f5368a5ba6b" dependencies = [ - "bitflags 1.3.2", + "bitflags 2.6.0", "core-foundation", "system-configuration-sys", ] [[package]] name = "system-configuration-sys" -version = "0.5.0" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a75fb188eb626b924683e3b95e3a48e63551fcfb51949de2f06a9d91dbee93c9" +checksum = "8e1d1b10ced5ca923a1fcb8d03e96b8d3268065d724548c0211415ff6ac6bac4" dependencies = [ "core-foundation-sys", "libc", @@ -2547,73 +2317,74 @@ dependencies = [ [[package]] name = "tempfile" -version = "3.6.0" +version = "3.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31c0432476357e58790aaa47a8efb0c5138f137343f3b5f23bd36a27e3b0a6d6" +checksum = "28cce251fcbc87fac86a866eeb0d6c2d536fc16d06f184bb61aeae11aa4cee0c" dependencies = [ - "autocfg", "cfg-if", "fastrand", - "redox_syscall 0.3.5", - "rustix 0.37.25", - "windows-sys 0.48.0", + "once_cell", + "rustix", + "windows-sys 0.59.0", ] [[package]] -name = "termcolor" -version = "1.1.3" +name = "textwrap" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bab24d30b911b2376f3a13cc2cd443142f0c81dda04c118693e35b3835757755" +checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" dependencies = [ - "winapi-util", + "unicode-width", ] [[package]] -name = "textwrap" -version = "0.11.0" +name = "thiserror" +version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" +checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" dependencies = [ - "unicode-width", + "thiserror-impl 1.0.69", ] [[package]] name = "thiserror" -version = "1.0.63" +version = "2.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0342370b38b6a11b6cc11d6a805569958d54cfa061a29969c3b5ce2ea405724" +checksum = "c006c85c7651b3cf2ada4584faa36773bd07bac24acfb39f3c431b36d7e667aa" dependencies = [ - "thiserror-impl", + "thiserror-impl 2.0.3", ] [[package]] name = "thiserror-impl" -version = "1.0.63" +version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4558b58466b9ad7ca0f102865eccc95938dca1a74a856f2b57b6629050da261" +checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] -name = "thread_local" -version = "1.1.4" +name = "thiserror-impl" +version = "2.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5516c27b78311c50bf42c071425c560ac799b11c30b31f87e3081965fe5e0180" +checksum = "f077553d607adc1caf65430528a576c757a71ed73944b66ebb58ef2bbd243568" dependencies = [ - "once_cell", + "proc-macro2", + "quote", + "syn 2.0.90", ] [[package]] -name = "time" -version = "0.1.43" +name = "thread_local" +version = "1.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca8a50ef2360fbd1eeb0ecd46795a87a19024eb4b53c5dc916ca1fd95fe62438" +checksum = "8b9ef9bad013ada3808854ceac7b46812a6465ba368859a37e2100283d2d719c" dependencies = [ - "libc", - "winapi", + "cfg-if", + "once_cell", ] [[package]] @@ -2636,18 +2407,33 @@ dependencies = [ "serde_json", ] +[[package]] +name = "tinyvec" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "445e881f4f6d382d5f27c034e25eb92edd7c784ceab92a0937db7f2e9471b938" +dependencies = [ + "tinyvec_macros", +] + +[[package]] +name = "tinyvec_macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" + [[package]] name = "tokio" -version = "1.40.0" +version = "1.41.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2b070231665d27ad9ec9b8df639893f46727666c6767db40317fbe920a5d998" +checksum = "22cfb5bee7a6a52939ca9224d6ac897bb669134078daa8735560897f69de4d33" dependencies = [ "backtrace", "bytes", "libc", "mio", "pin-project-lite", - "socket2 0.5.5", + "socket2", "tokio-macros", "windows-sys 0.52.0", ] @@ -2660,7 +2446,7 @@ checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -2684,6 +2470,17 @@ dependencies = [ "tokio", ] +[[package]] +name = "tokio-rustls" +version = "0.26.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c7bc40d0e5a97695bb96e27995cd3a08538541b0a846f65bba7a359f36700d4" +dependencies = [ + "rustls 0.23.19", + "rustls-pki-types", + "tokio", +] + [[package]] name = "tokio-tungstenite" version = "0.21.0" @@ -2698,78 +2495,54 @@ dependencies = [ "rustls-pki-types", "tokio", "tokio-native-tls", - "tokio-rustls", + "tokio-rustls 0.25.0", "tungstenite", "webpki-roots", ] [[package]] name = "tokio-util" -version = "0.7.3" +version = "0.7.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc463cd8deddc3770d20f9852143d50bf6094e640b485cb2e189a2099085ff45" +checksum = "61e7c3654c13bcd040d4a03abee2c75b1d14a37b423cf5a813ceae1cc903ec6a" dependencies = [ "bytes", "futures-core", "futures-sink", "pin-project-lite", "tokio", - "tracing", ] [[package]] name = "toml" -version = "0.5.10" +version = "0.5.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1333c76748e868a4d9d1017b5ab53171dfd095f70c712fdb4653a406547f598f" +checksum = "f4f7f0dd8d50a853a531c426359045b1998f04219d88799810762cd4ad314234" dependencies = [ "serde", ] -[[package]] -name = "tower" -version = "0.4.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8fa9be0de6cf49e536ce1851f987bd21a43b771b09473c3549a6c853db37c1c" -dependencies = [ - "futures-core", - "futures-util", - "pin-project", - "pin-project-lite", - "tokio", - "tower-layer", - "tower-service", - "tracing", -] - -[[package]] -name = "tower-layer" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c20c8dbed6283a09604c3e69b4b7eeb54e298b8a600d4d5ecb5ad39de609f1d0" - [[package]] name = "tower-service" -version = "0.3.1" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "360dfd1d6d30e05fda32ace2c8c70e9c0a9da713275777f5a4dbb8a1893930c6" +checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" [[package]] name = "tracing" -version = "0.1.40" +version = "0.1.41" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" +checksum = "784e0ac535deb450455cbfa28a6f0df145ea1bb7ae51b821cf5e7927fdcfbdd0" dependencies = [ - "log", "pin-project-lite", "tracing-core", ] [[package]] name = "tracing-core" -version = "0.1.32" +version = "0.1.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" +checksum = "e672c95779cf947c5311f83787af4fa8fffd12fb27e4993211a84bdfd9610f9c" dependencies = [ "once_cell", "valuable", @@ -2777,12 +2550,12 @@ dependencies = [ [[package]] name = "tracing-log" -version = "0.1.3" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78ddad33d2d10b1ed7eb9d1f518a5674713876e97e5bb9b7345a7984fbb4f922" +checksum = "f751112709b4e791d8ce53e32c4ed2d353565a795ce84da2285393f41557bdf2" dependencies = [ - "lazy_static", "log", + "once_cell", "tracing-core", ] @@ -2807,9 +2580,9 @@ dependencies = [ [[package]] name = "try-lock" -version = "0.2.3" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59547bce71d9c38b83d9c0e92b6066c4253371f15005def0c30d9657f50c7642" +checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" [[package]] name = "tungstenite" @@ -2828,28 +2601,34 @@ dependencies = [ "rustls 0.22.4", "rustls-pki-types", "sha1", - "thiserror", + "thiserror 1.0.69", "url", "utf-8", ] [[package]] name = "typenum" -version = "1.14.0" +version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b63708a265f51345575b27fe43f9500ad611579e764c79edbc2037b1121959ec" +checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" [[package]] name = "unicode-ident" -version = "1.0.1" +version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5bd2fe26506023ed7b5e1e315add59d6f584c621d037f9368fea9cfb988f368c" +checksum = "adb9e6ca4f869e1180728b7950e35922a7fc6397f7b641499e8f3ef06e50dc83" [[package]] name = "unicode-width" -version = "0.1.10" +version = "0.1.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b" +checksum = "7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af" + +[[package]] +name = "untrusted" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" [[package]] name = "untrusted" @@ -2906,28 +2685,26 @@ checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" [[package]] name = "version_check" -version = "0.9.4" +version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" [[package]] name = "walkdir" -version = "2.3.2" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "808cf2735cd4b6866113f648b791c6adc5714537bc222d9347bb203386ffda56" +checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b" dependencies = [ "same-file", - "winapi", "winapi-util", ] [[package]] name = "want" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ce8a968cb1cd110d136ff8b819a556d6fb6d919363c61534f6860c7eb172ba0" +checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e" dependencies = [ - "log", "try-lock", ] @@ -2939,46 +2716,48 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.92" +version = "0.2.97" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4be2531df63900aeb2bca0daaaddec08491ee64ceecbee5076636a3b026795a8" +checksum = "d15e63b4482863c109d70a7b8706c1e364eb6ea449b201a76c5b89cedcec2d5c" dependencies = [ "cfg-if", + "once_cell", "wasm-bindgen-macro", ] [[package]] name = "wasm-bindgen-backend" -version = "0.2.92" +version = "0.2.97" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "614d787b966d3989fa7bb98a654e369c762374fd3213d212cfc0251257e747da" +checksum = "8d36ef12e3aaca16ddd3f67922bc63e48e953f126de60bd33ccc0101ef9998cd" dependencies = [ "bumpalo", "log", "once_cell", "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.90", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-futures" -version = "0.4.42" +version = "0.4.47" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76bc14366121efc8dbb487ab05bcc9d346b3b5ec0eaa76e46594cabbe51762c0" +checksum = "9dfaf8f50e5f293737ee323940c7d8b08a66a95a419223d9f41610ca08b0833d" dependencies = [ "cfg-if", "js-sys", + "once_cell", "wasm-bindgen", "web-sys", ] [[package]] name = "wasm-bindgen-macro" -version = "0.2.92" +version = "0.2.97" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1f8823de937b71b9460c0c34e25f3da88250760bec0ebac694b49997550d726" +checksum = "705440e08b42d3e4b36de7d66c944be628d579796b8090bfa3471478a2260051" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -2986,28 +2765,28 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.92" +version = "0.2.97" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" +checksum = "98c9ae5a76e46f4deecd0f0255cc223cfa18dc9b261213b8aa0c7b36f61b3f1d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.90", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.92" +version = "0.2.97" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af190c94f2773fdb3729c55b007a722abb5384da03bc0986df4c289bf5567e96" +checksum = "6ee99da9c5ba11bd675621338ef6fa52296b76b83305e9b6e5c77d4c286d6d49" [[package]] name = "wasm-streams" -version = "0.4.0" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b65dc4c90b63b118468cf747d8bf3566c1913ef60be765b5730ead9e0a3ba129" +checksum = "15053d8d85c7eccdbefef60f06769760a563c7f0a9d6902a13d35c7800b0ad65" dependencies = [ "futures-util", "js-sys", @@ -3018,33 +2797,41 @@ dependencies = [ [[package]] name = "web-sys" -version = "0.3.69" +version = "0.3.74" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77afa9a11836342370f4817622a2f0f418b134426d91a82dfb48f532d2ec13ef" +checksum = "a98bc3c33f0fe7e59ad7cd041b89034fa82a7c2d4365ca538dda6cdaf513863c" dependencies = [ "js-sys", "wasm-bindgen", ] [[package]] -name = "webpki-roots" -version = "0.26.6" +name = "web-time" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "841c67bff177718f1d4dfefde8d8f0e78f9b6589319ba88312f567fc5841a958" +checksum = "5a6580f308b1fad9207618087a65c04e7a10bc77e02c8e84e9b00dd4b12fa0bb" dependencies = [ - "rustls-pki-types", + "js-sys", + "wasm-bindgen", ] [[package]] -name = "which" -version = "4.4.2" +name = "webpki" +version = "0.21.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87ba24419a2078cd2b0f2ede2691b6c66d8e47836da3b6db8265ebad47afbfc7" +checksum = "b8e38c0608262c46d4a56202ebabdeb094cef7e560ca7a226c6bf055188aa4ea" dependencies = [ - "either", - "home", - "once_cell", - "rustix 0.38.25", + "ring 0.16.20", + "untrusted 0.7.1", +] + +[[package]] +name = "webpki-roots" +version = "0.26.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d642ff16b7e79272ae451b7322067cdc17cadf68c23264be9d94a32319efe7e" +dependencies = [ + "rustls-pki-types", ] [[package]] @@ -3065,11 +2852,11 @@ checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" [[package]] name = "winapi-util" -version = "0.1.5" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" +checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" dependencies = [ - "winapi", + "windows-sys 0.59.0", ] [[package]] @@ -3079,12 +2866,42 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] -name = "windows-sys" -version = "0.48.0" +name = "windows-core" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" +checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" dependencies = [ - "windows-targets 0.48.0", + "windows-targets", +] + +[[package]] +name = "windows-registry" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e400001bb720a623c1c69032f8e3e4cf09984deec740f007dd2b03ec864804b0" +dependencies = [ + "windows-result", + "windows-strings", + "windows-targets", +] + +[[package]] +name = "windows-result" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d1043d8214f791817bab27572aaa8af63732e11bf84aa21a45a78d6c317ae0e" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-strings" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4cd9b125c486025df0eabcb585e62173c6c9eddcec5d117d3b6e8c30e2ee4d10" +dependencies = [ + "windows-result", + "windows-targets", ] [[package]] @@ -3093,22 +2910,16 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" dependencies = [ - "windows-targets 0.52.6", + "windows-targets", ] [[package]] -name = "windows-targets" -version = "0.48.0" +name = "windows-sys" +version = "0.59.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b1eb6f0cd7c80c79759c929114ef071b87354ce476d9d94271031c0497adfd5" +checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" dependencies = [ - "windows_aarch64_gnullvm 0.48.0", - "windows_aarch64_msvc 0.48.0", - "windows_i686_gnu 0.48.0", - "windows_i686_msvc 0.48.0", - "windows_x86_64_gnu 0.48.0", - "windows_x86_64_gnullvm 0.48.0", - "windows_x86_64_msvc 0.48.0", + "windows-targets", ] [[package]] @@ -3117,46 +2928,28 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" dependencies = [ - "windows_aarch64_gnullvm 0.52.6", - "windows_aarch64_msvc 0.52.6", - "windows_i686_gnu 0.52.6", + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", "windows_i686_gnullvm", - "windows_i686_msvc 0.52.6", - "windows_x86_64_gnu 0.52.6", - "windows_x86_64_gnullvm 0.52.6", - "windows_x86_64_msvc 0.52.6", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", ] -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc" - [[package]] name = "windows_aarch64_gnullvm" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" -[[package]] -name = "windows_aarch64_msvc" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3" - [[package]] name = "windows_aarch64_msvc" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" -[[package]] -name = "windows_i686_gnu" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241" - [[package]] name = "windows_i686_gnu" version = "0.52.6" @@ -3169,64 +2962,30 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" -[[package]] -name = "windows_i686_msvc" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00" - [[package]] name = "windows_i686_msvc" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" -[[package]] -name = "windows_x86_64_gnu" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1" - [[package]] name = "windows_x86_64_gnu" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953" - [[package]] name = "windows_x86_64_gnullvm" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" -[[package]] -name = "windows_x86_64_msvc" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a" - [[package]] name = "windows_x86_64_msvc" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" -[[package]] -name = "winreg" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a277a57398d4bfa075df44f501a17cfdf8542d224f0d36095a2adc7aee4ef0a5" -dependencies = [ - "cfg-if", - "windows-sys 0.48.0", -] - [[package]] name = "write16" version = "1.0.0" @@ -3259,10 +3018,31 @@ checksum = "2380878cad4ac9aac1e2435f3eb4020e8374b5f13c296cb75b4620ff8e229154" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.90", "synstructure", ] +[[package]] +name = "zerocopy" +version = "0.7.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" +dependencies = [ + "byteorder", + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.7.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.90", +] + [[package]] name = "zerofrom" version = "0.1.5" @@ -3280,7 +3060,7 @@ checksum = "595eed982f7d355beb85837f651fa22e90b3c044842dc7f2c2842c086f295808" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.90", "synstructure", ] @@ -3309,5 +3089,5 @@ checksum = "6eafa6dfb17584ea3e2bd6e76e0cc15ad7af12b09abdd1ca55961bed9b1063c6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.90", ] diff --git a/engineio/Cargo.toml b/engineio/Cargo.toml index 8e35de45..de3e6c14 100644 --- a/engineio/Cargo.toml +++ b/engineio/Cargo.toml @@ -30,6 +30,10 @@ async-stream = "0.3.6" thiserror = "1.0" native-tls = { version = "^0.2", optional = true } rustls = { version = "^0.22", optional = true } +# rustls-pemfile is only needed for unit tests +rustls-pemfile = { version = "2", optional = true } +# webpki is only needed for unit tests +webpki = { version = "0.21", optional = true } url = "2.5.4" [dev-dependencies] @@ -61,7 +65,7 @@ rustls-tls-native-roots = ["tokio-tungstenite/rustls-tls-native-roots", "_rustls rustls-tls-webpki-roots = ["tokio-tungstenite/rustls-tls-webpki-roots", "_rustls-tls"] # These features are for internal use only _native-tls = ["dep:native-tls", "reqwest/native-tls"] -_rustls-tls = ["dep:rustls", "reqwest/rustls-tls"] +_rustls-tls = ["dep:rustls", "reqwest/rustls-tls", "dep:rustls-pemfile", "dep:webpki"] # This is an internal feature to allow us to build using cargo-all-features and guaranteing that we always have one TLS implementation # Do not use this feature directly diff --git a/engineio/src/asynchronous/async_transports/websocket_secure.rs b/engineio/src/asynchronous/async_transports/websocket_secure.rs index da13ca68..0e073152 100644 --- a/engineio/src/asynchronous/async_transports/websocket_secure.rs +++ b/engineio/src/asynchronous/async_transports/websocket_secure.rs @@ -61,7 +61,7 @@ impl WebsocketSecureTransport { #[cfg(feature = "_rustls-tls")] tls_config.map(Arc::new).map(Connector::Rustls), #[cfg(not(any(feature = "_native-tls", feature = "_rustls-tls")))] - None, + compile_error!("Either feature `_native-tls` or `_rustls-tls` must be enabled"), ) .await?; diff --git a/engineio/src/client/client.rs b/engineio/src/client/client.rs index 1c82003e..b37614de 100644 --- a/engineio/src/client/client.rs +++ b/engineio/src/client/client.rs @@ -376,7 +376,7 @@ impl<'a> Iterator for Iter<'a> { #[cfg(test)] mod test { - use crate::packet::PacketId; + use crate::{packet::PacketId, test::tls_connector}; use super::*; @@ -649,10 +649,7 @@ mod test { let _ = builder(url.clone()) .tls_config( - TlsConfig::builder() - .danger_accept_invalid_certs(true) - .build() - .unwrap(), + tls_connector()? ) .build()?; let _ = builder(url).headers(headers).build()?; diff --git a/engineio/src/lib.rs b/engineio/src/lib.rs index 467bb12e..3d92e4cc 100644 --- a/engineio/src/lib.rs +++ b/engineio/src/lib.rs @@ -99,13 +99,14 @@ pub use client::{Client, ClientBuilder}; pub use error::Error; pub use packet::{Packet, PacketId}; -// Re-export TLS configurations to make sockio integration easier +// Re-export TLS configurations. This is the same as the socket.io logic. +// Needed in both crates so the compiler can know this is a re-export. #[cfg(all(feature = "_native-tls", not(feature = "_rustls-tls")))] #[doc(hidden)] -pub use native_tls::TlsConnector as TlsConfig; +pub(crate) use native_tls::TlsConnector as TlsConfig; #[doc(hidden)] #[cfg(feature = "_rustls-tls")] -pub use rustls::ClientConfig as TlsConfig; +pub(crate) use rustls::ClientConfig as TlsConfig; // Both native-tls and rustls is not supported at the same time #[cfg(not(feature = "_fallback-tls"))] @@ -118,24 +119,39 @@ compile_error!("No TLS feature is enabled. Please enable either native-tls or ru #[cfg(test)] pub(crate) mod test { use super::*; + #[cfg(feature = "_native-tls")] use native_tls::TlsConnector; const CERT_PATH: &str = "../ci/cert/ca.crt"; + #[cfg(all(feature = "_native-tls", not(feature = "_rustls-tls")))] use native_tls::Certificate; use std::fs::File; use std::io::Read; - pub(crate) fn tls_connector() -> error::Result { + pub(crate) fn tls_connector() -> error::Result { let cert_path = std::env::var("CA_CERT_PATH").unwrap_or_else(|_| CERT_PATH.to_owned()); let mut cert_file = File::open(cert_path)?; let mut buf = vec![]; cert_file.read_to_end(&mut buf)?; - let cert: Certificate = Certificate::from_pem(&buf[..]).unwrap(); - Ok(TlsConnector::builder() - // ONLY USE FOR TESTING! - .danger_accept_invalid_hostnames(true) - .add_root_certificate(cert) - .build() - .unwrap()) + #[cfg(all(feature = "_native-tls", not(feature = "_rustls-tls")))] + { + let cert: Certificate = Certificate::from_pem(&buf[..]).unwrap(); + Ok(TlsConnector::builder() + // ONLY USE FOR TESTING! + .danger_accept_invalid_hostnames(true) + .add_root_certificate(cert) + .build() + .unwrap()) + } + #[cfg(feature = "_rustls-tls")] + { + let mut root_store = rustls::RootCertStore::empty(); + for cert in rustls_pemfile::certs(&mut buf.as_slice()) { + root_store.add(cert.expect("Invalid PEM cert")).expect("Failed to add cert to store"); + } + let mut config = rustls::ClientConfig::builder().with_root_certificates(root_store).with_no_client_auth(); + config.enable_sni = false; + Ok(config) + } } /// The `engine.io` server for testing runs on port 4201 const SERVER_URL: &str = "http://localhost:4201"; diff --git a/socketio/Cargo.toml b/socketio/Cargo.toml index 7433e05d..2905e56f 100644 --- a/socketio/Cargo.toml +++ b/socketio/Cargo.toml @@ -29,7 +29,7 @@ async-stream = { version = "0.3.6", optional = true } log = "0.4.22" serde = "1.0.209" native-tls = { version = "0.2", optional = true } -rustls = { version = "0.23", optional = true } +rustls = { version = "0.22", optional = true } getrandom = "0.2.10" [dev-dependencies] @@ -61,6 +61,11 @@ name = "async" path = "examples/async.rs" required-features = ["async", "native-tls"] +[[example]] +name = "secure" +path = "examples/secure.rs" +required-features = ["native-tls"] + [lints.rust] unexpected_cfgs = { level = "warn", check-cfg = ['cfg(tarpaulin)'] } diff --git a/socketio/src/asynchronous/client/builder.rs b/socketio/src/asynchronous/client/builder.rs index 8c8da0ae..bd268a03 100644 --- a/socketio/src/asynchronous/client/builder.rs +++ b/socketio/src/asynchronous/client/builder.rs @@ -3,12 +3,11 @@ use log::trace; use rust_engineio::{ asynchronous::ClientBuilder as EngineIoClientBuilder, header::{HeaderMap, HeaderValue}, - TlsConfig, }; use std::collections::HashMap; use url::Url; -use crate::{error::Result, Event, Payload, TransportType}; +use crate::{error::Result, Event, Payload, TransportType, TlsConfig}; use super::{ callback::{ diff --git a/socketio/src/client/builder.rs b/socketio/src/client/builder.rs index 6112f2a1..e7241d8e 100644 --- a/socketio/src/client/builder.rs +++ b/socketio/src/client/builder.rs @@ -1,10 +1,9 @@ use super::super::{event::Event, payload::Payload}; use super::callback::Callback; use super::client::Client; -use crate::RawClient; +use crate::{RawClient, TlsConfig}; use rust_engineio::client::ClientBuilder as EngineIoClientBuilder; use rust_engineio::header::{HeaderMap, HeaderValue}; -use rust_engineio::TlsConfig; use url::Url; use crate::client::callback::{SocketAnyCallback, SocketCallback}; diff --git a/socketio/src/client/raw_client.rs b/socketio/src/client/raw_client.rs index 9c8ecef2..7c0901c6 100644 --- a/socketio/src/client/raw_client.rs +++ b/socketio/src/client/raw_client.rs @@ -422,10 +422,24 @@ mod test { use super::*; use crate::{client::TransportType, payload::Payload, ClientBuilder}; use bytes::Bytes; - use native_tls::TlsConnector; use serde_json::json; use std::time::Duration; + #[cfg(feature = "_native-tls")] + fn tls_config() -> native_tls::TlsConnector { + native_tls::TlsConnector::builder() + .use_sni(true) + .build() + .expect("Found illegal configuration") + } + + #[cfg(feature = "_rustls-tls")] + fn tls_config() -> rustls::ClientConfig { + rustls::ClientConfig::builder() + .with_root_certificates(rustls::RootCertStore::empty()) + .with_no_client_auth() + } + #[test] fn socket_io_integration() -> Result<()> { let url = crate::test::socket_io_server(); @@ -478,14 +492,9 @@ mod test { // test socket build logic let socket_builder = ClientBuilder::new(url); - let tls_connector = TlsConnector::builder() - .use_sni(true) - .build() - .expect("Found illegal configuration"); - let socket = socket_builder .namespace("/admin") - .tls_config(tls_connector) + .tls_config(tls_config()) .opening_header("accept-encoding", "application/json") .on("test", |str, _| println!("Received: {:#?}", str)) .on("message", |payload, _| println!("{:#?}", payload)) @@ -519,14 +528,9 @@ mod test { // test socket build logic let socket_builder = ClientBuilder::new(url); - let tls_connector = TlsConnector::builder() - .use_sni(true) - .build() - .expect("Found illegal configuration"); - let socket = socket_builder .namespace("/admin") - .tls_config(tls_connector) + .tls_config(tls_config()) .opening_header("accept-encoding", "application/json") .on("test", |str, _| println!("Received: {:#?}", str)) .on("message", |payload, _| println!("{:#?}", payload)) diff --git a/socketio/src/lib.rs b/socketio/src/lib.rs index 1445cc82..28509e99 100644 --- a/socketio/src/lib.rs +++ b/socketio/src/lib.rs @@ -199,6 +199,23 @@ pub use client::{ClientBuilder, RawClient, TransportType}; #[deprecated(since = "0.3.0-alpha-2", note = "Socket renamed to Client")] pub use client::{ClientBuilder as SocketBuilder, RawClient as Socket}; +// Re-export TLS configurations. This is the same as the engine.io logic. +// Needed here so it knows it's actually a re-import, not a new type. +#[cfg(all(feature = "_native-tls", not(feature = "_rustls-tls")))] +#[doc(hidden)] +pub use native_tls::TlsConnector as TlsConfig; +#[doc(hidden)] +#[cfg(feature = "_rustls-tls")] +pub use rustls::ClientConfig as TlsConfig; + +// Both native-tls and rustls is not supported at the same time +#[cfg(not(feature = "_fallback-tls"))] +#[cfg(all(feature = "_native-tls", feature = "_rustls-tls"))] +compile_error!("Both native-tls and rustls features are enabled. Please enable only one of them."); + +#[cfg(not(any(feature = "_native-tls", feature = "_rustls-tls")))] +compile_error!("No TLS feature is enabled. Please enable either native-tls or rustls."); + #[cfg(test)] pub(crate) mod test { use url::Url; From 814e5ce41dea85e92ee3284d9a169c99293b1b4a Mon Sep 17 00:00:00 2001 From: Ignacio Duart Date: Mon, 2 Dec 2024 13:26:41 +0100 Subject: [PATCH 07/15] style: cargo fmt --- engineio/src/client/client.rs | 6 +----- engineio/src/lib.rs | 8 ++++++-- socketio/src/asynchronous/client/builder.rs | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/engineio/src/client/client.rs b/engineio/src/client/client.rs index b37614de..eee69763 100644 --- a/engineio/src/client/client.rs +++ b/engineio/src/client/client.rs @@ -647,11 +647,7 @@ mod test { std::env::var("ENGINE_IO_SECURE_HOST").unwrap_or_else(|_| "localhost".to_owned()); headers.insert(HOST, host); - let _ = builder(url.clone()) - .tls_config( - tls_connector()? - ) - .build()?; + let _ = builder(url.clone()).tls_config(tls_connector()?).build()?; let _ = builder(url).headers(headers).build()?; Ok(()) } diff --git a/engineio/src/lib.rs b/engineio/src/lib.rs index 3d92e4cc..a9508793 100644 --- a/engineio/src/lib.rs +++ b/engineio/src/lib.rs @@ -146,9 +146,13 @@ pub(crate) mod test { { let mut root_store = rustls::RootCertStore::empty(); for cert in rustls_pemfile::certs(&mut buf.as_slice()) { - root_store.add(cert.expect("Invalid PEM cert")).expect("Failed to add cert to store"); + root_store + .add(cert.expect("Invalid PEM cert")) + .expect("Failed to add cert to store"); } - let mut config = rustls::ClientConfig::builder().with_root_certificates(root_store).with_no_client_auth(); + let mut config = rustls::ClientConfig::builder() + .with_root_certificates(root_store) + .with_no_client_auth(); config.enable_sni = false; Ok(config) } diff --git a/socketio/src/asynchronous/client/builder.rs b/socketio/src/asynchronous/client/builder.rs index bd268a03..faa92bec 100644 --- a/socketio/src/asynchronous/client/builder.rs +++ b/socketio/src/asynchronous/client/builder.rs @@ -7,7 +7,7 @@ use rust_engineio::{ use std::collections::HashMap; use url::Url; -use crate::{error::Result, Event, Payload, TransportType, TlsConfig}; +use crate::{error::Result, Event, Payload, TlsConfig, TransportType}; use super::{ callback::{ From 3ec1363cd322f8bf89302c0605a798ee977284a6 Mon Sep 17 00:00:00 2001 From: Ignacio Duart Date: Mon, 2 Dec 2024 14:38:11 +0100 Subject: [PATCH 08/15] fix: compile issues --- Cargo.toml | 1 + socketio/src/asynchronous/client/builder.rs | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 597aaf51..2ce2ed53 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,2 +1,3 @@ [workspace] members = ["engineio", "socketio"] +resolver = "2" diff --git a/socketio/src/asynchronous/client/builder.rs b/socketio/src/asynchronous/client/builder.rs index faa92bec..cbbfce08 100644 --- a/socketio/src/asynchronous/client/builder.rs +++ b/socketio/src/asynchronous/client/builder.rs @@ -27,7 +27,7 @@ pub struct ClientBuilder { pub(crate) on_any: Option>, pub(crate) on_reconnect: Option>, pub(crate) namespace: String, - tls_config: Option, + tls_config: Option, pub(crate) opening_headers: Option, transport_type: TransportType, pub(crate) auth: Option, From ee832bdfaa019b1d9b5fef28b08151fcdc3770bb Mon Sep 17 00:00:00 2001 From: Ignacio Duart Date: Tue, 3 Dec 2024 19:34:53 +0100 Subject: [PATCH 09/15] fix: disable reqwest nativetls by default in engine.io --- Cargo.lock | 87 ++------------------------------------------- engineio/Cargo.toml | 2 +- 2 files changed, 4 insertions(+), 85 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 8f13f5fd..458a15aa 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -101,12 +101,6 @@ dependencies = [ "syn 2.0.90", ] -[[package]] -name = "atomic-waker" -version = "1.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" - [[package]] name = "atty" version = "0.2.14" @@ -228,7 +222,7 @@ dependencies = [ "gimli 0.26.2", "git2", "humantime-serde", - "indexmap 1.9.3", + "indexmap", "lazy_static", "libc", "memmap", @@ -574,21 +568,6 @@ version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" -[[package]] -name = "encoding_rs" -version = "0.8.35" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75030f3c4f45dafd7586dd6780965a8c7e8e285a5ecb86713e63a79c5b2766f3" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "equivalent" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" - [[package]] name = "errno" version = "0.3.10" @@ -770,7 +749,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "22030e2c5a68ec659fde1e949a745124b48e6fa8b045b7ed5bd1fe4ccc5c4e5d" dependencies = [ "fallible-iterator", - "indexmap 1.9.3", + "indexmap", "stable_deref_trait", ] @@ -804,25 +783,6 @@ dependencies = [ "crc32fast", ] -[[package]] -name = "h2" -version = "0.4.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ccae279728d634d083c00f6099cb58f01cc99c145b84b8be2f6c74618d79922e" -dependencies = [ - "atomic-waker", - "bytes", - "fnv", - "futures-core", - "futures-sink", - "http", - "indexmap 2.7.0", - "slab", - "tokio", - "tokio-util", - "tracing", -] - [[package]] name = "half" version = "2.4.1" @@ -839,12 +799,6 @@ version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" -[[package]] -name = "hashbrown" -version = "0.15.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf151400ff0baff5465007dd2f3e717f3fe502074ca563069ce3a6629d07b289" - [[package]] name = "hermit-abi" version = "0.1.19" @@ -931,7 +885,6 @@ dependencies = [ "bytes", "futures-channel", "futures-util", - "h2", "http", "http-body", "httparse", @@ -1164,20 +1117,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" dependencies = [ "autocfg", - "hashbrown 0.12.3", + "hashbrown", "serde", ] -[[package]] -name = "indexmap" -version = "2.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62f822373a4fe84d4bb149bf54e584a7f4abec90e072ed49cda0edea5b95471f" -dependencies = [ - "equivalent", - "hashbrown 0.15.2", -] - [[package]] name = "instant" version = "0.1.13" @@ -1796,11 +1739,9 @@ checksum = "a77c62af46e79de0a562e1a9849205ffcb7fc1238876e9bd743357570e04046f" dependencies = [ "base64", "bytes", - "encoding_rs", "futures-channel", "futures-core", "futures-util", - "h2", "http", "http-body", "http-body-util", @@ -1824,7 +1765,6 @@ dependencies = [ "serde_json", "serde_urlencoded", "sync_wrapper", - "system-configuration", "tokio", "tokio-native-tls", "tokio-rustls 0.26.0", @@ -2294,27 +2234,6 @@ dependencies = [ "syn 2.0.90", ] -[[package]] -name = "system-configuration" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c879d448e9d986b661742763247d3693ed13609438cf3d006f51f5368a5ba6b" -dependencies = [ - "bitflags 2.6.0", - "core-foundation", - "system-configuration-sys", -] - -[[package]] -name = "system-configuration-sys" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e1d1b10ced5ca923a1fcb8d03e96b8d3268065d724548c0211415ff6ac6bac4" -dependencies = [ - "core-foundation-sys", - "libc", -] - [[package]] name = "tempfile" version = "3.14.0" diff --git a/engineio/Cargo.toml b/engineio/Cargo.toml index de3e6c14..26111523 100644 --- a/engineio/Cargo.toml +++ b/engineio/Cargo.toml @@ -16,7 +16,7 @@ all-features = true [dependencies] base64 = "0.22.1" bytes = "1" -reqwest = { version = "0.12.4", features = ["blocking", "stream"] } +reqwest = { version = "0.12.4", features = ["blocking", "stream"], default-features = false} adler32 = "1.2.0" serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" From 8c0b81947a995a55921e70222df368fead416956 Mon Sep 17 00:00:00 2001 From: Felipe Silveira Date: Tue, 17 Dec 2024 16:35:14 -0300 Subject: [PATCH 10/15] NXD-0: Update webpki due to vulnerabilities Found by dependabot: https://github.com/nextdata-tech/nxd/security/dependabot/160 Reference: https://github.com/briansmith/webpki/issues/69 --- engineio/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engineio/Cargo.toml b/engineio/Cargo.toml index 26111523..a5d959d6 100644 --- a/engineio/Cargo.toml +++ b/engineio/Cargo.toml @@ -33,7 +33,7 @@ rustls = { version = "^0.22", optional = true } # rustls-pemfile is only needed for unit tests rustls-pemfile = { version = "2", optional = true } # webpki is only needed for unit tests -webpki = { version = "0.21", optional = true } +webpki = { version = "0.22", optional = true } url = "2.5.4" [dev-dependencies] From ad029bbee91a79c520fbb6be5422ef775229f202 Mon Sep 17 00:00:00 2001 From: Tyler Hawkes Date: Fri, 18 Apr 2025 11:50:55 -0600 Subject: [PATCH 11/15] Upgrade rustls and tungstenite to remove multiple versions in deps --- Cargo.lock | 256 ++++++++++-------- engineio/Cargo.toml | 14 +- .../async_transports/websocket_general.rs | 16 +- .../async_transports/websocket_secure.rs | 3 +- .../src/asynchronous/client/async_client.rs | 12 +- engineio/src/lib.rs | 20 +- socketio/Cargo.toml | 5 +- socketio/examples/secure.rs | 47 ++-- socketio/src/asynchronous/client/client.rs | 18 +- socketio/src/client/raw_client.rs | 2 +- 10 files changed, 214 insertions(+), 179 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 458a15aa..05c30a1e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,6 +1,6 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -version = 3 +version = 4 [[package]] name = "addr2line" @@ -124,9 +124,9 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b62ddb9cb1ec0a098ad4bbf9344d0713fa193ae1a80af55febcff2627b6a00c1" dependencies = [ - "getrandom", + "getrandom 0.2.15", "instant", - "rand", + "rand 0.8.5", ] [[package]] @@ -377,6 +377,16 @@ dependencies = [ "libc", ] +[[package]] +name = "core-foundation" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b55271e5c8c478ad3f38ad24ef34923091e0548492a266d19b3c0b4d82574c63" +dependencies = [ + "core-foundation-sys", + "libc", +] + [[package]] name = "core-foundation-sys" version = "0.8.7" @@ -738,10 +748,22 @@ dependencies = [ "cfg-if", "js-sys", "libc", - "wasi", + "wasi 0.11.0+wasi-snapshot-preview1", "wasm-bindgen", ] +[[package]] +name = "getrandom" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73fea8450eea4bac3940448fb7ae50d91f034f941199fcd9d909a5a07aa455f0" +dependencies = [ + "cfg-if", + "libc", + "r-efi", + "wasi 0.14.2+wasi-0.2.4", +] + [[package]] name = "gimli" version = "0.26.2" @@ -905,10 +927,10 @@ dependencies = [ "http", "hyper", "hyper-util", - "rustls 0.23.19", + "rustls", "rustls-pki-types", "tokio", - "tokio-rustls 0.26.0", + "tokio-rustls", "tower-service", "webpki-roots", ] @@ -1323,7 +1345,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2886843bf800fba2e3377cff24abf6379b4c4d5c6681eaf9ea5b0d15090450bd" dependencies = [ "libc", - "wasi", + "wasi 0.11.0+wasi-snapshot-preview1", "windows-sys 0.52.0", ] @@ -1339,7 +1361,7 @@ dependencies = [ "openssl-probe", "openssl-sys", "schannel", - "security-framework", + "security-framework 2.11.1", "security-framework-sys", "tempfile", ] @@ -1578,9 +1600,9 @@ dependencies = [ "quinn-proto", "quinn-udp", "rustc-hash", - "rustls 0.23.19", + "rustls", "socket2", - "thiserror 2.0.3", + "thiserror 2.0.12", "tokio", "tracing", ] @@ -1592,14 +1614,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a2fe5ef3495d7d2e377ff17b1a8ce2ee2ec2a18cde8b6ad6619d65d0701c135d" dependencies = [ "bytes", - "getrandom", - "rand", - "ring 0.17.8", + "getrandom 0.2.15", + "rand 0.8.5", + "ring", "rustc-hash", - "rustls 0.23.19", + "rustls", "rustls-pki-types", "slab", - "thiserror 2.0.3", + "thiserror 2.0.12", "tinyvec", "tracing", "web-time", @@ -1628,6 +1650,12 @@ dependencies = [ "proc-macro2", ] +[[package]] +name = "r-efi" +version = "5.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "74765f6d916ee2faa39bc8e68e4f3ed8949b48cccdac59983d287a7cb71ce9c5" + [[package]] name = "rand" version = "0.8.5" @@ -1635,8 +1663,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" dependencies = [ "libc", - "rand_chacha", - "rand_core", + "rand_chacha 0.3.1", + "rand_core 0.6.4", +] + +[[package]] +name = "rand" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9fbfd9d094a40bf3ae768db9361049ace4c0e04a4fd6b359518bd7b73a73dd97" +dependencies = [ + "rand_chacha 0.9.0", + "rand_core 0.9.3", ] [[package]] @@ -1646,7 +1684,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" dependencies = [ "ppv-lite86", - "rand_core", + "rand_core 0.6.4", +] + +[[package]] +name = "rand_chacha" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb" +dependencies = [ + "ppv-lite86", + "rand_core 0.9.3", ] [[package]] @@ -1655,7 +1703,16 @@ version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" dependencies = [ - "getrandom", + "getrandom 0.2.15", +] + +[[package]] +name = "rand_core" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38" +dependencies = [ + "getrandom 0.3.2", ] [[package]] @@ -1758,7 +1815,7 @@ dependencies = [ "percent-encoding", "pin-project-lite", "quinn", - "rustls 0.23.19", + "rustls", "rustls-pemfile", "rustls-pki-types", "serde", @@ -1767,7 +1824,7 @@ dependencies = [ "sync_wrapper", "tokio", "tokio-native-tls", - "tokio-rustls 0.26.0", + "tokio-rustls", "tokio-util", "tower-service", "url", @@ -1779,21 +1836,6 @@ dependencies = [ "windows-registry", ] -[[package]] -name = "ring" -version = "0.16.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3053cf52e236a3ed746dfc745aa9cacf1b791d846bdaf412f60a8d7d6e17c8fc" -dependencies = [ - "cc", - "libc", - "once_cell", - "spin 0.5.2", - "untrusted 0.7.1", - "web-sys", - "winapi", -] - [[package]] name = "ring" version = "0.17.8" @@ -1802,10 +1844,10 @@ checksum = "c17fa4cb658e3583423e915b9f3acc01cceaee1860e33d59ebae66adc3a2dc0d" dependencies = [ "cc", "cfg-if", - "getrandom", + "getrandom 0.2.15", "libc", - "spin 0.9.8", - "untrusted 0.9.0", + "spin", + "untrusted", "windows-sys 0.52.0", ] @@ -1824,7 +1866,7 @@ dependencies = [ "lazy_static", "native-tls", "reqwest", - "rustls 0.22.4", + "rustls", "rustls-pemfile", "serde", "serde_json", @@ -1847,18 +1889,20 @@ dependencies = [ "bytes", "cargo-tarpaulin", "futures-util", - "getrandom", + "getrandom 0.2.15", "log", "native-tls", - "rand", + "rand 0.8.5", "rust_engineio", - "rustls 0.22.4", + "rustls", + "rustls-pemfile", "serde", "serde_json", "serial_test", "thiserror 1.0.69", "tokio", "url", + "webpki", ] [[package]] @@ -1895,20 +1939,6 @@ dependencies = [ "windows-sys 0.52.0", ] -[[package]] -name = "rustls" -version = "0.22.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf4ef73721ac7bcd79b2b315da7779d8fc09718c6b3d2d1b2d94850eb8c18432" -dependencies = [ - "log", - "ring 0.17.8", - "rustls-pki-types", - "rustls-webpki", - "subtle", - "zeroize", -] - [[package]] name = "rustls" version = "0.23.19" @@ -1916,7 +1946,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "934b404430bb06b3fae2cba809eb45a1ab1aecd64491213d7c3301b88393f8d1" dependencies = [ "once_cell", - "ring 0.17.8", + "ring", "rustls-pki-types", "rustls-webpki", "subtle", @@ -1925,15 +1955,14 @@ dependencies = [ [[package]] name = "rustls-native-certs" -version = "0.7.3" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5bfb394eeed242e909609f56089eecfe5fda225042e8b171791b9c95f5931e5" +checksum = "7fcff2dd52b58a8d98a70243663a0d234c4e2b79235637849d15913394a247d3" dependencies = [ "openssl-probe", - "rustls-pemfile", "rustls-pki-types", "schannel", - "security-framework", + "security-framework 3.2.0", ] [[package]] @@ -1960,9 +1989,9 @@ version = "0.102.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "64ca1bc8749bd4cf37b5ce386cc146580777b4e8572c7b97baf22c83f444bee9" dependencies = [ - "ring 0.17.8", + "ring", "rustls-pki-types", - "untrusted 0.9.0", + "untrusted", ] [[package]] @@ -2017,7 +2046,20 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "897b2245f0b511c87893af39b033e5ca9cce68824c4d7e7630b5a1d339658d02" dependencies = [ "bitflags 2.6.0", - "core-foundation", + "core-foundation 0.9.4", + "core-foundation-sys", + "libc", + "security-framework-sys", +] + +[[package]] +name = "security-framework" +version = "3.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "271720403f46ca04f7ba6f55d438f8bd878d6b8ca0a1046e8228c4145bcbb316" +dependencies = [ + "bitflags 2.6.0", + "core-foundation 0.10.0", "core-foundation-sys", "libc", "security-framework-sys", @@ -2025,9 +2067,9 @@ dependencies = [ [[package]] name = "security-framework-sys" -version = "2.12.1" +version = "2.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa39c7303dc58b5543c94d22c1766b0d31f2ee58306363ea622b10bbc075eaa2" +checksum = "49db231d56a190491cb4aeda9527f1ad45345af50b0851622a7adb8c03b01c32" dependencies = [ "core-foundation-sys", "libc", @@ -2162,12 +2204,6 @@ dependencies = [ "windows-sys 0.52.0", ] -[[package]] -name = "spin" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" - [[package]] name = "spin" version = "0.9.8" @@ -2267,11 +2303,11 @@ dependencies = [ [[package]] name = "thiserror" -version = "2.0.3" +version = "2.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c006c85c7651b3cf2ada4584faa36773bd07bac24acfb39f3c431b36d7e667aa" +checksum = "567b8a2dae586314f7be2a752ec7474332959c6460e02bde30d702a66d488708" dependencies = [ - "thiserror-impl 2.0.3", + "thiserror-impl 2.0.12", ] [[package]] @@ -2287,9 +2323,9 @@ dependencies = [ [[package]] name = "thiserror-impl" -version = "2.0.3" +version = "2.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f077553d607adc1caf65430528a576c757a71ed73944b66ebb58ef2bbd243568" +checksum = "7f7cf42b4507d8ea322120659672cf1b9dbb93f8f2d4ecfd6e51350ff5b17a1d" dependencies = [ "proc-macro2", "quote", @@ -2378,43 +2414,32 @@ dependencies = [ "tokio", ] -[[package]] -name = "tokio-rustls" -version = "0.25.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "775e0c0f0adb3a2f22a00c4745d728b479985fc15ee7ca6a2608388c5569860f" -dependencies = [ - "rustls 0.22.4", - "rustls-pki-types", - "tokio", -] - [[package]] name = "tokio-rustls" version = "0.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0c7bc40d0e5a97695bb96e27995cd3a08538541b0a846f65bba7a359f36700d4" dependencies = [ - "rustls 0.23.19", + "rustls", "rustls-pki-types", "tokio", ] [[package]] name = "tokio-tungstenite" -version = "0.21.0" +version = "0.26.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c83b561d025642014097b66e6c1bb422783339e0909e4429cde4749d1990bc38" +checksum = "7a9daff607c6d2bf6c16fd681ccb7eecc83e4e2cdc1ca067ffaadfca5de7f084" dependencies = [ "futures-util", "log", "native-tls", - "rustls 0.22.4", + "rustls", "rustls-native-certs", "rustls-pki-types", "tokio", "tokio-native-tls", - "tokio-rustls 0.25.0", + "tokio-rustls", "tungstenite", "webpki-roots", ] @@ -2505,22 +2530,21 @@ checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" [[package]] name = "tungstenite" -version = "0.21.0" +version = "0.26.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ef1a641ea34f399a848dea702823bbecfb4c486f911735368f1f137cb8257e1" +checksum = "4793cb5e56680ecbb1d843515b23b6de9a75eb04b66643e256a396d43be33c13" dependencies = [ - "byteorder", "bytes", "data-encoding", "http", "httparse", "log", "native-tls", - "rand", - "rustls 0.22.4", + "rand 0.9.1", + "rustls", "rustls-pki-types", "sha1", - "thiserror 1.0.69", + "thiserror 2.0.12", "url", "utf-8", ] @@ -2543,12 +2567,6 @@ version = "0.1.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af" -[[package]] -name = "untrusted" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" - [[package]] name = "untrusted" version = "0.9.0" @@ -2633,6 +2651,15 @@ version = "0.11.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" +[[package]] +name = "wasi" +version = "0.14.2+wasi-0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9683f9a5a998d873c0d21fcbe3c083009670149a8fab228644b8bd36b2c48cb3" +dependencies = [ + "wit-bindgen-rt", +] + [[package]] name = "wasm-bindgen" version = "0.2.97" @@ -2736,12 +2763,12 @@ dependencies = [ [[package]] name = "webpki" -version = "0.21.4" +version = "0.22.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8e38c0608262c46d4a56202ebabdeb094cef7e560ca7a226c6bf055188aa4ea" +checksum = "ed63aea5ce73d0ff405984102c42de94fc55a6b75765d621c65262469b3c9b53" dependencies = [ - "ring 0.16.20", - "untrusted 0.7.1", + "ring", + "untrusted", ] [[package]] @@ -2905,6 +2932,15 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" +[[package]] +name = "wit-bindgen-rt" +version = "0.39.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f42320e61fe2cfd34354ecb597f86f413484a798ba44a8ca1165c58d42da6c1" +dependencies = [ + "bitflags 2.6.0", +] + [[package]] name = "write16" version = "1.0.0" diff --git a/engineio/Cargo.toml b/engineio/Cargo.toml index a5d959d6..9a9524d3 100644 --- a/engineio/Cargo.toml +++ b/engineio/Cargo.toml @@ -21,24 +21,22 @@ adler32 = "1.2.0" serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" http = "1.1.0" -tokio-tungstenite = { version = "0.21.0", features = [] } -tungstenite = "0.21.0" +tokio-tungstenite = { version = "0.26.0", features = ["url"] } +tungstenite = "0.26.0" tokio = "1.40.0" futures-util = { version = "0.3", default-features = false, features = ["sink"] } async-trait = "0.1.83" async-stream = "0.3.6" thiserror = "1.0" native-tls = { version = "^0.2", optional = true } -rustls = { version = "^0.22", optional = true } -# rustls-pemfile is only needed for unit tests +rustls = { version = "^0.23", default-features = false, optional = true } rustls-pemfile = { version = "2", optional = true } -# webpki is only needed for unit tests -webpki = { version = "0.22", optional = true } url = "2.5.4" [dev-dependencies] criterion = { version = "0.5.1", features = ["async_tokio"] } lazy_static = "1.4.0" +webpki = "0.22" [dev-dependencies.tokio] version = "1.40.0" @@ -65,11 +63,13 @@ rustls-tls-native-roots = ["tokio-tungstenite/rustls-tls-native-roots", "_rustls rustls-tls-webpki-roots = ["tokio-tungstenite/rustls-tls-webpki-roots", "_rustls-tls"] # These features are for internal use only _native-tls = ["dep:native-tls", "reqwest/native-tls"] -_rustls-tls = ["dep:rustls", "reqwest/rustls-tls", "dep:rustls-pemfile", "dep:webpki"] +_rustls-tls = ["dep:rustls", "reqwest/rustls-tls"] # This is an internal feature to allow us to build using cargo-all-features and guaranteing that we always have one TLS implementation # Do not use this feature directly _fallback-tls = ["native-tls"] +# this is an internal feature to expose test configs to the socketio crate +_test = ["dep:rustls-pemfile"] [lints.rust] unexpected_cfgs = { level = "warn", check-cfg = ['cfg(tarpaulin)'] } diff --git a/engineio/src/asynchronous/async_transports/websocket_general.rs b/engineio/src/asynchronous/async_transports/websocket_general.rs index 2b23a8eb..cd7cedd7 100644 --- a/engineio/src/asynchronous/async_transports/websocket_general.rs +++ b/engineio/src/asynchronous/async_transports/websocket_general.rs @@ -1,4 +1,4 @@ -use std::{borrow::Cow, str::from_utf8, sync::Arc, task::Poll}; +use std::{sync::Arc, task::Poll}; use crate::{error::Result, Error, Packet, PacketId}; use bytes::{BufMut, Bytes, BytesMut}; @@ -9,7 +9,7 @@ use futures_util::{ }; use tokio::{net::TcpStream, sync::Mutex}; use tokio_tungstenite::{MaybeTlsStream, WebSocketStream}; -use tungstenite::Message; +use tungstenite::{Message, Utf8Bytes}; type AsyncWebsocketSender = SplitSink>, Message>; type AsyncWebsocketReceiver = SplitStream>>; @@ -42,9 +42,9 @@ impl AsyncWebsocketGeneralTransport { let mut sender = self.sender.lock().await; sender - .send(Message::text(Cow::Borrowed(from_utf8(&Bytes::from( + .send(Message::text(Utf8Bytes::try_from(Bytes::from( Packet::new(PacketId::Ping, Bytes::from("probe")), - ))?))) + ))?)) .await?; let msg = receiver @@ -57,9 +57,9 @@ impl AsyncWebsocketGeneralTransport { } sender - .send(Message::text(Cow::Borrowed(from_utf8(&Bytes::from( + .send(Message::text(Utf8Bytes::try_from(Bytes::from( Packet::new(PacketId::Upgrade, Bytes::from("")), - ))?))) + ))?)) .await?; Ok(()) @@ -69,9 +69,9 @@ impl AsyncWebsocketGeneralTransport { let mut sender = self.sender.lock().await; let message = if is_binary_att { - Message::binary(Cow::Borrowed(data.as_ref())) + Message::binary(data) } else { - Message::text(Cow::Borrowed(std::str::from_utf8(data.as_ref())?)) + Message::text(Utf8Bytes::try_from(data)?) }; sender.send(message).await?; diff --git a/engineio/src/asynchronous/async_transports/websocket_secure.rs b/engineio/src/asynchronous/async_transports/websocket_secure.rs index 0e073152..d74228aa 100644 --- a/engineio/src/asynchronous/async_transports/websocket_secure.rs +++ b/engineio/src/asynchronous/async_transports/websocket_secure.rs @@ -16,7 +16,6 @@ use tungstenite::client::IntoClientRequest; use url::Url; use super::websocket_general::AsyncWebsocketGeneralTransport; -use crate::TlsConfig; /// An asynchronous websocket transport type. /// This type only allows for secure websocket @@ -32,7 +31,7 @@ impl WebsocketSecureTransport { /// Tls connector and an URL. pub(crate) async fn new( base_url: Url, - tls_config: Option, + tls_config: Option, headers: Option, ) -> Result { let mut url = base_url; diff --git a/engineio/src/asynchronous/client/async_client.rs b/engineio/src/asynchronous/client/async_client.rs index 0d5c9c1c..8b64ea38 100644 --- a/engineio/src/asynchronous/client/async_client.rs +++ b/engineio/src/asynchronous/client/async_client.rs @@ -383,12 +383,12 @@ mod test { headers.insert(HOST, host); let _ = builder(url.clone()) - .tls_config( - TlsConfig::builder() - .danger_accept_invalid_certs(true) - .build() - .unwrap(), - ) + // .tls_config( + // TlsConfig::builder() + // .danger_accept_invalid_certs(true) + // .build() + // .unwrap(), + // ) .build() .await?; let _ = builder(url).headers(headers).build().await?; diff --git a/engineio/src/lib.rs b/engineio/src/lib.rs index a9508793..7d32c4eb 100644 --- a/engineio/src/lib.rs +++ b/engineio/src/lib.rs @@ -116,26 +116,18 @@ compile_error!("Both native-tls and rustls features are enabled. Please enable o #[cfg(not(any(feature = "_native-tls", feature = "_rustls-tls")))] compile_error!("No TLS feature is enabled. Please enable either native-tls or rustls."); -#[cfg(test)] -pub(crate) mod test { +#[cfg(any(feature = "_test", test))] +pub mod test { use super::*; - #[cfg(feature = "_native-tls")] - use native_tls::TlsConnector; const CERT_PATH: &str = "../ci/cert/ca.crt"; - #[cfg(all(feature = "_native-tls", not(feature = "_rustls-tls")))] - use native_tls::Certificate; - use std::fs::File; - use std::io::Read; - pub(crate) fn tls_connector() -> error::Result { + pub fn tls_connector() -> error::Result { let cert_path = std::env::var("CA_CERT_PATH").unwrap_or_else(|_| CERT_PATH.to_owned()); - let mut cert_file = File::open(cert_path)?; - let mut buf = vec![]; - cert_file.read_to_end(&mut buf)?; + let buf = std::fs::read(cert_path)?; #[cfg(all(feature = "_native-tls", not(feature = "_rustls-tls")))] { - let cert: Certificate = Certificate::from_pem(&buf[..]).unwrap(); - Ok(TlsConnector::builder() + let cert = native_tls::Certificate::from_pem(&buf[..]).unwrap(); + Ok(native_tls::TlsConnector::builder() // ONLY USE FOR TESTING! .danger_accept_invalid_hostnames(true) .add_root_certificate(cert) diff --git a/socketio/Cargo.toml b/socketio/Cargo.toml index 2905e56f..35629c97 100644 --- a/socketio/Cargo.toml +++ b/socketio/Cargo.toml @@ -29,12 +29,15 @@ async-stream = { version = "0.3.6", optional = true } log = "0.4.22" serde = "1.0.209" native-tls = { version = "0.2", optional = true } -rustls = { version = "0.22", optional = true } +rustls = { version = "0.23", default-features = false, optional = true } getrandom = "0.2.10" [dev-dependencies] cargo-tarpaulin = "0.18.5" serial_test = "3.0.0" +rustls-pemfile = "2" +webpki = "0.22" +rust_engineio = { version = "0.6.0", path = "../engineio", default-features = false, features = ["_test"] } [dev-dependencies.tokio] version = "1.40.0" diff --git a/socketio/examples/secure.rs b/socketio/examples/secure.rs index 6204994b..8b27769f 100644 --- a/socketio/examples/secure.rs +++ b/socketio/examples/secure.rs @@ -1,26 +1,13 @@ -use native_tls::Certificate; -use native_tls::TlsConnector; use rust_socketio::ClientBuilder; -use std::fs::File; -use std::io::Read; fn main() { // In case a trusted CA is needed that isn't in the trust chain. let cert_path = "ca.crt"; - let mut cert_file = File::open(cert_path).expect("Failed to open cert"); - let mut buf = vec![]; - cert_file - .read_to_end(&mut buf) - .expect("Failed to read cert"); - let cert: Certificate = Certificate::from_pem(&buf[..]).unwrap(); - - let tls_connector = TlsConnector::builder() - .add_root_certificate(cert) - .build() - .expect("Failed to build TLS Connector"); + let buf = std::fs::read(cert_path).expect("Failed to open cert"); + // Create a socket.io client let socket = ClientBuilder::new("https://localhost:4200") - .tls_config(tls_connector) + .tls_config(tls_connector(&buf)) // Not strictly required for HTTPS .opening_header("HOST", "localhost") .on("error", |err, _| eprintln!("Error: {:#?}", err)) @@ -28,6 +15,32 @@ fn main() { .expect("Connection failed"); // use the socket - socket.disconnect().expect("Disconnect failed") } + +fn tls_connector(buf: &[u8]) -> rust_socketio::TlsConfig { + #[cfg(all(feature = "_native-tls", not(feature = "_rustls-tls")))] + { + let cert = native_tls::Certificate::from_pem(buf).unwrap(); + native_tls::TlsConnector::builder() + // ONLY USE FOR TESTING! + .danger_accept_invalid_hostnames(true) + .add_root_certificate(cert) + .build() + .unwrap() + } + #[cfg(feature = "_rustls-tls")] + { + let mut root_store = rustls::RootCertStore::empty(); + for cert in rustls_pemfile::certs(&mut &buf[..]) { + root_store + .add(cert.expect("Invalid PEM cert")) + .expect("Failed to add cert to store"); + } + let mut config = rustls::ClientConfig::builder() + .with_root_certificates(root_store) + .with_no_client_auth(); + config.enable_sni = false; + config + } +} diff --git a/socketio/src/asynchronous/client/client.rs b/socketio/src/asynchronous/client/client.rs index 01991056..1ff37d8a 100644 --- a/socketio/src/asynchronous/client/client.rs +++ b/socketio/src/asynchronous/client/client.rs @@ -609,7 +609,7 @@ mod test { }; use bytes::Bytes; - use futures_util::{FutureExt, StreamExt}; + use futures_util::{stream::All, FutureExt, StreamExt}; use native_tls::TlsConnector; use serde_json::json; use serial_test::serial; @@ -628,6 +628,8 @@ mod test { CloseReason, Event, Payload, TransportType, }; + use rust_engineio::test::tls_connector; + #[tokio::test] async fn socket_io_integration() -> Result<()> { let url = crate::test::socket_io_server(); @@ -725,14 +727,9 @@ mod test { // test socket build logic let socket_builder = ClientBuilder::new(url); - let tls_connector = TlsConnector::builder() - .use_sni(true) - .build() - .expect("Found illegal configuration"); - let socket = socket_builder .namespace("/admin") - .tls_config(tls_connector) + .tls_config(tls_connector()?) .opening_header("accept-encoding", "application/json") .on("test", |str, _| { async move { println!("Received: {:#?}", str) }.boxed() @@ -884,14 +881,9 @@ mod test { // test socket build logic let socket_builder = ClientBuilder::new(url); - let tls_connector = TlsConnector::builder() - .use_sni(true) - .build() - .expect("Found illegal configuration"); - let socket = socket_builder .namespace("/admin") - .tls_config(tls_connector) + .tls_config(tls_connector()?) .opening_header("accept-encoding", "application/json") .on("test", |str, _| { async move { println!("Received: {:#?}", str) }.boxed() diff --git a/socketio/src/client/raw_client.rs b/socketio/src/client/raw_client.rs index 7c0901c6..cd9567d5 100644 --- a/socketio/src/client/raw_client.rs +++ b/socketio/src/client/raw_client.rs @@ -425,7 +425,7 @@ mod test { use serde_json::json; use std::time::Duration; - #[cfg(feature = "_native-tls")] + #[cfg(all(feature = "_native-tls", not(feature = "_rustls-tls")))] fn tls_config() -> native_tls::TlsConnector { native_tls::TlsConnector::builder() .use_sni(true) From 69c9aca9b9b6289e31bc733039ffe30334b3f4df Mon Sep 17 00:00:00 2001 From: Tyler Hawkes Date: Fri, 18 Apr 2025 13:07:20 -0600 Subject: [PATCH 12/15] Fix doc tests to work with both features --- .../async_transports/websocket_secure.rs | 3 +- socketio/src/client/builder.rs | 54 +++++++++++++------ 2 files changed, 39 insertions(+), 18 deletions(-) diff --git a/engineio/src/asynchronous/async_transports/websocket_secure.rs b/engineio/src/asynchronous/async_transports/websocket_secure.rs index d74228aa..0e073152 100644 --- a/engineio/src/asynchronous/async_transports/websocket_secure.rs +++ b/engineio/src/asynchronous/async_transports/websocket_secure.rs @@ -16,6 +16,7 @@ use tungstenite::client::IntoClientRequest; use url::Url; use super::websocket_general::AsyncWebsocketGeneralTransport; +use crate::TlsConfig; /// An asynchronous websocket transport type. /// This type only allows for secure websocket @@ -31,7 +32,7 @@ impl WebsocketSecureTransport { /// Tls connector and an URL. pub(crate) async fn new( base_url: Url, - tls_config: Option, + tls_config: Option, headers: Option, ) -> Result { let mut url = base_url; diff --git a/socketio/src/client/builder.rs b/socketio/src/client/builder.rs index e7241d8e..223fc000 100644 --- a/socketio/src/client/builder.rs +++ b/socketio/src/client/builder.rs @@ -209,23 +209,43 @@ impl ClientBuilder { /// Uses a preconfigured TLS connector for secure communication. This configures /// both the `polling` as well as the `websocket` transport type. - /// # Example - /// ```rust - /// use rust_socketio::{ClientBuilder, Payload}; - /// use native_tls::TlsConnector; - /// - /// let tls_connector = TlsConnector::builder() - /// .use_sni(true) - /// .build() - /// .expect("Found illegal configuration"); - /// - /// let socket = ClientBuilder::new("http://localhost:4200/") - /// .namespace("/admin") - /// .on("error", |err, _| eprintln!("Error: {:#?}", err)) - /// .tls_config(tls_connector) - /// .connect(); - /// - /// ``` + #[cfg_attr(feature = "_native-tls", doc = "# Example for native-tls")] + #[cfg_attr( + feature = "_native-tls", + doc = r#" + + let tls_connector = native_tls::TlsConnector::builder() + .use_sni(true) + .build() + .expect("Found illegal configuration"); + + # #[cfg(not(feature = "_rustls-tls"))] { + let socket = rust_socketio::ClientBuilder::new("http://localhost:4200/") + .namespace("/admin") + .on("error", |err, _| eprintln!("Error: {:#?}", err)) + .tls_config(tls_connector) + .connect(); + # } + "# + )] + #[cfg_attr(feature = "_rustls-tls", doc = "# Example for rustls")] + #[cfg_attr( + feature = "_rustls-tls", + doc = r#" + + use rust_socketio::{ClientBuilder, Payload}; + + let tls_connector = rustls::ClientConfig::builder() + .with_root_certificates(rustls::RootCertStore::empty()) + .with_no_client_auth(); + + let socket = rust_socketio::ClientBuilder::new("http://localhost:4200/") + .namespace("/admin") + .on("error", |err, _| eprintln!("Error: {:#?}", err)) + .tls_config(tls_connector) + .connect(); + "# + )] pub fn tls_config(mut self, tls_config: TlsConfig) -> Self { self.tls_config = Some(tls_config); self From 1f25912f9517079d0382aad19bb997ea08efd33d Mon Sep 17 00:00:00 2001 From: Tyler Hawkes Date: Mon, 21 Apr 2025 13:05:49 -0600 Subject: [PATCH 13/15] Fix issue with tests where provided server keys/certs weren't allowing localhost --- .gitignore | 1 + ci/keygen.sh | 66 +++---------------------------------------- ci/keygen/Cargo.toml | 9 ++++++ ci/keygen/src/main.rs | 60 +++++++++++++++++++++++++++++++++++++++ 4 files changed, 74 insertions(+), 62 deletions(-) create mode 100644 ci/keygen/Cargo.toml create mode 100644 ci/keygen/src/main.rs diff --git a/.gitignore b/.gitignore index 22e6dfbc..f6c92474 100644 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,5 @@ target ci/node_modules ci/package-lock.json ci/cert +ci/keygen/Cargo.lock diff --git a/ci/keygen.sh b/ci/keygen.sh index b0d63910..64c44fca 100755 --- a/ci/keygen.sh +++ b/ci/keygen.sh @@ -7,68 +7,10 @@ then exit 1 fi -DOMAIN="$1" -IP="$2" -CA_NAME=${CA_NAME:-"rust-socketio-dev"} +export DOMAIN="$1" +export IP="$2" +export CA_NAME=${CA_NAME:-"rust-socketio-dev"} mkdir cert || true -cd cert -# Credit https://scriptcrunch.com/create-ca-tls-ssl-certificates-keys/ -if [ ! -f ca.key ] -then - echo "Generating CA key" - openssl genrsa -out ca.key 4096 -fi - -if [ ! -f "ca.crt" ] -then - echo "Generating CA cert" - openssl req -x509 -new -nodes -key ca.key -subj "/CN=${CA_NAME}/C=??/L=Varius" -out ca.crt -fi - -if [ ! -f "server.key" ] -then - echo "Generating server key" - openssl genrsa -out server.key 4096 -fi - -if [ ! -f "csr.conf" ] -then - echo """ -[ req ] -default_bits = 4096 -prompt = no -default_md = sha256 -req_extensions = req_ext -distinguished_name = dn - -[ dn ] -C = ?? -ST = Varius -L = Varius -O = ${DOMAIN} -OU = ${DOMAIN} -CN = ${DOMAIN} - -[ req_ext ] -subjectAltName = @alt_names - -[ alt_names ] -DNS.1 = ${DOMAIN} -DNS.2 = localhost -IP.1 = ${IP} -""" > csr.conf -fi - -if [ ! -f "server.csr" ] -then - echo "Generating server signing request" - openssl req -new -key server.key -out server.csr -config csr.conf -fi - -if [ ! -f "server.crt" ] -then - echo "Generating signed server certifcicate" - openssl x509 -req -in server.csr -CA ca.crt -CAkey ca.key -CAcreateserial -out server.crt -extfile csr.conf -fi +cargo run --manifest-path keygen/Cargo.toml \ No newline at end of file diff --git a/ci/keygen/Cargo.toml b/ci/keygen/Cargo.toml new file mode 100644 index 00000000..7b891664 --- /dev/null +++ b/ci/keygen/Cargo.toml @@ -0,0 +1,9 @@ +[package] +name = "keygen" +version = "0.1.0" +edition = "2024" + +[workspace] + +[dependencies] +rcgen = "0.13.2" diff --git a/ci/keygen/src/main.rs b/ci/keygen/src/main.rs new file mode 100644 index 00000000..3816afb3 --- /dev/null +++ b/ci/keygen/src/main.rs @@ -0,0 +1,60 @@ +use rcgen::{ + BasicConstraints, CertificateParams, DistinguishedName, DnType, ExtendedKeyUsagePurpose, IsCa, + KeyPair, KeyUsagePurpose, +}; + +// Copied from https://github.com/rustls/tokio-rustls/commit/6f7373dad47df0b071c8f0f1a03376bed08331e7/tests/certs/main.rs +fn main() { + let domain = std::env::var("DOMAIN").expect("DOMAIN not set"); + let ip = std::env::var("IP").expect("IP not set"); + let ca_name = std::env::var("CA_NAME").unwrap_or_else(|_| "rust-socketio-dev".to_string()); + + let root_key = KeyPair::generate().unwrap(); + let root_ca = issuer_params(&ca_name).self_signed(&root_key).unwrap(); + + std::fs::write("cert/ca.crt", root_ca.pem().as_bytes()).unwrap(); + + let intermediate_key = KeyPair::generate().unwrap(); + let intermediate_ca = issuer_params("Socketio Root - Rung 2") + .signed_by(&intermediate_key, &root_ca, &root_key) + .unwrap(); + + let end_entity_key = KeyPair::generate().unwrap(); + let mut end_entity_params = + CertificateParams::new(vec![domain, ip, "localhost".to_string()]).unwrap(); + end_entity_params.is_ca = IsCa::ExplicitNoCa; + end_entity_params.extended_key_usages = vec![ + ExtendedKeyUsagePurpose::ServerAuth, + ExtendedKeyUsagePurpose::ClientAuth, + ]; + let end_entity = end_entity_params + .signed_by(&end_entity_key, &intermediate_ca, &intermediate_key) + .unwrap(); + + std::fs::write( + "cert/server.crt", + end_entity + .pem() + .as_bytes() + .iter() + .chain(intermediate_ca.pem().as_bytes()) + .copied() + .collect::>(), + ) + .unwrap(); + + std::fs::write("cert/server.key", end_entity_key.serialize_pem()).unwrap(); +} + +fn issuer_params(common_name: &str) -> CertificateParams { + let mut issuer_name = DistinguishedName::new(); + issuer_name.push(DnType::CommonName, common_name); + let mut issuer_params = CertificateParams::default(); + issuer_params.distinguished_name = issuer_name; + issuer_params.is_ca = IsCa::Ca(BasicConstraints::Unconstrained); + issuer_params.key_usages = vec![ + KeyUsagePurpose::KeyCertSign, + KeyUsagePurpose::DigitalSignature, + ]; + issuer_params +} From d8c2ab2add0fac0c949da8ef1074ea0f80ba029f Mon Sep 17 00:00:00 2001 From: Tyler Hawkes Date: Mon, 21 Apr 2025 15:21:58 -0600 Subject: [PATCH 14/15] Fix doc tests where the type changes and run tests for both tls backends --- Makefile | 2 + engineio/Cargo.toml | 1 + socketio/src/asynchronous/client/builder.rs | 62 ++++++++++++++------- socketio/src/client/builder.rs | 56 ++++++++++--------- 4 files changed, 74 insertions(+), 47 deletions(-) diff --git a/Makefile b/Makefile index 00771721..81a9bc15 100644 --- a/Makefile +++ b/Makefile @@ -15,6 +15,8 @@ run-test-servers: test-all: keys run-test-servers @cargo test --verbose --all-features + # Test using the native-tls implementation since rustls overrides native-tls + @cargo test --verbose --features async docker stop socketio_test clippy: diff --git a/engineio/Cargo.toml b/engineio/Cargo.toml index 9a9524d3..d3c6d236 100644 --- a/engineio/Cargo.toml +++ b/engineio/Cargo.toml @@ -36,6 +36,7 @@ url = "2.5.4" [dev-dependencies] criterion = { version = "0.5.1", features = ["async_tokio"] } lazy_static = "1.4.0" +rustls-pemfile = "2" webpki = "0.22" [dev-dependencies.tokio] diff --git a/socketio/src/asynchronous/client/builder.rs b/socketio/src/asynchronous/client/builder.rs index cbbfce08..b629a712 100644 --- a/socketio/src/asynchronous/client/builder.rs +++ b/socketio/src/asynchronous/client/builder.rs @@ -264,27 +264,47 @@ impl ClientBuilder { /// Uses a preconfigured TLS connector for secure communication. This configures /// both the `polling` as well as the `websocket` transport type. - /// # Example - /// ```rust - /// use rust_socketio::{asynchronous::ClientBuilder, Payload}; - /// use native_tls::TlsConnector; - /// use futures_util::future::FutureExt; - /// - /// #[tokio::main] - /// async fn main() { - /// let tls_connector = TlsConnector::builder() - /// .use_sni(true) - /// .build() - /// .expect("Found illegal configuration"); - /// - /// let socket = ClientBuilder::new("http://localhost:4200/") - /// .namespace("/admin") - /// .on("error", |err, _| async move { eprintln!("Error: {:#?}", err) }.boxed()) - /// .tls_config(tls_connector) - /// .connect() - /// .await; - /// } - /// ``` + #[cfg_attr( + feature = "_native-tls", + doc = r#" +# Example for native-tls + +```rust +use rust_socketio::{ClientBuilder, Payload}; + +let tls_connector = native_tls::TlsConnector::builder() + .use_sni(true) + .build() + .expect("Found illegal configuration"); + +# #[cfg(not(feature = "_rustls-tls"))] { +let socket = ClientBuilder::new("http://localhost:4200/") + .namespace("/admin") + .on("error", |err, _| eprintln!("Error: {:#?}", err)) + .tls_config(tls_connector) + .connect(); +# } +```"# + )] + #[cfg_attr( + feature = "_rustls-tls", + doc = r#" +# Example for rustls + +```rust +use rust_socketio::{ClientBuilder, Payload}; + +let tls_config = rustls::ClientConfig::builder() + .with_root_certificates(rustls::RootCertStore::empty()) + .with_no_client_auth(); + +let socket = ClientBuilder::new("http://localhost:4200/") + .namespace("/admin") + .on("error", |err, _| eprintln!("Error: {:#?}", err)) + .tls_config(tls_config) + .connect(); +```"# + )] pub fn tls_config(mut self, tls_config: TlsConfig) -> Self { self.tls_config = Some(tls_config); self diff --git a/socketio/src/client/builder.rs b/socketio/src/client/builder.rs index 223fc000..35fdc077 100644 --- a/socketio/src/client/builder.rs +++ b/socketio/src/client/builder.rs @@ -209,42 +209,46 @@ impl ClientBuilder { /// Uses a preconfigured TLS connector for secure communication. This configures /// both the `polling` as well as the `websocket` transport type. - #[cfg_attr(feature = "_native-tls", doc = "# Example for native-tls")] #[cfg_attr( feature = "_native-tls", doc = r#" - - let tls_connector = native_tls::TlsConnector::builder() - .use_sni(true) - .build() - .expect("Found illegal configuration"); - - # #[cfg(not(feature = "_rustls-tls"))] { - let socket = rust_socketio::ClientBuilder::new("http://localhost:4200/") - .namespace("/admin") - .on("error", |err, _| eprintln!("Error: {:#?}", err)) - .tls_config(tls_connector) - .connect(); - # } - "# +# Example for native-tls + +```rust +use rust_socketio::{ClientBuilder, Payload}; + +let tls_connector = native_tls::TlsConnector::builder() + .use_sni(true) + .build() + .expect("Found illegal configuration"); + +# #[cfg(not(feature = "_rustls-tls"))] { +let socket = ClientBuilder::new("http://localhost:4200/") + .namespace("/admin") + .on("error", |err, _| eprintln!("Error: {:#?}", err)) + .tls_config(tls_connector) + .connect(); +# } +```"# )] - #[cfg_attr(feature = "_rustls-tls", doc = "# Example for rustls")] #[cfg_attr( feature = "_rustls-tls", doc = r#" +# Example for rustls - use rust_socketio::{ClientBuilder, Payload}; +```rust +use rust_socketio::{ClientBuilder, Payload}; - let tls_connector = rustls::ClientConfig::builder() - .with_root_certificates(rustls::RootCertStore::empty()) - .with_no_client_auth(); +let tls_config = rustls::ClientConfig::builder() + .with_root_certificates(rustls::RootCertStore::empty()) + .with_no_client_auth(); - let socket = rust_socketio::ClientBuilder::new("http://localhost:4200/") - .namespace("/admin") - .on("error", |err, _| eprintln!("Error: {:#?}", err)) - .tls_config(tls_connector) - .connect(); - "# +let socket = ClientBuilder::new("http://localhost:4200/") + .namespace("/admin") + .on("error", |err, _| eprintln!("Error: {:#?}", err)) + .tls_config(tls_config) + .connect(); +```"# )] pub fn tls_config(mut self, tls_config: TlsConfig) -> Self { self.tls_config = Some(tls_config); From e0805aea6288b67a90c43e5c87b0ff7e752a5790 Mon Sep 17 00:00:00 2001 From: Tyler Hawkes Date: Wed, 23 Apr 2025 12:20:46 -0600 Subject: [PATCH 15/15] Fix async client tests and other items from review --- .../src/asynchronous/client/async_client.rs | 11 +--- engineio/src/lib.rs | 2 +- socketio/src/asynchronous/client/builder.rs | 54 +++++++++++-------- 3 files changed, 35 insertions(+), 32 deletions(-) diff --git a/engineio/src/asynchronous/client/async_client.rs b/engineio/src/asynchronous/client/async_client.rs index 8b64ea38..1b4162dc 100644 --- a/engineio/src/asynchronous/client/async_client.rs +++ b/engineio/src/asynchronous/client/async_client.rs @@ -92,7 +92,6 @@ impl Debug for Client { mod test { use super::*; - use crate::TlsConfig; use crate::{asynchronous::ClientBuilder, header::HeaderMap, packet::PacketId, Error}; use bytes::Bytes; use futures_util::StreamExt; @@ -382,15 +381,7 @@ mod test { std::env::var("ENGINE_IO_SECURE_HOST").unwrap_or_else(|_| "localhost".to_owned()); headers.insert(HOST, host); - let _ = builder(url.clone()) - // .tls_config( - // TlsConfig::builder() - // .danger_accept_invalid_certs(true) - // .build() - // .unwrap(), - // ) - .build() - .await?; + let _ = builder(url.clone()).build().await?; let _ = builder(url).headers(headers).build().await?; Ok(()) } diff --git a/engineio/src/lib.rs b/engineio/src/lib.rs index ccf8cd13..07b0e839 100644 --- a/engineio/src/lib.rs +++ b/engineio/src/lib.rs @@ -120,7 +120,7 @@ compile_error!("No TLS feature is enabled. Please enable either native-tls or ru pub mod test { use super::*; #[cfg(test)] - use test_inner::*; + pub(crate) use test_inner::*; const CERT_PATH: &str = "../ci/cert/ca.crt"; pub fn tls_connector() -> error::Result { diff --git a/socketio/src/asynchronous/client/builder.rs b/socketio/src/asynchronous/client/builder.rs index b629a712..842992d6 100644 --- a/socketio/src/asynchronous/client/builder.rs +++ b/socketio/src/asynchronous/client/builder.rs @@ -270,20 +270,26 @@ impl ClientBuilder { # Example for native-tls ```rust -use rust_socketio::{ClientBuilder, Payload}; +use rust_socketio::{asynchronous::ClientBuilder, Payload}; +use futures_util::future::FutureExt; -let tls_connector = native_tls::TlsConnector::builder() - .use_sni(true) - .build() - .expect("Found illegal configuration"); +#[tokio::main] +async fn main() -> Result<(), Box> { + let tls_connector = native_tls::TlsConnector::builder() + .use_sni(true) + .build() + .expect("Found illegal configuration"); # #[cfg(not(feature = "_rustls-tls"))] { -let socket = ClientBuilder::new("http://localhost:4200/") - .namespace("/admin") - .on("error", |err, _| eprintln!("Error: {:#?}", err)) - .tls_config(tls_connector) - .connect(); + let socket = ClientBuilder::new("http://localhost:4200/") + .namespace("/admin") + .on("error", |err, _| async move { eprintln!("Error: {:#?}", err) }.boxed()) + .tls_config(tls_connector) + .connect() + .await?; # } + Ok(()) +} ```"# )] #[cfg_attr( @@ -292,17 +298,23 @@ let socket = ClientBuilder::new("http://localhost:4200/") # Example for rustls ```rust -use rust_socketio::{ClientBuilder, Payload}; - -let tls_config = rustls::ClientConfig::builder() - .with_root_certificates(rustls::RootCertStore::empty()) - .with_no_client_auth(); - -let socket = ClientBuilder::new("http://localhost:4200/") - .namespace("/admin") - .on("error", |err, _| eprintln!("Error: {:#?}", err)) - .tls_config(tls_config) - .connect(); +use rust_socketio::{asynchronous::ClientBuilder, Payload}; +use futures_util::future::FutureExt; + +#[tokio::main] +async fn main() -> Result<(), Box> { + let tls_config = rustls::ClientConfig::builder() + .with_root_certificates(rustls::RootCertStore::empty()) + .with_no_client_auth(); + + let socket = ClientBuilder::new("http://localhost:4200/") + .namespace("/admin") + .on("error", |err, _| async move { eprintln!("Error: {:#?}", err) }.boxed()) + .tls_config(tls_config) + .connect() + .await?; + Ok(()) +} ```"# )] pub fn tls_config(mut self, tls_config: TlsConfig) -> Self {