diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1fbdb31..49ba090 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,7 +13,7 @@ on: concurrency: group: tests-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} cancel-in-progress: true - + env: MSRV: "1.76" RUST_BACKTRACE: 1 diff --git a/Cargo.lock b/Cargo.lock index 0295eaf..f2e7f5a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,9 +4,9 @@ version = 3 [[package]] name = "addr2line" -version = "0.20.0" +version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4fa78e18c64fce05e902adecd7a5eed15a5e0a3439f7b0e169f0252214865e3" +checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb" dependencies = [ "gimli", ] @@ -19,9 +19,21 @@ checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" [[package]] name = "anyhow" -version = "1.0.73" +version = "1.0.83" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f768393e7fabd388fe8409b13faa4d93ab0fef35db1508438dfdb066918bcf38" +checksum = "25bdb32cbbdce2b519a9cd7df3a678443100e265d5e25ca763b7572a5104f5f3" + +[[package]] +name = "arrayref" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b4930d2cb77ce62f89ee5d5289b4ac049559b1c45539271f5ed4fdc7db34545" + +[[package]] +name = "arrayvec" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" [[package]] name = "async-stream" @@ -42,20 +54,20 @@ checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193" dependencies = [ "proc-macro2", "quote", - "syn 2.0.28", + "syn 2.0.63", ] [[package]] name = "autocfg" -version = "1.1.0" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" +checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" [[package]] name = "backtrace" -version = "0.3.68" +version = "0.3.71" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4319208da049c43661739c5fade2ba182f09d1dc2299b32298d3a31692b17e12" +checksum = "26b05800d2e817c8b3b4b54abd461726265fa9789ae34330622f2db9ee696f9d" dependencies = [ "addr2line", "cc", @@ -74,9 +86,9 @@ checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" [[package]] name = "base64" -version = "0.21.2" +version = "0.21.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "604178f6c5c21f02dc555784810edfb88d34ac2c73b2eae109655649ee73ce3d" +checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" [[package]] name = "bincode" @@ -89,36 +101,40 @@ dependencies = [ [[package]] name = "bitflags" -version = "1.3.2" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" +checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1" [[package]] -name = "bitflags" -version = "2.4.0" +name = "blake3" +version = "1.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4682ae6287fcf752ecaabbfcc7b6f9b72aa33933dc23a554d853aea8eea8635" +checksum = "30cca6d3674597c30ddf2c587bf8d9d65c9a84d2326d941cc79c9842dfe0ef52" +dependencies = [ + "arrayref", + "arrayvec", + "cc", + "cfg-if", + "constant_time_eq", +] [[package]] name = "bumpalo" -version = "3.13.0" +version = "3.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3e2c3daef883ecc1b5d58c15adae93470a91d425f3532ba1695849656af3fc1" +checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" [[package]] name = "bytes" -version = "1.4.0" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89b2fd2a0dcf38d7971e2194b6b6eebab45ae01067456a7fd93d5547a61b70be" +checksum = "514de17de45fdb8dc022b1a7975556c53c86f9f0aa5f534b98977b171857c2c9" [[package]] name = "cc" -version = "1.0.82" +version = "1.0.97" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "305fe645edc1442a0fa8b6726ba61d422798d37a52e12eaecf4b022ebbb88f01" -dependencies = [ - "libc", -] +checksum = "099a5357d84c4c61eb35fc8eafa9a79a902c2f76911e5747ced4e032edd8d9b4" [[package]] name = "cfg-if" @@ -141,6 +157,12 @@ dependencies = [ "types", ] +[[package]] +name = "constant_time_eq" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7144d30dcf0fafbce74250a3963025d8d52177934239851c917d29f1df280c2" + [[package]] name = "convert_case" version = "0.4.0" @@ -149,9 +171,9 @@ checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e" [[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", @@ -159,15 +181,18 @@ dependencies = [ [[package]] name = "core-foundation-sys" -version = "0.8.4" +version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa" +checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f" [[package]] name = "deranged" -version = "0.3.7" +version = "0.3.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7684a49fb1af197853ef7b2ee694bc1f5b4179556f1e5710e1760c5db6f5e929" +checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4" +dependencies = [ + "powerfmt", +] [[package]] name = "derive_more" @@ -184,9 +209,9 @@ dependencies = [ [[package]] name = "educe" -version = "0.4.22" +version = "0.4.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "079044df30bb07de7d846d41a184c4b00e66ebdac93ee459253474f3a47e50ae" +checksum = "0f0042ff8246a363dbe77d2ceedb073339e85a804b9a47636c6e016a9a32c05f" dependencies = [ "enum-ordinalize", "proc-macro2", @@ -196,43 +221,38 @@ dependencies = [ [[package]] name = "enum-ordinalize" -version = "3.1.13" +version = "3.1.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4f76552f53cefc9a7f64987c3701b99d982f7690606fd67de1d09712fbf52f1" +checksum = "1bf1fa3f06bbff1ea5b1a9c7b14aa992a39657db60a2759457328d7e058f49ee" dependencies = [ "num-bigint", "num-traits", "proc-macro2", "quote", - "syn 2.0.28", + "syn 2.0.63", ] [[package]] -name = "errno" -version = "0.3.2" +name = "equivalent" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b30f669a7961ef1631673d2766cc92f52d64f7ef354d4fe0ddfd30ed52f0f4f" -dependencies = [ - "errno-dragonfly", - "libc", - "windows-sys", -] +checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" [[package]] -name = "errno-dragonfly" -version = "0.1.2" +name = "errno" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf" +checksum = "534c5cf6194dfab3db3242765c03bbe257cf92f22b38f6bc0c58d59108a820ba" dependencies = [ - "cc", "libc", + "windows-sys 0.52.0", ] [[package]] name = "fastrand" -version = "2.0.0" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6999dc1837253364c2ebb0704ba97994bd874e8f195d665c50b7548f6ea92764" +checksum = "9fc0510504f03c51ada170672ac806f1f105a88aa97a5281117e1ddc3368e51a" [[package]] name = "flume" @@ -254,9 +274,9 @@ checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" [[package]] name = "futures" -version = "0.3.28" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23342abe12aba583913b2e62f22225ff9c950774065e4bfb61a19cd9770fec40" +checksum = "645c6916888f6cb6350d2550b80fb63e734897a8498abe35cfb732b6487804b0" dependencies = [ "futures-channel", "futures-core", @@ -296,9 +316,9 @@ checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" [[package]] name = "futures-executor" -version = "0.3.28" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ccecee823288125bd88b4d7f565c9e58e41858e47ab72e8ea2d64e93624386e0" +checksum = "a576fc72ae164fca6b9db127eaa9a9dda0d61316034f33a0a0d4eda41f02b01d" dependencies = [ "futures-core", "futures-task", @@ -332,7 +352,7 @@ checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ "proc-macro2", "quote", - "syn 2.0.28", + "syn 2.0.63", ] [[package]] @@ -367,9 +387,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.10" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427" +checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" dependencies = [ "cfg-if", "js-sys", @@ -380,15 +400,15 @@ dependencies = [ [[package]] name = "gimli" -version = "0.27.3" +version = "0.28.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6c80984affa11d98d1b88b66ac8853f143217b399d3c74116778ff8fdb4ed2e" +checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" [[package]] name = "h2" -version = "0.3.20" +version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97ec8491ebaf99c8eaa73058b045fe58073cd6be7f596ac993ced0b0a0c01049" +checksum = "81fe527a889e1532da5c525686d96d4c2e74cdd345badf8dfef9f6b39dd5f5e8" dependencies = [ "bytes", "fnv", @@ -405,21 +425,27 @@ dependencies = [ [[package]] name = "hashbrown" -version = "0.12.3" +version = "0.14.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" +checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" [[package]] name = "hermit-abi" -version = "0.3.2" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" + +[[package]] +name = "hex" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "443144c8cdadd93ebf52ddb4056d257f5b52c04d3c804e657d19eb73fc33668b" +checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" [[package]] name = "http" -version = "0.2.9" +version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd6effc99afb63425aff9b05836f029929e345a6148a14b7ecd5ab67af944482" +checksum = "601cbb57e577e2f5ef5be8e7b83f0f63994f25aa94d673e54a92d5c516d101f1" dependencies = [ "bytes", "fnv", @@ -428,9 +454,9 @@ dependencies = [ [[package]] name = "http-body" -version = "0.4.5" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1" +checksum = "7ceab25649e9960c0311ea418d17bee82c0dcec1bd053b5f9a66e265a693bed2" dependencies = [ "bytes", "http", @@ -451,9 +477,9 @@ checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" [[package]] name = "hyper" -version = "0.14.27" +version = "0.14.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffb1cfd654a8219eaef89881fdb3bb3b1cdc5fa75ded05d6933b2b382e395468" +checksum = "bf96e135eb83a2a8ddf766e426a841d8ddd7449d5f00d34ea02b41d2f19eef80" dependencies = [ "bytes", "futures-channel", @@ -466,7 +492,7 @@ dependencies = [ "httpdate", "itoa", "pin-project-lite", - "socket2 0.4.9", + "socket2", "tokio", "tower-service", "tracing", @@ -475,19 +501,33 @@ dependencies = [ [[package]] name = "indexmap" -version = "1.9.3" +version = "2.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" +checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26" dependencies = [ - "autocfg", + "equivalent", "hashbrown", ] +[[package]] +name = "interprocess" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b4d0250d41da118226e55b3d50ca3f0d9e0a0f6829b92f543ac0054aeea1572" +dependencies = [ + "futures-core", + "libc", + "recvmsg", + "tokio", + "widestring", + "windows-sys 0.52.0", +] + [[package]] name = "iroh-quinn" -version = "0.10.3" +version = "0.10.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5f3a9d551023df808c2407d7e5db069e8a994b53c9dcd35b858b4e4c220a2c4" +checksum = "b934380145fd5d53a583d01ae9500f4807efe6b0f0fe115c7be4afa2b35db99f" dependencies = [ "bytes", "iroh-quinn-proto", @@ -508,7 +548,7 @@ checksum = "16f2656b322c7f6cf3eb95e632d1c0f2fa546841915b0270da581f918c70c4be" dependencies = [ "bytes", "rand", - "ring", + "ring 0.16.20", "rustc-hash", "rustls", "rustls-native-certs", @@ -526,22 +566,22 @@ checksum = "6679979a7271c24f9dae9622c0b4a543881508aa3a7396f55dfbaaa56f01c063" dependencies = [ "bytes", "libc", - "socket2 0.5.3", + "socket2", "tracing", - "windows-sys", + "windows-sys 0.48.0", ] [[package]] name = "itoa" -version = "1.0.9" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" +checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" [[package]] name = "js-sys" -version = "0.3.64" +version = "0.3.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5f195fe497f702db0f318b07fdd68edb16955aed830df8363d837542f8f935a" +checksum = "29c15563dc2726973df627357ce0c9ddddbea194836909d655df6a75d2cf296d" dependencies = [ "wasm-bindgen", ] @@ -554,21 +594,21 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.147" +version = "0.2.154" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3" +checksum = "ae743338b92ff9146ce83992f766a31066a91a8c84a45e0e9f21e7cf6de6d346" [[package]] name = "linux-raw-sys" -version = "0.4.5" +version = "0.4.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57bcfdad1b858c2db7c38303a6d2ad4dfaf5eb53dfeb0910128b2c26d6158503" +checksum = "01cda141df6706de531b6c46c3a33ecca755538219bd484262fa09410c13539c" [[package]] name = "lock_api" -version = "0.4.10" +version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1cc9717a20b1bb222f333e6a92fd32f7d8a18ddc5a3191a11af45dcbf4dcd16" +checksum = "07af8b9cdd281b7915f413fa73f29ebd5d55d0d3f0155584dade1ff18cea1b17" dependencies = [ "autocfg", "scopeguard", @@ -576,34 +616,34 @@ dependencies = [ [[package]] name = "log" -version = "0.4.20" +version = "0.4.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" +checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c" [[package]] name = "memchr" -version = "2.5.0" +version = "2.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" +checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d" [[package]] name = "miniz_oxide" -version = "0.7.1" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7" +checksum = "9d811f3e15f28568be3407c8e7fdb6514c1cda3cb30683f15b6a1a1dc4ea14a7" dependencies = [ "adler", ] [[package]] name = "mio" -version = "0.8.8" +version = "0.8.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "927a765cd3fc26206e66b296465fa9d3e5ab003e651c1b3c060e7956d96b19d2" +checksum = "a4a650543ca06a924e8b371db273b2756685faae30f8487da1b56505a8f78b0c" dependencies = [ "libc", "wasi", - "windows-sys", + "windows-sys 0.48.0", ] [[package]] @@ -627,30 +667,34 @@ dependencies = [ [[package]] name = "num-bigint" -version = "0.4.3" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f93ab6289c7b344a8a9f60f88d80aa20032336fe78da341afc91c8a2341fc75f" +checksum = "c165a9ab64cf766f73521c0dd2cfdff64f488b8f0b3e621face3462d3db536d7" dependencies = [ - "autocfg", "num-integer", "num-traits", ] +[[package]] +name = "num-conv" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" + [[package]] name = "num-integer" -version = "0.1.45" +version = "0.1.46" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" +checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f" dependencies = [ - "autocfg", "num-traits", ] [[package]] name = "num-traits" -version = "0.2.16" +version = "0.2.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f30b0abd723be7e2ffca1272140fac1a2f084c77ec3e123c192b66af1ee9e6c2" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" dependencies = [ "autocfg", ] @@ -667,18 +711,18 @@ dependencies = [ [[package]] name = "object" -version = "0.31.1" +version = "0.32.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8bda667d9f2b5051b8833f59f3bf748b28ef54f850f4fcb389a252aa383866d1" +checksum = "a6a622008b6e321afc04970976f62ee297fdbaa6f95318ca343e3eebb9648441" dependencies = [ "memchr", ] [[package]] name = "once_cell" -version = "1.18.0" +version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" +checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" [[package]] name = "openssl-probe" @@ -700,9 +744,9 @@ checksum = "bb813b8af86854136c6922af0598d719255ecb2179515e6e7730d468f05c9cae" [[package]] name = "parking_lot" -version = "0.12.1" +version = "0.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" +checksum = "7e4af0ca4f6caed20e900d564c242b8e5d4903fdacf31d3daf527b66fe6f42fb" dependencies = [ "lock_api", "parking_lot_core", @@ -710,15 +754,15 @@ dependencies = [ [[package]] name = "parking_lot_core" -version = "0.9.8" +version = "0.9.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93f00c865fe7cabf650081affecd3871070f26767e7b2070a3ffae14c654b447" +checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8" dependencies = [ "cfg-if", "libc", "redox_syscall", "smallvec", - "windows-targets", + "windows-targets 0.52.5", ] [[package]] @@ -732,29 +776,29 @@ dependencies = [ [[package]] name = "pin-project" -version = "1.1.3" +version = "1.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fda4ed1c6c173e3fc7a83629421152e01d7b1f9b7f65fb301e490e8cfc656422" +checksum = "b6bf43b791c5b9e34c3d182969b4abb522f9343702850a2e57f460d00d09b4b3" dependencies = [ "pin-project-internal", ] [[package]] name = "pin-project-internal" -version = "1.1.3" +version = "1.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405" +checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" dependencies = [ "proc-macro2", "quote", - "syn 2.0.28", + "syn 2.0.63", ] [[package]] name = "pin-project-lite" -version = "0.2.12" +version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12cc1b0bf1727a77a54b6654e7b5f1af8604923edc8b81885f8ec92f9e3f0a05" +checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02" [[package]] name = "pin-utils" @@ -762,6 +806,12 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" +[[package]] +name = "powerfmt" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" + [[package]] name = "ppv-lite86" version = "0.2.17" @@ -770,9 +820,9 @@ checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" [[package]] name = "proc-macro2" -version = "1.0.66" +version = "1.0.82" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18fb31db3f9bddb2ea821cde30a9f70117e3f119938b5ee630b7403aa6e2ead9" +checksum = "8ad3d49ab951a01fbaafe34f2ec74122942fe18a3f9814c3268f1bb72042131b" dependencies = [ "unicode-ident", ] @@ -784,16 +834,21 @@ dependencies = [ "anyhow", "async-stream", "bincode", + "blake3", "bytes", "derive_more", "educe", "flume", + "futures", "futures-buffered", "futures-lite", "futures-sink", "futures-util", + "hex", "hyper", + "interprocess", "iroh-quinn", + "iroh-quinn-udp", "pin-project", "proc-macro2", "rcgen", @@ -810,9 +865,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.32" +version = "1.0.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50f3b39ccfb720540debaa0164757101c08ecb8d326b15358ce76a62c7e85965" +checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" dependencies = [ "proc-macro2", ] @@ -854,18 +909,24 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ffbe84efe2f38dea12e9bfc1f65377fdf03e53a18cb3b995faedf7934c7e785b" dependencies = [ "pem", - "ring", + "ring 0.16.20", "time", "yasna", ] +[[package]] +name = "recvmsg" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3edd4d5d42c92f0a659926464d4cce56b562761267ecf0f469d85b7de384175" + [[package]] name = "redox_syscall" -version = "0.3.5" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29" +checksum = "469052894dcb553421e483e4209ee581a45100d31b4018de03e5a7ad86374a7e" dependencies = [ - "bitflags 1.3.2", + "bitflags", ] [[package]] @@ -878,16 +939,31 @@ dependencies = [ "libc", "once_cell", "spin 0.5.2", - "untrusted", + "untrusted 0.7.1", "web-sys", "winapi", ] +[[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 0.9.8", + "untrusted 0.9.0", + "windows-sys 0.52.0", +] + [[package]] name = "rustc-demangle" -version = "0.1.23" +version = "0.1.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" +checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" [[package]] name = "rustc-hash" @@ -906,25 +982,25 @@ dependencies = [ [[package]] name = "rustix" -version = "0.38.8" +version = "0.38.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19ed4fa021d81c8392ce04db050a3da9a60299050b7ae1cf482d862b54a7218f" +checksum = "70dc5ec042f7a43c4a73241207cecc9873a06d45debb38b329f8541d85c2730f" dependencies = [ - "bitflags 2.4.0", + "bitflags", "errno", "libc", "linux-raw-sys", - "windows-sys", + "windows-sys 0.52.0", ] [[package]] name = "rustls" -version = "0.21.6" +version = "0.21.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d1feddffcfcc0b33f5c6ce9a29e341e4cd59c3f78e7ee45f4a40c038b1d6cbb" +checksum = "3f56a14d1f48b391359b22f731fd4bd7e43c97f3c50eee276f3aa09c94784d3e" dependencies = [ "log", - "ring", + "ring 0.17.8", "rustls-webpki", "sct", ] @@ -943,30 +1019,30 @@ dependencies = [ [[package]] name = "rustls-pemfile" -version = "1.0.3" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d3987094b1d07b653b7dfdc3f70ce9a1da9c51ac18c1b06b662e4f9a0e9f4b2" +checksum = "1c74cae0a4cf6ccbbf5f359f08efdf8ee7e1dc532573bf0db71968cb56b1448c" dependencies = [ - "base64 0.21.2", + "base64 0.21.7", ] [[package]] name = "rustls-webpki" -version = "0.101.3" +version = "0.101.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "261e9e0888cba427c3316e6322805653c9425240b6fd96cee7cb671ab70ab8d0" +checksum = "8b6275d1ee7a1cd780b64aca7726599a1dbc893b1e64144529e55c3c2f745765" dependencies = [ - "ring", - "untrusted", + "ring 0.17.8", + "untrusted 0.9.0", ] [[package]] name = "schannel" -version = "0.1.22" +version = "0.1.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c3733bf4cf7ea0880754e19cb5a462007c4a8c1914bff372ccc95b464f1df88" +checksum = "fbc91545643bcf3a0bbb6569265615222618bdf33ce4ffbbd13c4bbd4c093534" dependencies = [ - "windows-sys", + "windows-sys 0.52.0", ] [[package]] @@ -977,21 +1053,21 @@ checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" [[package]] name = "sct" -version = "0.7.0" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d53dcdb7c9f8158937a7981b48accfd39a43af418591a5d008c7b22b5e1b7ca4" +checksum = "da046153aa2352493d6cb7da4b6e5c0c057d8a1d0a9aa8560baffdd945acd414" dependencies = [ - "ring", - "untrusted", + "ring 0.17.8", + "untrusted 0.9.0", ] [[package]] name = "security-framework" -version = "2.9.2" +version = "2.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05b64fb303737d99b81884b2c63433e9ae28abebe5eb5045dcdd175dc2ecf4de" +checksum = "c627723fd09706bacdb5cf41499e95098555af3c3c29d014dc3c458ef6be11c0" dependencies = [ - "bitflags 1.3.2", + "bitflags", "core-foundation", "core-foundation-sys", "libc", @@ -1000,9 +1076,9 @@ dependencies = [ [[package]] name = "security-framework-sys" -version = "2.9.1" +version = "2.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e932934257d3b408ed8f30db49d85ea163bfe74961f017f405b025af298f0c7a" +checksum = "317936bbbd05227752583946b9e66d7ce3b489f84e11a94a510b4437fef407d7" dependencies = [ "core-foundation-sys", "libc", @@ -1016,22 +1092,22 @@ checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" [[package]] name = "serde" -version = "1.0.183" +version = "1.0.201" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32ac8da02677876d532745a130fc9d8e6edfa81a269b107c5b00829b91d8eb3c" +checksum = "780f1cebed1629e4753a1a38a3c72d30b97ec044f0aef68cb26650a3c5cf363c" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.183" +version = "1.0.201" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aafe972d60b0b9bee71a91b92fee2d4fb3c9d7e8f6b179aa99f27203d99a4816" +checksum = "c5e405930b9796f1c00bee880d03fc7e0bb4b9a11afc776885ffe84320da2865" dependencies = [ "proc-macro2", "quote", - "syn 2.0.28", + "syn 2.0.63", ] [[package]] @@ -1053,55 +1129,45 @@ 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", ] [[package]] name = "signal-hook-registry" -version = "1.4.1" +version = "1.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8229b473baa5980ac72ef434c4415e70c4b5e71b423043adb4ba059f89c99a1" +checksum = "a9e9e0b4211b72e7b8b6e85c807d36c212bdb33ea8587f7569562a84df5465b1" dependencies = [ "libc", ] [[package]] name = "slab" -version = "0.4.8" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6528351c9bc8ab22353f9d776db39a20288e8d6c37ef8cfe3317cf875eecfc2d" +checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" dependencies = [ "autocfg", ] [[package]] name = "smallvec" -version = "1.11.0" +version = "1.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62bb4feee49fdd9f707ef802e22365a35de4b7b299de4763d44bfea899442ff9" - -[[package]] -name = "socket2" -version = "0.4.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64a4a911eed85daf18834cfaa86a79b7d266ff93ff5ba14005426219480ed662" -dependencies = [ - "libc", - "winapi", -] +checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "socket2" -version = "0.5.3" +version = "0.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2538b18701741680e0322a2302176d3253a35388e2e62f172f64f4f16605f877" +checksum = "ce305eb0b4296696835b71df73eb912e0f1ffd2556a501fcede6e0c50349191c" dependencies = [ "libc", - "windows-sys", + "windows-sys 0.52.0", ] [[package]] @@ -1132,9 +1198,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.28" +version = "2.0.63" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04361975b3f5e348b2189d8dc55bc942f278b2d482a6a0365de5bdd62d351567" +checksum = "bf5be731623ca1a1fb7d8be6f261a3be6d3e2337b8a1f97be944d020c8fcb704" dependencies = [ "proc-macro2", "quote", @@ -1143,35 +1209,34 @@ dependencies = [ [[package]] name = "tempfile" -version = "3.7.1" +version = "3.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc02fddf48964c42031a0b3fe0428320ecf3a73c401040fc0096f97794310651" +checksum = "85b77fafb263dd9d05cbeac119526425676db3784113aa9295c88498cbf8bff1" dependencies = [ "cfg-if", "fastrand", - "redox_syscall", "rustix", - "windows-sys", + "windows-sys 0.52.0", ] [[package]] name = "thiserror" -version = "1.0.45" +version = "1.0.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dedd246497092a89beedfe2c9f176d44c1b672ea6090edc20544ade01fbb7ea0" +checksum = "579e9083ca58dd9dcf91a9923bb9054071b9ebbd800b342194c9feb0ee89fc18" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.45" +version = "1.0.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d7b1fadccbbc7e19ea64708629f9d8dccd007c260d66485f20a6d41bc1cf4b3" +checksum = "e2470041c06ec3ac1ab38d0356a6119054dedaea53e12fbefc0de730a1c08524" dependencies = [ "proc-macro2", "quote", - "syn 2.0.28", + "syn 2.0.63", ] [[package]] @@ -1182,9 +1247,9 @@ checksum = "3bf63baf9f5039dadc247375c29eb13706706cfde997d0330d05aa63a77d8820" [[package]] name = "thread_local" -version = "1.1.7" +version = "1.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fdd6f064ccff2d6567adcb3873ca630700f00b5ad3f060c25b5dcfd9a4ce152" +checksum = "8b9ef9bad013ada3808854ceac7b46812a6465ba368859a37e2100283d2d719c" dependencies = [ "cfg-if", "once_cell", @@ -1192,20 +1257,22 @@ dependencies = [ [[package]] name = "time" -version = "0.3.25" +version = "0.3.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0fdd63d58b18d663fbdf70e049f00a22c8e42be082203be7f26589213cd75ea" +checksum = "5dfd88e563464686c916c7e46e623e520ddc6d79fa6641390f2e3fa86e83e885" dependencies = [ "deranged", + "num-conv", + "powerfmt", "serde", "time-core", ] [[package]] name = "time-core" -version = "0.1.1" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7300fbefb4dadc1af235a9cef3737cea692a9d97e1b9cbcd4ebdae6f8868e6fb" +checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" [[package]] name = "tinyvec" @@ -1224,9 +1291,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.31.0" +version = "1.37.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40de3a2ba249dcb097e01be5e67a5ff53cf250397715a071a81543e8a832a920" +checksum = "1adbebffeca75fcfd058afa480fb6c0b81e165a0323f9c9d39c9697e37c46787" dependencies = [ "backtrace", "bytes", @@ -1236,20 +1303,20 @@ dependencies = [ "parking_lot", "pin-project-lite", "signal-hook-registry", - "socket2 0.5.3", + "socket2", "tokio-macros", - "windows-sys", + "windows-sys 0.48.0", ] [[package]] name = "tokio-macros" -version = "2.1.0" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e" +checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.28", + "syn 2.0.63", ] [[package]] @@ -1269,16 +1336,15 @@ dependencies = [ [[package]] name = "tokio-util" -version = "0.7.8" +version = "0.7.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "806fe8c2c87eccc8b3267cbae29ed3ab2d0bd37fca70ab622e46aaa9375ddb7d" +checksum = "9cf6b47b3771c49ac75ad09a6162f53ad4b8088b76ac60e8ec1455b31a189fe1" dependencies = [ "bytes", "futures-core", "futures-sink", "pin-project-lite", "tokio", - "tracing", ] [[package]] @@ -1289,11 +1355,10 @@ checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" [[package]] name = "tracing" -version = "0.1.37" +version = "0.1.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8" +checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" dependencies = [ - "cfg-if", "log", "pin-project-lite", "tracing-attributes", @@ -1302,20 +1367,20 @@ dependencies = [ [[package]] name = "tracing-attributes" -version = "0.1.26" +version = "0.1.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f4f31f56159e98206da9efd823404b79b6ef3143b4a7ab76e67b1751b25a4ab" +checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.28", + "syn 2.0.63", ] [[package]] name = "tracing-core" -version = "0.1.31" +version = "0.1.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0955b8137a1df6f1a2e9a37d8a6656291ff0297c1a97c24e0d8425fe2312f79a" +checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" dependencies = [ "once_cell", "valuable", @@ -1323,20 +1388,20 @@ dependencies = [ [[package]] name = "tracing-log" -version = "0.1.3" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78ddad33d2d10b1ed7eb9d1f518a5674713876e97e5bb9b7345a7984fbb4f922" +checksum = "ee855f1f400bd0e5c02d150ae5de3840039a3f54b025156404e34c23c03f47c3" dependencies = [ - "lazy_static", "log", + "once_cell", "tracing-core", ] [[package]] name = "tracing-subscriber" -version = "0.3.17" +version = "0.3.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30a651bc37f915e81f087d86e62a18eec5f79550c7faff886f7090b4ea757c77" +checksum = "ad0f048c97dbd9faa9b7df56362b8ebcaa52adb06b498c050d2f4e32f90a7a8b" dependencies = [ "nu-ansi-term", "sharded-slab", @@ -1348,9 +1413,9 @@ dependencies = [ [[package]] name = "try-lock" -version = "0.2.4" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed" +checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" [[package]] name = "types" @@ -1364,9 +1429,9 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.11" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "301abaae475aa91687eb82514b328ab47a211a533026cb25fc3e519b86adfc3c" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" [[package]] name = "untrusted" @@ -1374,6 +1439,12 @@ version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" +[[package]] +name = "untrusted" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" + [[package]] name = "valuable" version = "0.1.0" @@ -1397,9 +1468,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.87" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7706a72ab36d8cb1f80ffbf0e071533974a60d0a308d01a5d0375bf60499a342" +checksum = "4be2531df63900aeb2bca0daaaddec08491ee64ceecbee5076636a3b026795a8" dependencies = [ "cfg-if", "wasm-bindgen-macro", @@ -1407,24 +1478,24 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.87" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ef2b6d3c510e9625e5fe6f509ab07d66a760f0885d858736483c32ed7809abd" +checksum = "614d787b966d3989fa7bb98a654e369c762374fd3213d212cfc0251257e747da" dependencies = [ "bumpalo", "log", "once_cell", "proc-macro2", "quote", - "syn 2.0.28", + "syn 2.0.63", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-macro" -version = "0.2.87" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dee495e55982a3bd48105a7b947fd2a9b4a8ae3010041b9e0faab3f9cd028f1d" +checksum = "a1f8823de937b71b9460c0c34e25f3da88250760bec0ebac694b49997550d726" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -1432,33 +1503,39 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.87" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" +checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.28", + "syn 2.0.63", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.87" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1" +checksum = "af190c94f2773fdb3729c55b007a722abb5384da03bc0986df4c289bf5567e96" [[package]] name = "web-sys" -version = "0.3.64" +version = "0.3.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b85cbef8c220a6abc02aefd892dfc0fc23afb1c6a426316ec33253a3877249b" +checksum = "77afa9a11836342370f4817622a2f0f418b134426d91a82dfb48f532d2ec13ef" dependencies = [ "js-sys", "wasm-bindgen", ] +[[package]] +name = "widestring" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7219d36b6eac893fa81e84ebe06485e7dcbb616177469b142df14f1f4deb1311" + [[package]] name = "winapi" version = "0.3.9" @@ -1487,65 +1564,138 @@ version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" dependencies = [ - "windows-targets", + "windows-targets 0.48.5", +] + +[[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.5", +] + +[[package]] +name = "windows-targets" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" +dependencies = [ + "windows_aarch64_gnullvm 0.48.5", + "windows_aarch64_msvc 0.48.5", + "windows_i686_gnu 0.48.5", + "windows_i686_msvc 0.48.5", + "windows_x86_64_gnu 0.48.5", + "windows_x86_64_gnullvm 0.48.5", + "windows_x86_64_msvc 0.48.5", ] [[package]] name = "windows-targets" -version = "0.48.2" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1eeca1c172a285ee6c2c84c341ccea837e7c01b12fbb2d0fe3c9e550ce49ec8" +checksum = "6f0713a46559409d202e70e28227288446bf7841d3211583a4b53e3f6d96e7eb" 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.52.5", + "windows_aarch64_msvc 0.52.5", + "windows_i686_gnu 0.52.5", + "windows_i686_gnullvm", + "windows_i686_msvc 0.52.5", + "windows_x86_64_gnu 0.52.5", + "windows_x86_64_gnullvm 0.52.5", + "windows_x86_64_msvc 0.52.5", ] [[package]] name = "windows_aarch64_gnullvm" -version = "0.48.2" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b10d0c968ba7f6166195e13d593af609ec2e3d24f916f081690695cf5eaffb2f" +checksum = "7088eed71e8b8dda258ecc8bac5fb1153c5cffaf2578fc8ff5d61e23578d3263" [[package]] name = "windows_aarch64_msvc" -version = "0.48.2" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "571d8d4e62f26d4932099a9efe89660e8bd5087775a2ab5cdd8b747b811f1058" +checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9985fd1504e250c615ca5f281c3f7a6da76213ebd5ccc9561496568a2752afb6" [[package]] name = "windows_i686_gnu" -version = "0.48.2" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2229ad223e178db5fbbc8bd8d3835e51e566b8474bfca58d2e6150c48bb723cd" +checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88ba073cf16d5372720ec942a8ccbf61626074c6d4dd2e745299726ce8b89670" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87f4261229030a858f36b459e748ae97545d6f1ec60e5e0d6a3d32e0dc232ee9" [[package]] name = "windows_i686_msvc" -version = "0.48.2" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "600956e2d840c194eedfc5d18f8242bc2e17c7775b6684488af3a9fff6fe3287" +checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db3c2bf3d13d5b658be73463284eaf12830ac9a26a90c717b7f771dfe97487bf" [[package]] name = "windows_x86_64_gnu" -version = "0.48.2" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea99ff3f8b49fb7a8e0d305e5aec485bd068c2ba691b6e277d29eaeac945868a" +checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e4246f76bdeff09eb48875a0fd3e2af6aada79d409d33011886d3e1581517d9" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" [[package]] name = "windows_x86_64_gnullvm" -version = "0.48.2" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "852298e482cd67c356ddd9570386e2862b5673c85bd5f88df9ab6802b334c596" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f1a05a1ece9a7a0d5a7ccf30ba2c33e3a61a30e042ffd247567d1de1d94120d" +checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" [[package]] name = "windows_x86_64_msvc" -version = "0.48.2" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d419259aba16b663966e29e6d7c6ecfa0bb8425818bb96f6f1f3c3eb71a6e7b9" +checksum = "bec47e5bfd1bff0eeaf6d8b485cc1074891a197ab4225d504cb7a1ab88b02bf0" [[package]] name = "yasna" diff --git a/Cargo.toml b/Cargo.toml index ff06fb9..4091e0c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -30,6 +30,11 @@ tokio = { version = "1", default-features = false, features = ["macros", "sync"] tokio-serde = { version = "0.8", features = ["bincode"], optional = true } tokio-util = { version = "0.7", features = ["codec"], optional = true } tracing = "0.1" +quinn-udp = { package = "iroh-quinn-udp", version = "0.4.0", optional = true } +interprocess = { version = "2.1", features = ["tokio"], optional = true } +hex = "0.4.3" +blake3 = "1.4.1" +futures = { version = "0.3.30", optional = true } [dependencies.educe] # This is an unused dependency, it is needed to make the minimal @@ -53,10 +58,12 @@ proc-macro2 = "1.0.66" futures-buffered = "0.2.4" [features] -hyper-transport = ["flume", "hyper", "bincode", "bytes", "tokio-serde", "tokio-util"] -quinn-transport = ["flume", "quinn", "bincode", "tokio-serde", "tokio-util"] -flume-transport = ["flume"] +hyper-transport = ["dep:flume", "dep:hyper", "dep:bincode", "dep:bytes", "dep:tokio-serde", "dep:tokio-util"] +quinn-transport = ["dep:flume", "dep:quinn", "dep:bincode", "dep:tokio-serde", "dep:tokio-util"] +flume-transport = ["dep:flume"] +interprocess-transport = ["quinn-transport", "quinn-flume-socket", "dep:quinn-udp", "dep:interprocess", "dep:bytes", "dep:tokio-util", "dep:futures"] combined-transport = [] +quinn-flume-socket = ["dep:flume", "dep:quinn", "dep:quinn-udp", "dep:bytes", "dep:tokio-util"] macros = [] default = ["flume-transport"] diff --git a/src/transport/interprocess.rs b/src/transport/interprocess.rs new file mode 100644 index 0000000..3720296 --- /dev/null +++ b/src/transport/interprocess.rs @@ -0,0 +1,128 @@ +//! Custom quinn transport that uses the interprocess crate to provide +//! local interprocess communication via either Unix domain sockets or +//! Windows named pipes. +use std::{io, net::SocketAddr, path::Path}; + +use super::quinn_flume_socket::{make_endpoint, FlumeSocket, Packet}; +use bytes::{Buf, Bytes, BytesMut}; +use futures::StreamExt; +use interprocess::local_socket::{GenericFilePath, GenericNamespaced, Name, ToFsName, ToNsName}; +use quinn::{Endpoint, EndpointConfig}; +use tokio::{ + io::{AsyncRead, AsyncReadExt, AsyncWrite, AsyncWriteExt}, + task::JoinHandle, +}; + +struct FrameIter<'a>(&'a mut BytesMut); + +impl<'a> Iterator for FrameIter<'a> { + type Item = Bytes; + + fn next(&mut self) -> Option { + if self.0.len() < 2 { + return None; + } + let len = u16::from_le_bytes([self.0[0], self.0[1]]) as usize; + if self.0.len() < len + 2 { + return None; + } + self.0.advance(2); + Some(self.0.split_to(len).freeze()) + } +} + +/// Automatically chooses name type based on OS support and preference. +pub fn new_socket_name(root: impl AsRef, id: &str) -> io::Result> { + if cfg!(windows) { + format!("@quic-rpc-socket-{}.sock", id).to_ns_name::() + } else if cfg!(unix) { + root.as_ref() + .join(format!("{id}.sock")) + .to_fs_name::() + } else { + panic!("unsupported OS"); + } +} + +/// Wrap a tokio read/write pair as a quinn endpoint. +/// +/// The connection is assumed to be from `local` to `remote`. If you try to +/// connect to any other address, packets will be dropped. +#[allow(clippy::type_complexity)] +pub fn tokio_io_endpoint( + mut r: R, + mut w: W, + local: SocketAddr, + remote: SocketAddr, + server_config: Option, +) -> io::Result<( + Endpoint, + JoinHandle>, + JoinHandle>, +)> +where + R: AsyncRead + Send + Unpin + 'static, + W: AsyncWrite + Send + Unpin + 'static, +{ + let (out_send, out_recv) = flume::bounded::(32); + let (in_send, in_recv) = flume::bounded::(32); + let mut out_recv = out_recv.into_stream().ready_chunks(16); + let sender = tokio::task::spawn(async move { + tracing::debug!("{} running forwarder task to {}", local, remote); + while let Some(packets) = out_recv.next().await { + for packet in packets { + if packet.to == remote { + let contents = packet.contents.as_ref(); + if let Some(segment_size) = packet.segment_size { + for min in (0..contents.len()).step_by(segment_size) { + let max = (min + segment_size).min(contents.len()); + let len: u16 = (max - min).try_into().unwrap(); + w.write_all(&len.to_le_bytes()).await?; + w.write_all(&contents[min..max]).await?; + } + } else { + let len: u16 = contents.len().try_into().unwrap(); + tracing::trace!("sending {} bytes", len); + w.write_all(&len.to_le_bytes()).await?; + w.write_all(contents).await?; + } + } else { + // not for us, ignore + continue; + } + } + } + Ok(()) + }); + let receiver = tokio::task::spawn(async move { + let mut buffer = BytesMut::with_capacity(65535); + loop { + // read more data and split into frames + let n = r.read_buf(&mut buffer).await; + let n = n?; + tracing::trace!("read {} bytes", n); + if n == 0 { + // eof + break; + } + // split into frames and send all full frames + for item in FrameIter(&mut buffer) { + let packet = Packet { + from: remote, + to: local, + contents: item, + segment_size: None, + }; + if in_send.send_async(packet).await.is_err() { + // in_recv dropped + break; + } + } + } + Ok(()) + }); + let socket = FlumeSocket::new(local, out_send, in_recv); + let config = EndpointConfig::default(); + let endpoint = make_endpoint(socket, config, server_config)?; + Ok((endpoint, sender, receiver)) +} diff --git a/src/transport/mod.rs b/src/transport/mod.rs index ea45aa5..f41637c 100644 --- a/src/transport/mod.rs +++ b/src/transport/mod.rs @@ -13,8 +13,12 @@ pub mod combined; pub mod flume; #[cfg(feature = "hyper-transport")] pub mod hyper; +#[cfg(feature = "interprocess-transport")] +pub mod interprocess; #[cfg(feature = "quinn-transport")] pub mod quinn; +#[cfg(feature = "quinn-flume-socket")] +pub mod quinn_flume_socket; pub mod misc; diff --git a/src/transport/quinn_flume_socket.rs b/src/transport/quinn_flume_socket.rs new file mode 100644 index 0000000..630a65c --- /dev/null +++ b/src/transport/quinn_flume_socket.rs @@ -0,0 +1,245 @@ +//! Custom quinn transport that uses the interprocess crate to provide +//! local interprocess communication via either Unix domain sockets or +//! Windows named pipes. +use std::{ + fmt::{self, Debug}, + io, + net::SocketAddr, + sync::{Arc, Mutex}, + task, +}; + +use bytes::Bytes; +use futures::{SinkExt, StreamExt}; +use quinn::{AsyncUdpSocket, EndpointConfig}; +use quinn_udp::RecvMeta; + +struct FlumeSocketInner { + local: SocketAddr, + receiver: flume::r#async::RecvStream<'static, Packet>, + sender: flume::r#async::SendSink<'static, Packet>, +} + +impl fmt::Debug for FlumeSocketInner { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("FlumeSocketInner") + .field("local", &self.local) + .finish_non_exhaustive() + } +} + +/// A packet for the flume socket. +#[derive(Debug)] +pub struct Packet { + /// The address the packet was sent from. + pub from: SocketAddr, + /// The address the packet is for. + pub to: SocketAddr, + /// The data in the packet. + pub contents: Bytes, + /// The segment size for the packet. + pub segment_size: Option, +} + +/// An implementation of [quinn::AsyncUdpSocket] that uses flume channels +#[derive(Debug)] +pub struct FlumeSocket(Arc>); + +impl FlumeSocket { + /// Create a new flume socket, with the given local address. + /// + /// Sent packets will have from set to the local address, and received packets + /// with to not set to the local address will be ignored. + pub fn new(local: SocketAddr, tx: flume::Sender, rx: flume::Receiver) -> Self { + let inner = FlumeSocketInner { + receiver: rx.into_stream(), + sender: tx.into_sink(), + local, + }; + Self(Arc::new(Mutex::new(inner))) + } +} + +impl AsyncUdpSocket for FlumeSocket { + fn poll_send( + &self, + state: &quinn_udp::UdpState, + cx: &mut task::Context, + transmits: &[quinn_udp::Transmit], + ) -> task::Poll> { + self.0.lock().unwrap().poll_send(state, cx, transmits) + } + + fn poll_recv( + &self, + cx: &mut task::Context, + bufs: &mut [io::IoSliceMut<'_>], + meta: &mut [RecvMeta], + ) -> task::Poll> { + self.0.lock().unwrap().poll_recv(cx, bufs, meta) + } + + fn local_addr(&self) -> io::Result { + self.0.lock().unwrap().local_addr() + } +} + +impl FlumeSocketInner { + fn poll_send( + &mut self, + _state: &quinn_udp::UdpState, + cx: &mut task::Context, + transmits: &[quinn_udp::Transmit], + ) -> task::Poll> { + if transmits.is_empty() { + return task::Poll::Ready(Ok(0)); + } + let mut offset = 0; + let mut pending = false; + tracing::trace!("S {} transmits", transmits.len()); + for transmit in transmits { + let item = Packet { + from: self.local, + to: transmit.destination, + contents: transmit.contents.clone(), + segment_size: transmit.segment_size, + }; + tracing::trace!( + "S sending {} {:?}", + transmit.contents.len(), + transmit.segment_size + ); + let res = self.sender.poll_ready_unpin(cx); + match res { + task::Poll::Ready(Ok(())) => { + // ready to send + if self.sender.start_send_unpin(item).is_err() { + // disconnected + break; + } + } + task::Poll::Ready(Err(_)) => { + // disconneced + break; + } + task::Poll::Pending => { + // remember the offset of the first pending transmit + pending = true; + break; + } + } + offset += 1; + } + if offset > 0 { + // call poll_flush_unpin only once. + if let task::Poll::Ready(Err(_)) = self.sender.poll_flush_unpin(cx) { + // disconnected + return task::Poll::Ready(Err(std::io::Error::new( + std::io::ErrorKind::UnexpectedEof, + "all receivers dropped", + ))); + } + // report how many transmits we sent + task::Poll::Ready(Ok(offset)) + } else if pending { + // only return pending if we got a pending for the first slot + task::Poll::Pending + } else { + task::Poll::Ready(Err(std::io::Error::new( + std::io::ErrorKind::UnexpectedEof, + "all receivers dropped", + ))) + } + } + + fn poll_recv( + &mut self, + cx: &mut std::task::Context, + bufs: &mut [io::IoSliceMut<'_>], + meta: &mut [quinn_udp::RecvMeta], + ) -> task::Poll> { + let n = bufs.len().min(meta.len()); + if n == 0 { + return task::Poll::Ready(Ok(0)); + } + let mut offset = 0; + let mut pending = false; + // try to fill as many slots as possible + while offset < n { + let packet = match self.receiver.poll_next_unpin(cx) { + task::Poll::Ready(Some(recv)) => recv, + task::Poll::Ready(None) => break, + task::Poll::Pending => { + pending = true; + break; + } + }; + if packet.to == self.local { + let len = packet.contents.len(); + let m = quinn_udp::RecvMeta { + addr: packet.from, + len, + stride: packet.segment_size.unwrap_or(len), + ecn: None, + dst_ip: Some(self.local.ip()), + }; + tracing::trace!("R bufs {} bytes, {} slots", bufs[offset].len(), n); + bufs[offset][..len].copy_from_slice(&packet.contents); + meta[offset] = m; + offset += 1; + } else { + // not for us, ignore + continue; + } + } + if offset > 0 { + // report how many slots we filled + task::Poll::Ready(Ok(offset)) + } else if pending { + // only return pending if we got a pending for the first slot + task::Poll::Pending + } else { + task::Poll::Ready(Err(std::io::Error::new( + std::io::ErrorKind::UnexpectedEof, + "all senders dropped", + ))) + } + } + + fn local_addr(&self) -> std::io::Result { + Ok(self.local) + } +} + +pub(crate) fn make_endpoint( + socket: FlumeSocket, + config: EndpointConfig, + server_config: Option, +) -> io::Result { + quinn::Endpoint::new_with_abstract_socket( + config, + server_config, + socket, + Arc::new(quinn::TokioRuntime), + ) +} + +/// Create a pair of directly connected endpoints. +/// +/// Useful for testing. +pub fn endpoint_pair( + server_addr: SocketAddr, + client_addr: SocketAddr, + server_config: quinn::ServerConfig, +) -> io::Result<(quinn::Endpoint, quinn::Endpoint)> { + let (tx1, rx1) = flume::bounded(16); + let (tx2, rx2) = flume::bounded(16); + let server = FlumeSocket::new(server_addr, tx1, rx2); + let client = FlumeSocket::new(client_addr, tx2, rx1); + let ac = EndpointConfig::default(); + let bc = EndpointConfig::default(); + Ok(( + make_endpoint(server, ac, Some(server_config))?, + make_endpoint(client, bc, None)?, + )) +} diff --git a/tests/interprocess.rs b/tests/interprocess.rs new file mode 100644 index 0000000..6cb953c --- /dev/null +++ b/tests/interprocess.rs @@ -0,0 +1,404 @@ +#![cfg(feature = "interprocess-transport")] +use std::{ + net::{Ipv4Addr, SocketAddr, SocketAddrV4}, + sync::Arc, +}; + +use interprocess::local_socket::ListenerOptions; +use quic_rpc::{ + transport::interprocess::{new_socket_name, tokio_io_endpoint}, + RpcClient, RpcServer, +}; +use quinn::{ClientConfig, Endpoint, ServerConfig}; +use tokio::io::{AsyncBufReadExt, AsyncWriteExt, BufReader}; +use tokio::task::JoinHandle; + +mod math; +use math::*; +mod util; + +/// Constructs a QUIC endpoint configured for use a client only. +/// +/// ## Args +/// +/// - server_certs: list of trusted certificates. +#[allow(unused)] +pub fn make_client_endpoint( + bind_addr: SocketAddr, + server_certs: &[&[u8]], +) -> anyhow::Result { + let client_cfg = configure_client(server_certs)?; + let mut endpoint = Endpoint::client(bind_addr)?; + endpoint.set_default_client_config(client_cfg); + Ok(endpoint) +} + +/// Constructs a QUIC endpoint configured to listen for incoming connections on a certain address +/// and port. +/// +/// ## Returns +/// +/// - a stream of incoming QUIC connections +/// - server certificate serialized into DER format +#[allow(unused)] +pub fn make_server_endpoint(bind_addr: SocketAddr) -> anyhow::Result<(Endpoint, Vec)> { + let (server_config, server_cert) = configure_server()?; + let endpoint = Endpoint::server(server_config, bind_addr)?; + Ok((endpoint, server_cert)) +} + +/// Builds default quinn client config and trusts given certificates. +/// +/// ## Args +/// +/// - server_certs: a list of trusted certificates in DER format. +fn configure_client(server_certs: &[&[u8]]) -> anyhow::Result { + let mut certs = rustls::RootCertStore::empty(); + for cert in server_certs { + certs.add(&rustls::Certificate(cert.to_vec()))?; + } + Ok(ClientConfig::with_root_certificates(certs)) +} + +/// Returns default server configuration along with its certificate. +#[allow(clippy::field_reassign_with_default)] // https://github.com/rust-lang/rust-clippy/issues/6527 +fn configure_server() -> anyhow::Result<(ServerConfig, Vec)> { + let cert = rcgen::generate_simple_self_signed(vec!["localhost".into()])?; + let cert_der = cert.serialize_der()?; + let priv_key = cert.serialize_private_key_der(); + let priv_key = rustls::PrivateKey(priv_key); + let cert_chain = vec![rustls::Certificate(cert_der.clone())]; + + let mut server_config = ServerConfig::with_single_cert(cert_chain, priv_key)?; + Arc::get_mut(&mut server_config.transport) + .unwrap() + .max_concurrent_uni_streams(0_u8.into()); + + Ok((server_config, cert_der)) +} + +pub struct Endpoints { + client: Endpoint, + server: Endpoint, + server_addr: SocketAddr, +} + +pub fn make_endpoints() -> anyhow::Result { + let server_addr: SocketAddr = SocketAddr::V4(SocketAddrV4::new(Ipv4Addr::LOCALHOST, 1)); + let client_addr: SocketAddr = SocketAddr::V4(SocketAddrV4::new(Ipv4Addr::LOCALHOST, 2)); + let (server_config, server_cert) = configure_server()?; + let client_config = configure_client(&[&server_cert])?; + let (server, mut client) = quic_rpc::transport::quinn_flume_socket::endpoint_pair( + server_addr, + client_addr, + server_config, + ) + .unwrap(); + client.set_default_client_config(client_config); + Ok(Endpoints { + client, + server, + server_addr, + }) +} + +fn run_server(server: quinn::Endpoint) -> JoinHandle> { + tokio::task::spawn(async move { + let connection = + quic_rpc::transport::quinn::QuinnServerEndpoint::::new(server)?; + let server = RpcServer::::new(connection); + ComputeService::server(server).await?; + anyhow::Ok(()) + }) +} + +#[tokio::test] +async fn quinn_flume_socket_raw() -> anyhow::Result<()> { + tracing_subscriber::fmt::try_init().ok(); + let Endpoints { + client, + server, + server_addr, + } = make_endpoints()?; + tracing::debug!("Starting server"); + let server = tokio::spawn(async move { + tracing::info!("server started"); + while let Some(connecting) = server.accept().await { + tracing::info!("server accepted connection"); + let connection = connecting.await?; + while let Ok((mut send, mut recv)) = connection.accept_bi().await { + tracing::info!("server accepted bidi stream"); + tokio::io::copy(&mut recv, &mut send).await?; + tracing::info!("server done with bidi stream"); + } + } + anyhow::Ok(()) + }); + let client = tokio::spawn(async move { + let conn = client.connect(server_addr, "localhost")?.await?; + let (mut send, mut recv) = conn.open_bi().await?; + tracing::info!("client connected"); + tokio::spawn(async move { + tracing::info!("outputting data from server"); + tokio::io::copy(&mut recv, &mut tokio::io::stdout()).await?; + tracing::info!("outputting data from server done"); + anyhow::Ok(()) + }); + tracing::info!("sending data to be echoed"); + let test = vec![0u8; 1024]; + send.write_all(&test).await?; + tracing::info!("sending data done"); + anyhow::Ok(()) + }); + server.await??; + client.await??; + Ok(()) +} + +#[tokio::test(flavor = "multi_thread", worker_threads = 2)] +async fn quinn_flume_channel_bench() -> anyhow::Result<()> { + tracing_subscriber::fmt::try_init().ok(); + let Endpoints { + client, + server, + server_addr, + } = make_endpoints()?; + tracing::debug!("Starting server"); + let server_handle = run_server(server); + tracing::debug!("Starting client"); + let client = quic_rpc::transport::quinn::QuinnConnection::::new( + client, + server_addr, + "localhost".into(), + ); + let client = RpcClient::::new(client); + tracing::debug!("Starting benchmark"); + bench(client, 50000).await?; + server_handle.abort(); + Ok(()) +} + +#[tokio::test(flavor = "multi_thread", worker_threads = 2)] +async fn quinn_flume_channel_smoke() -> anyhow::Result<()> { + tracing_subscriber::fmt::try_init().ok(); + let Endpoints { + client, + server, + server_addr, + } = make_endpoints()?; + let server_handle = run_server(server); + let client_connection = quic_rpc::transport::quinn::QuinnConnection::::new( + client, + server_addr, + "localhost".into(), + ); + smoke_test(client_connection).await?; + server_handle.abort(); + Ok(()) +} + +/// Basic test of the interprocess crate. +/// Just sends a message from client to server and back. +#[tokio::test(flavor = "multi_thread", worker_threads = 2)] +async fn interprocess_accept_connect_raw() -> anyhow::Result<()> { + tracing_subscriber::fmt::try_init().ok(); + use interprocess::local_socket::tokio::prelude::*; + let dir = tempfile::tempdir()?; + let socket_name = new_socket_name(dir.path(), "interprocess-accept-connect-raw")?; + let socket = ListenerOptions::new() + .name(socket_name.clone()) + .create_tokio()?; + let socket_name_2 = socket_name.clone(); + let server = tokio::spawn(async move { + tracing::info!("server: spawn"); + let stream = socket.accept().await?; + tracing::info!("server: accepted"); + let (r, mut w) = stream.split(); + + let mut buffer = String::new(); + let mut reader = BufReader::new(r); + + tracing::info!("server: reading"); + reader.read_line(&mut buffer).await?; + tracing::info!("server: read: {:?}", buffer); + w.write_all(buffer.as_bytes()).await?; + + anyhow::Ok(()) + }); + let client = tokio::spawn(async move { + tracing::info!("client: spawned"); + let stream = LocalSocketStream::connect(socket_name_2.clone()).await?; + tracing::info!("client: connected"); + let (r, mut w) = stream.split(); + + tracing::info!("client: writting"); + w.write_all(b"hello").await?; + w.write_all(b"world").await?; + w.write_all(b"\n").await?; + tracing::info!("client: written"); + let validator = tokio::spawn(async move { + tracing::info!("client: reading response"); + let mut buffer = String::new(); + let mut reader = BufReader::new(r); + reader.read_line(&mut buffer).await?; + let pass = buffer == "helloworld\n"; + + anyhow::Ok(pass) + }); + drop(w); + validator.await? + }); + server.await??; + assert!(client.await??, "echo test failed"); + Ok(()) +} + +/// Test of quinn on top of interprocess. +/// Just sends a message from client to server and back. +#[tokio::test] +async fn interprocess_quinn_accept_connect_raw() -> anyhow::Result<()> { + tracing_subscriber::fmt::try_init().ok(); + use interprocess::local_socket::tokio::prelude::*; + let (server_config, server_certs) = configure_server()?; + let client_config = configure_client(&[&server_certs])?; + + let dir = tempfile::tempdir()?; + let socket_name = new_socket_name(dir.path(), "interprocess-quinn-accet-connect-raw")?; + let socket = ListenerOptions::new() + .name(socket_name.clone()) + .create_tokio()?; + let local = SocketAddrV4::new(Ipv4Addr::LOCALHOST, 1).into(); + let remote = SocketAddrV4::new(Ipv4Addr::LOCALHOST, 2).into(); + let server = tokio::spawn(async move { + let stream = socket.accept().await?; + let (r, w) = stream.split(); + let (endpoint, _s, _r) = tokio_io_endpoint(r, w, remote, local, Some(server_config))?; + tracing::debug!("server accepting connection"); + let connection = endpoint.accept().await.unwrap().await?; + tracing::debug!("server accepted connection"); + let (mut send, mut recv) = connection.accept_bi().await?; + tracing::debug!("server accepted bi stream"); + tracing::debug!("server copying"); + let n = tokio::io::copy(&mut recv, &mut send).await?; + tracing::debug!("server done copying {} bytes", n); + // need to keep the connection alive until the client is done + anyhow::Ok(connection) + }); + let client = tokio::spawn(async move { + let stream = LocalSocketStream::connect(socket_name).await?; + let (r, w) = stream.split(); + let (mut endpoint, _s, _r) = tokio_io_endpoint(r, w, local, remote, None)?; + endpoint.set_default_client_config(client_config); + tracing::debug!("client connecting to server at {} using localhost", remote); + let connection = endpoint.connect(remote, "localhost")?.await?; + tracing::debug!("client got connection"); + let (mut send, mut recv) = connection.open_bi().await?; + tracing::debug!("client got bi stream"); + let validator = tokio::spawn(async move { + let mut out = Vec::::new(); + tracing::debug!("client validator reading data"); + tokio::io::copy(&mut recv, &mut out).await.ok(); + tracing::debug!("client validator done reading data {}", out.len()); + let pass = out == b"helloworld"; + anyhow::Ok(pass) + }); + tracing::debug!("client sending data"); + send.write_all(b"hello").await?; + send.write_all(b"world").await?; + send.finish().await?; + tracing::debug!("client finished sending data"); + drop(send); + validator.await? + }); + let connection = server.await??; + assert!(client.await??, "echo test failed"); + drop(connection); + Ok(()) +} + +/// Smoke test of quinn on top of interprocess. +#[tokio::test] +async fn interprocess_quinn_smoke() -> anyhow::Result<()> { + tracing_subscriber::fmt::try_init().ok(); + use interprocess::local_socket::tokio::prelude::*; + let (server_config, server_certs) = configure_server()?; + let client_config = configure_client(&[&server_certs])?; + + let dir = tempfile::tempdir()?; + let socket_name = new_socket_name(dir.path(), "interprocess-quinn-smoke")?; + let socket = ListenerOptions::new() + .name(socket_name.clone()) + .create_tokio()?; + let local = SocketAddrV4::new(Ipv4Addr::LOCALHOST, 1).into(); + let remote = SocketAddrV4::new(Ipv4Addr::LOCALHOST, 2).into(); + let server = tokio::spawn(async move { + let stream = socket.accept().await?; + let (r, w) = stream.split(); + let (endpoint, _s, _r) = tokio_io_endpoint(r, w, remote, local, Some(server_config))?; + // run rpc server on endpoint + tracing::debug!("creating test rpc server"); + let _server_task = run_server(endpoint); + anyhow::Ok(()) + }); + let client = tokio::spawn(async move { + let stream = LocalSocketStream::connect(socket_name).await?; + let (r, w) = stream.split(); + let (mut endpoint, _s, _r) = tokio_io_endpoint(r, w, local, remote, None)?; + endpoint.set_default_client_config(client_config); + tracing::debug!( + "creating test rpc client, connecting to server at {} using localhost", + remote + ); + let client: quic_rpc::transport::quinn::QuinnConnection = + quic_rpc::transport::quinn::QuinnConnection::new(endpoint, remote, "localhost".into()); + smoke_test(client).await?; + anyhow::Ok(()) + }); + server.await??; + client.await??; + Ok(()) +} + +/// Bench test of quinn on top of interprocess. +#[tokio::test] +async fn interprocess_quinn_bench() -> anyhow::Result<()> { + tracing_subscriber::fmt::try_init().ok(); + use interprocess::local_socket::tokio::prelude::*; + let (server_config, server_certs) = configure_server()?; + let client_config = configure_client(&[&server_certs])?; + + let dir = tempfile::tempdir()?; + let socket_name = new_socket_name(dir.path(), "interprocess-quinn-bench")?; + let socket = ListenerOptions::new() + .name(socket_name.clone()) + .create_tokio()?; + let local = SocketAddrV4::new(Ipv4Addr::LOCALHOST, 1).into(); + let remote = SocketAddrV4::new(Ipv4Addr::LOCALHOST, 2).into(); + let server = tokio::spawn(async move { + let stream = socket.accept().await?; + let (r, w) = stream.split(); + let (endpoint, _s, _r) = tokio_io_endpoint(r, w, remote, local, Some(server_config))?; + // run rpc server on endpoint + tracing::debug!("creating test rpc server"); + let _server_task = run_server(endpoint); + anyhow::Ok(()) + }); + let client = tokio::spawn(async move { + let stream = LocalSocketStream::connect(socket_name).await?; + let (r, w) = stream.split(); + let (mut endpoint, _s, _r) = tokio_io_endpoint(r, w, local, remote, None)?; + endpoint.set_default_client_config(client_config); + tracing::debug!( + "creating test rpc client, connecting to server at {} using localhost", + remote + ); + let client: quic_rpc::transport::quinn::QuinnConnection = + quic_rpc::transport::quinn::QuinnConnection::new(endpoint, remote, "localhost".into()); + let client = RpcClient::new(client); + bench(client, 50000).await?; + anyhow::Ok(()) + }); + server.await??; + client.await??; + Ok(()) +} diff --git a/tests/math.rs b/tests/math.rs index c15ade1..aa92e08 100644 --- a/tests/math.rs +++ b/tests/math.rs @@ -1,7 +1,8 @@ #![cfg(any( feature = "flume-transport", feature = "hyper-transport", - feature = "quinn-transport" + feature = "quinn-transport", + feature = "interprocess-transport", ))] #![allow(dead_code)] use async_stream::stream;