diff --git a/CHANGELOG.md b/CHANGELOG.md index 88551fe9..b3509975 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ # Unreleased +- Use `kanal` instead of `flume` as channel library #200 - Print help message when no argument is given #378 - Lookup DNS at beginning and cache it #391 diff --git a/Cargo.lock b/Cargo.lock index acef8e7b..0ee2213c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -57,9 +57,9 @@ checksum = "0942ffc6dcaadf03badf6e6a2d0228460359d5e34b57ccdc720b7382dfbd5ec5" [[package]] name = "anstream" -version = "0.6.7" +version = "0.6.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4cd2405b3ac1faab2990b74d728624cd9fd115651fcecc7c2d8daf01376275ba" +checksum = "6e2e1ebcb11de5c03c67de28a7df593d32191b44939c482e97702baaaa6ab6a5" dependencies = [ "anstyle", "anstyle-parse", @@ -71,9 +71,9 @@ dependencies = [ [[package]] name = "anstyle" -version = "1.0.4" +version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7079075b41f533b8c61d2a4d073c4676e1f8b249ff94a393b0595db304e0dd87" +checksum = "2faccea4cc4ab4a667ce676a30e8ec13922a692c99bb8f5b11f1502c72e04220" [[package]] name = "anstyle-parse" @@ -242,9 +242,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.4.1" +version = "2.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07" +checksum = "ed570934406eb16438a4e976b1b4500774099c13b8cb96eec99f620f05090ddf" [[package]] name = "bitvec" @@ -293,17 +293,11 @@ dependencies = [ "serde", ] -[[package]] -name = "bumpalo" -version = "3.14.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec" - [[package]] name = "byte-unit" -version = "5.1.3" +version = "5.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cbda27216be70d08546aa506cecabce0c5eb0d494aaaedbd7ec82c8ae1a60b46" +checksum = "33ac19bdf0b2665407c39d82dbc937e951e7e2001609f0fb32edd0af45a2d63e" dependencies = [ "rust_decimal", "serde", @@ -367,9 +361,9 @@ checksum = "fd16c4719339c4530435d38e511904438d07cce7950afa3718a84ac36c10e89e" [[package]] name = "clap" -version = "4.4.17" +version = "4.4.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80932e03c33999b9235edb8655bc9df3204adc9887c2f95b50cb1deb9fd54253" +checksum = "1e578d6ec4194633722ccf9544794b71b1385c3c027efe0c55db226fc880865c" dependencies = [ "clap_builder", "clap_derive", @@ -377,9 +371,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.4.17" +version = "4.4.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6c0db58c659eef1c73e444d298c27322a1b52f6927d2ad470c0c0f96fa7b8fa" +checksum = "4df4df40ec50c46000231c914968278b1eb05098cf8f1b3a518a95030e71d1c7" dependencies = [ "anstream", "anstyle", @@ -433,7 +427,7 @@ version = "0.27.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f476fe445d41c9e991fd07515a6f463074b782242ccf4a5b7b1d1012e70824df" dependencies = [ - "bitflags 2.4.1", + "bitflags 2.4.2", "crossterm_winapi", "libc", "mio", @@ -525,18 +519,6 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8ce81f49ae8a0482e4c55ea62ebbd7e5a686af544c00b9d090bba3ff9be97b3d" -[[package]] -name = "flume" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "55ac459de2512911e4b674ce33cf20befaba382d05b62b008afc1c8b57cbf181" -dependencies = [ - "futures-core", - "futures-sink", - "nanorand", - "spin", -] - [[package]] name = "fnv" version = "1.0.7" @@ -669,10 +651,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "190092ea657667030ac6a35e305e62fc4dd69fd98ac98631e5d3a2b1575a12b5" dependencies = [ "cfg-if", - "js-sys", "libc", "wasi", - "wasm-bindgen", ] [[package]] @@ -727,9 +707,9 @@ checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" [[package]] name = "hermit-abi" -version = "0.3.3" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d77f7ec81a6d05a3abb01ab6eb7590f6083d08449fe5a1c8b1e620283546ccb7" +checksum = "5d3d0e0f38255e7fa3cf31335b3a56f05febd18025f4db5ef7a0cfb4f8da651f" [[package]] name = "hickory-proto" @@ -861,12 +841,11 @@ dependencies = [ [[package]] name = "hyper-util" -version = "0.1.2" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bdea9aac0dbe5a9240d68cfd9501e2db94222c6dc06843e06640b9e07f0fdc67" +checksum = "ca38ef113da30126bbff9cd1705f9273e15d45498615d138b0c20279ac7a76aa" dependencies = [ "bytes", - "futures-channel", "futures-util", "http", "http-body", @@ -874,7 +853,6 @@ dependencies = [ "pin-project-lite", "socket2", "tokio", - "tracing", ] [[package]] @@ -899,9 +877,9 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.1.0" +version = "2.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d530e1a18b1cb4c484e6e34556a0d948706958449fca0cab753d649f2bce3d1f" +checksum = "824b2ae422412366ba479e8111fd301f7b5faece8149317bb81925979a53f520" dependencies = [ "equivalent", "hashbrown 0.14.3", @@ -933,9 +911,9 @@ checksum = "8f518f335dce6725a761382244631d86cf0ccb2863413590b31338feb467f9c3" [[package]] name = "itertools" -version = "0.12.0" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25db6b064527c5d482d0423354fcd07a89a2dfe07b67892e62411946db7f07b0" +checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569" dependencies = [ "either", ] @@ -967,12 +945,12 @@ dependencies = [ ] [[package]] -name = "js-sys" -version = "0.3.67" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a1d36f1235bc969acba30b7f5990b864423a6068a10f7c90ae8f0112e3a59d1" +name = "kanal" +version = "0.1.0-pre8" +source = "git+https://github.com/fereidani/kanal.git#92690954ee22d679fb735033762603c89dde8ca7" dependencies = [ - "wasm-bindgen", + "futures-core", + "lock_api", ] [[package]] @@ -983,9 +961,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.152" +version = "0.2.153" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13e3bf6590cbc649f4d1a3eefc9d5d6eb746f5200ffb04e5e142700b8faa56e7" +checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" [[package]] name = "libm" @@ -1001,9 +979,9 @@ checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f" [[package]] name = "linux-raw-sys" -version = "0.4.12" +version = "0.4.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4cd1a83af159aa67994778be9070f0ae1bd732942279cabb14f86f986a21456" +checksum = "01cda141df6706de531b6c46c3a33ecca755538219bd484262fa09410c13539c" [[package]] name = "lock_api" @@ -1023,9 +1001,9 @@ checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" [[package]] name = "lru" -version = "0.12.1" +version = "0.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2994eeba8ed550fd9b47a0b38f0242bc3344e496483c6180b69139cc2fa5d1d7" +checksum = "db2c024b41519440580066ba82aab04092b333e09066a5eb86c7c4890df31f22" dependencies = [ "hashbrown 0.14.3", ] @@ -1084,15 +1062,6 @@ dependencies = [ "windows-sys 0.48.0", ] -[[package]] -name = "nanorand" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a51313c5820b0b02bd422f4b44776fbf47961755c74ce64afc73bfad10226c3" -dependencies = [ - "getrandom", -] - [[package]] name = "native-tls" version = "0.2.11" @@ -1154,7 +1123,6 @@ dependencies = [ "clap", "crossterm", "float-ord", - "flume", "futures", "hickory-resolver", "http-body-util", @@ -1162,6 +1130,7 @@ dependencies = [ "hyper", "hyper-util", "jemallocator", + "kanal", "lazy_static", "libc", "native-tls", @@ -1192,11 +1161,11 @@ checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" [[package]] name = "openssl" -version = "0.10.62" +version = "0.10.63" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8cde4d2d9200ad5909f8dac647e29482e07c3a35de8a13fce7c9c7747ad9f671" +checksum = "15c9d69dd87a29568d4d017cfe8ec518706046a05184e5aea92d0af890b803c8" dependencies = [ - "bitflags 2.4.1", + "bitflags 2.4.2", "cfg-if", "foreign-types", "libc", @@ -1224,9 +1193,9 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" [[package]] name = "openssl-sys" -version = "0.9.98" +version = "0.9.99" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1665caf8ab2dc9aef43d1c0023bd904633a6a05cb30b0ad59bec2ae986e57a7" +checksum = "22e1bf214306098e4832460f797824c05d25aacdf896f64a985fb0fd992454ae" dependencies = [ "cc", "libc", @@ -1271,18 +1240,18 @@ checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" [[package]] name = "pin-project" -version = "1.1.3" +version = "1.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fda4ed1c6c173e3fc7a83629421152e01d7b1f9b7f65fb301e490e8cfc656422" +checksum = "0302c4a0442c456bd56f841aee5c3bfd17967563f6fadc9ceb9f9c23cf3807e0" dependencies = [ "pin-project-internal", ] [[package]] name = "pin-project-internal" -version = "1.1.3" +version = "1.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405" +checksum = "266c042b60c9c76b8d53061e52b2e0d1116abc57cefc8c5cd671619a56ac3690" dependencies = [ "proc-macro2", "quote", @@ -1303,9 +1272,9 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] name = "pkg-config" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69d3587f8a9e599cc7ec2c00e331f71c4e69a5f9a4b8a6efd5b07466b9736f9a" +checksum = "2900ede94e305130c13ddd391e0ab7cbaeb783945ae07a279c268cb05109c6cb" [[package]] name = "ppv-lite86" @@ -1342,9 +1311,9 @@ dependencies = [ [[package]] name = "proc-macro-crate" -version = "3.0.0" +version = "3.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b2685dd208a3771337d8d386a89840f0f43cd68be8dae90a5f8c2384effc9cd" +checksum = "6d37c51ca738a55da99dc0c4a34860fd675453b8b36209178c2249bb13651284" dependencies = [ "toml_edit", ] @@ -1374,9 +1343,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.76" +version = "1.0.78" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95fc56cda0b5c3325f5fbbd7ff9fda9e02bb00bb3dac51252d2f1bfa1cb8cc8c" +checksum = "e2422ad645d89c99f8f3e6b88a9fdeca7fabeac836b1002371c4367c8f984aae" dependencies = [ "unicode-ident", ] @@ -1468,7 +1437,7 @@ version = "0.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a5659e52e4ba6e07b2dad9f1158f578ef84a73762625ddb51536019f34d180eb" dependencies = [ - "bitflags 2.4.1", + "bitflags 2.4.2", "cassowary", "crossterm", "indoc", @@ -1492,9 +1461,9 @@ dependencies = [ [[package]] name = "regex" -version = "1.10.2" +version = "1.10.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "380b951a9c5e80ddfd6136919eef32310721aa4aacd4889a8d39124b026ab343" +checksum = "b62dbe01f0b06f9d8dc7d49e05a0785f153b00b2c227856282f671e0318c9b15" dependencies = [ "aho-corasick", "memchr", @@ -1504,9 +1473,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.3" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f804c7828047e88b2d32e2d7fe5a105da8ee3264f01902f796c8e067dc2483f" +checksum = "5bb987efffd3c6d0d8f5f89510bb458559eab11e4f869acb20bf845e016259cd" dependencies = [ "aho-corasick", "memchr", @@ -1592,9 +1561,9 @@ dependencies = [ [[package]] name = "rust_decimal" -version = "1.33.1" +version = "1.34.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06676aec5ccb8fc1da723cc8c0f9a46549f21ebb8753d3915c6c41db1e7f1dc4" +checksum = "755392e1a2f77afd95580d3f0d0e94ac83eeeb7167552c9b5bca549e61a94d83" dependencies = [ "arrayvec", "borsh", @@ -1614,11 +1583,11 @@ checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" [[package]] name = "rustix" -version = "0.38.30" +version = "0.38.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "322394588aaf33c24007e8bb3238ee3e4c5c09c084ab32bc73890b99ff326bca" +checksum = "6ea3e1a662af26cd7a3ba09c0297a31af215563ecf42817c98df621387f4e949" dependencies = [ - "bitflags 2.4.1", + "bitflags 2.4.2", "errno", "libc", "linux-raw-sys", @@ -1664,15 +1633,15 @@ dependencies = [ [[package]] name = "rustls-pki-types" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e9d979b3ce68192e42760c7810125eb6cf2ea10efae545a156063e61f314e2a" +checksum = "0a716eb65e3158e90e17cd93d855216e27bde02745ab842f2cab4a39dba1bacf" [[package]] name = "rustls-webpki" -version = "0.102.1" +version = "0.102.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef4ca26037c909dedb327b48c3327d0ba91d3dd3c4e05dad328f210ffb68e95b" +checksum = "faaa0a62740bedb9b2ef5afa303da42764c012f743917351dc9a237ea1663610" dependencies = [ "ring", "rustls-pki-types", @@ -1737,18 +1706,18 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.195" +version = "1.0.196" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "63261df402c67811e9ac6def069e4786148c4563f4b50fd4bf30aa370d626b02" +checksum = "870026e60fa08c69f064aa766c10f10b1d62db9ccd4d0abb206472bee0ce3b32" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.195" +version = "1.0.196" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46fe8f8603d81ba86327b23a2e9cdf49e1255fb94a4c5f297f6ee0547178ea2c" +checksum = "33c85360c95e7d137454dc81d9a4ed2b8efd8fbe19cee57357b32b9771fccb67" dependencies = [ "proc-macro2", "quote", @@ -1757,9 +1726,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.111" +version = "1.0.113" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "176e46fa42316f18edd598015a5166857fc835ec732f5215eac6b7bdbf0a84f4" +checksum = "69801b70b1c3dac963ecb03a364ba0ceda9cf60c71cfe475e99864759c8b8a79" dependencies = [ "itoa", "ryu", @@ -1835,9 +1804,9 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.12.0" +version = "1.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2593d31f82ead8df961d8bd23a64c2ccf2eb5dd34b0a34bfb4dd54011c72009e" +checksum = "e6ecd384b10a64542d77071bd64bd7b231f4ed5940fba55e98c3de13824cf3d7" [[package]] name = "socket2" @@ -1854,9 +1823,6 @@ name = "spin" version = "0.9.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" -dependencies = [ - "lock_api", -] [[package]] name = "stability" @@ -2004,9 +1970,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.35.1" +version = "1.36.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c89b4efa943be685f629b149f53829423f8f5531ea21249408e8e2f8671ec104" +checksum = "61285f6515fa018fb2d1e46eb21223fff441ee8db5d0f1435e8ab4f5cdb80931" dependencies = [ "backtrace", "bytes", @@ -2075,9 +2041,9 @@ checksum = "3550f4e9685620ac18a50ed434eb3aec30db8ba93b0287467bca5826ea25baf1" [[package]] name = "toml_edit" -version = "0.21.0" +version = "0.21.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d34d383cd00a163b4a5b85053df514d45bc330f6de7737edfe0a93311d1eaa03" +checksum = "6a8534fd7f78b5405e860340ad6575217ce99f38d4d5c8f2442cb5ecb50090e1" dependencies = [ "indexmap", "toml_datetime", @@ -2152,9 +2118,9 @@ checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" [[package]] name = "unicode-bidi" -version = "0.3.14" +version = "0.3.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f2528f27a9eb2b21e69c95319b30bd0efd85d09c379741b0f78ea1d86be2416" +checksum = "08f95100a766bf4f8f28f90d77e0a5461bbdb219042e7679bebe79004fed8d75" [[package]] name = "unicode-ident" @@ -2214,9 +2180,9 @@ checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" [[package]] name = "uuid" -version = "1.6.1" +version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e395fcf16a7a3d8127ec99782007af141946b4795001f876d54fb0d55978560" +checksum = "f00cc9702ca12d3c81455259621e676d0f7251cec66a21e98fe2e9a37db93b2a" [[package]] name = "vcpkg" @@ -2254,60 +2220,6 @@ version = "0.11.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" -[[package]] -name = "wasm-bindgen" -version = "0.2.90" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1223296a201415c7fad14792dbefaace9bd52b62d33453ade1c5b5f07555406" -dependencies = [ - "cfg-if", - "wasm-bindgen-macro", -] - -[[package]] -name = "wasm-bindgen-backend" -version = "0.2.90" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcdc935b63408d58a32f8cc9738a0bffd8f05cc7c002086c6ef20b7312ad9dcd" -dependencies = [ - "bumpalo", - "log", - "once_cell", - "proc-macro2", - "quote", - "syn 2.0.48", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-macro" -version = "0.2.90" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e4c238561b2d428924c49815533a8b9121c664599558a5d9ec51f8a1740a999" -dependencies = [ - "quote", - "wasm-bindgen-macro-support", -] - -[[package]] -name = "wasm-bindgen-macro-support" -version = "0.2.90" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bae1abb6806dc1ad9e560ed242107c0f6c84335f1749dd4e8ddb012ebd5e25a7" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.48", - "wasm-bindgen-backend", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-shared" -version = "0.2.90" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d91413b1c31d7539ba5ef2451af3f0b833a005eb27a631cec32bc0635a8602b" - [[package]] name = "widestring" version = "1.0.2" @@ -2470,9 +2382,9 @@ checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" [[package]] name = "winnow" -version = "0.5.34" +version = "0.5.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7cf47b659b318dccbd69cc4797a39ae128f533dce7902a1096044d1967b9c16" +checksum = "818ce546a11a9986bc24f93d0cdf38a8a1a400f1473ea8c82e59f6e0ffab9249" dependencies = [ "memchr", ] diff --git a/Cargo.toml b/Cargo.toml index 99293224..4b6a726f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -34,7 +34,7 @@ byte-unit = "5.1.2" clap = { version = "4.1.4", features = ["derive"] } crossterm = "0.27" float-ord = "0.3.1" -flume = "0.11" +kanal = { git = "https://github.com/fereidani/kanal.git" } futures = "0.3.30" humantime = "2.0.0" libc = "0.2.147" @@ -70,6 +70,8 @@ hyper-util = { version = "0.1.1", features = ["tokio"] } [target.'cfg(unix)'.dependencies] rlimit = "0.10.0" + +[target.'cfg(linux)'.dependencies] jemallocator = "0.5.0" [dev-dependencies] diff --git a/src/client.rs b/src/client.rs index 9f05dad7..a7fc07d0 100644 --- a/src/client.rs +++ b/src/client.rs @@ -10,6 +10,7 @@ use std::{pin::Pin, sync::Arc}; use thiserror::Error; use tokio::net::TcpStream; use url::{ParseError, Url}; +use kanal::AsyncSender; use crate::{ url_generator::{UrlGenerator, UrlGeneratorError}, @@ -795,7 +796,7 @@ fn set_start_latency_correction( /// Run n tasks by m workers pub async fn work( client: Client, - report_tx: flume::Sender>, + report_tx: AsyncSender>, n_tasks: usize, n_connections: usize, n_http2_parallel: usize, @@ -807,7 +808,7 @@ pub async fn work( if client.is_http2() { let futures = (0..n_connections) - .map(|_| { + .map(move |_| { let report_tx = report_tx.clone(); let counter = counter.clone(); let client = client.clone(); @@ -831,7 +832,7 @@ pub async fn work( let is_cancel = is_cancel_error(&res); let is_reconnect = is_hyper_error(&res); set_connection_time(&mut res, connection_time); - report_tx.send_async(res).await.unwrap(); + report_tx.send(res).await.unwrap(); if is_cancel || is_reconnect { return is_cancel; } @@ -863,7 +864,7 @@ pub async fn work( } Err(err) => { if counter.fetch_add(1, Ordering::Relaxed) < n_tasks { - report_tx.send_async(Err(err)).await.unwrap(); + report_tx.send(Err(err)).await.unwrap(); } else { return; } @@ -878,7 +879,7 @@ pub async fn work( } } else { let futures = (0..n_connections) - .map(|_| { + .map(move |_| { let report_tx = report_tx.clone(); let counter = counter.clone(); let client = client.clone(); @@ -887,7 +888,7 @@ pub async fn work( while counter.fetch_add(1, Ordering::Relaxed) < n_tasks { let res = client.work_http1(&mut client_state, None).await; let is_cancel = is_cancel_error(&res); - report_tx.send_async(res).await.unwrap(); + report_tx.send(res).await.unwrap(); if is_cancel { break; } @@ -904,13 +905,13 @@ pub async fn work( /// n tasks by m workers limit to qps works in a second pub async fn work_with_qps( client: Client, - report_tx: flume::Sender>, + report_tx: AsyncSender>, query_limit: QueryLimit, n_tasks: usize, n_connections: usize, n_http2_parallel: usize, ) { - let (tx, rx) = flume::unbounded(); + let (tx, rx) = kanal::unbounded_async(); match query_limit { QueryLimit::Qps(qps) => { @@ -921,7 +922,7 @@ pub async fn work_with_qps( (start + i as u32 * std::time::Duration::from_secs(1) / qps as u32).into(), ) .await; - tx.send_async(()).await.unwrap(); + tx.send(()).await.unwrap(); } // tx gone }); @@ -933,7 +934,7 @@ pub async fn work_with_qps( while n + rate < n_tasks { tokio::time::sleep(duration).await; for _ in 0..rate { - tx.send_async(()).await.unwrap(); + tx.send(()).await.unwrap(); } n += rate; } @@ -941,7 +942,7 @@ pub async fn work_with_qps( if n_tasks > n { tokio::time::sleep(duration).await; for _ in 0..n_tasks - n { - tx.send_async(()).await.unwrap(); + tx.send(()).await.unwrap(); } } // tx gone @@ -953,7 +954,7 @@ pub async fn work_with_qps( if client.is_http2() { let futures = (0..n_connections) - .map(|_| { + .map(move |_| { let report_tx = report_tx.clone(); let rx = rx.clone(); let client = client.clone(); @@ -968,14 +969,14 @@ pub async fn work_with_qps( let client = client.clone(); let mut client_state = client_state.clone(); tokio::spawn(async move { - while let Ok(()) = rx.recv_async().await { + while let Ok(()) = rx.recv().await { let mut res = client .work_http2(&mut client_state, None) .await; let is_cancel = is_cancel_error(&res); let is_reconnect = is_hyper_error(&res); set_connection_time(&mut res, connection_time); - report_tx.send_async(res).await.unwrap(); + report_tx.send(res).await.unwrap(); if is_cancel || is_reconnect { return is_cancel; } @@ -1004,8 +1005,8 @@ pub async fn work_with_qps( } Err(err) => { // Consume a task - if let Ok(()) = rx.recv_async().await { - report_tx.send_async(Err(err)).await.unwrap(); + if let Ok(()) = rx.recv().await { + report_tx.send(Err(err)).await.unwrap(); } else { return; } @@ -1020,16 +1021,16 @@ pub async fn work_with_qps( } } else { let futures = (0..n_connections) - .map(|_| { + .map(move |_| { let report_tx = report_tx.clone(); let rx = rx.clone(); let client = client.clone(); tokio::spawn(async move { let mut client_state = ClientStateHttp1::default(); - while let Ok(()) = rx.recv_async().await { + while let Ok(()) = rx.recv().await { let res = client.work_http1(&mut client_state, None).await; let is_cancel = is_cancel_error(&res); - report_tx.send_async(res).await.unwrap(); + report_tx.send(res).await.unwrap(); if is_cancel { break; } @@ -1046,13 +1047,13 @@ pub async fn work_with_qps( /// n tasks by m workers limit to qps works in a second with latency correction pub async fn work_with_qps_latency_correction( client: Client, - report_tx: flume::Sender>, + report_tx: AsyncSender>, query_limit: QueryLimit, n_tasks: usize, n_connections: usize, n_http2_parallel: usize, ) { - let (tx, rx) = flume::unbounded(); + let (tx, rx) = kanal::unbounded_async(); match query_limit { QueryLimit::Qps(qps) => { @@ -1063,7 +1064,7 @@ pub async fn work_with_qps_latency_correction( (start + i as u32 * std::time::Duration::from_secs(1) / qps as u32).into(), ) .await; - tx.send_async(std::time::Instant::now()).await.unwrap(); + tx.send(std::time::Instant::now()).await.unwrap(); } // tx gone }); @@ -1076,7 +1077,7 @@ pub async fn work_with_qps_latency_correction( tokio::time::sleep(duration).await; let now = std::time::Instant::now(); for _ in 0..rate { - tx.send_async(now).await.unwrap(); + tx.send(now).await.unwrap(); } n += rate; } @@ -1085,7 +1086,7 @@ pub async fn work_with_qps_latency_correction( tokio::time::sleep(duration).await; let now = std::time::Instant::now(); for _ in 0..n_tasks - n { - tx.send_async(now).await.unwrap(); + tx.send(now).await.unwrap(); } } // tx gone @@ -1097,7 +1098,7 @@ pub async fn work_with_qps_latency_correction( if client.is_http2() { let futures = (0..n_connections) - .map(|_| { + .map(move |_| { let report_tx = report_tx.clone(); let rx = rx.clone(); let client = client.clone(); @@ -1112,7 +1113,7 @@ pub async fn work_with_qps_latency_correction( let client = client.clone(); let mut client_state = client_state.clone(); tokio::spawn(async move { - while let Ok(start) = rx.recv_async().await { + while let Ok(start) = rx.recv().await { let mut res = client .work_http2(&mut client_state, None) .await; @@ -1120,7 +1121,7 @@ pub async fn work_with_qps_latency_correction( let is_reconnect = is_hyper_error(&res); set_connection_time(&mut res, connection_time); set_start_latency_correction(&mut res, start); - report_tx.send_async(res).await.unwrap(); + report_tx.send(res).await.unwrap(); if is_cancel || is_reconnect { return is_cancel; } @@ -1149,8 +1150,8 @@ pub async fn work_with_qps_latency_correction( } Err(err) => { // Consume a task - if rx.recv_async().await.is_ok() { - report_tx.send_async(Err(err)).await.unwrap(); + if rx.recv().await.is_ok() { + report_tx.send(Err(err)).await.unwrap(); } else { return; } @@ -1165,17 +1166,17 @@ pub async fn work_with_qps_latency_correction( } } else { let futures = (0..n_connections) - .map(|_| { + .map(move |_| { let client = client.clone(); let mut client_state = ClientStateHttp1::default(); let report_tx = report_tx.clone(); let rx = rx.clone(); tokio::spawn(async move { - while let Ok(start) = rx.recv_async().await { + while let Ok(start) = rx.recv().await { let mut res = client.work_http1(&mut client_state, None).await; set_start_latency_correction(&mut res, start); let is_cancel = is_cancel_error(&res); - report_tx.send_async(res).await.unwrap(); + report_tx.send(res).await.unwrap(); if is_cancel { break; } @@ -1192,7 +1193,7 @@ pub async fn work_with_qps_latency_correction( /// Run until dead_line by n workers pub async fn work_until( client: Client, - report_tx: flume::Sender>, + report_tx: AsyncSender>, dead_line: std::time::Instant, n_connections: usize, n_http2_parallel: usize, @@ -1200,7 +1201,7 @@ pub async fn work_until( let client = Arc::new(client); if client.is_http2() { let futures = (0..n_connections) - .map(|_| { + .map(move |_| { let client = client.clone(); let report_tx = report_tx.clone(); tokio::spawn(async move { @@ -1223,7 +1224,7 @@ pub async fn work_until( let is_cancel = is_cancel_error(&res); let is_reconnect = is_hyper_error(&res); set_connection_time(&mut res, connection_time); - report_tx.send_async(res).await.unwrap(); + report_tx.send(res).await.unwrap(); if is_cancel || is_reconnect { break is_cancel; } @@ -1244,7 +1245,7 @@ pub async fn work_until( } Err(err) => { - report_tx.send_async(Err(err)).await.unwrap(); + report_tx.send(Err(err)).await.unwrap(); if tokio::time::Instant::now() >= dead_line.into() { break; } @@ -1259,7 +1260,7 @@ pub async fn work_until( } } else { let futures = (0..n_connections) - .map(|_| { + .map(move |_| { let client = client.clone(); let report_tx = report_tx.clone(); let mut client_state = ClientStateHttp1::default(); @@ -1268,7 +1269,7 @@ pub async fn work_until( // This is where HTTP1 loops to make all the requests for a given client let res = client.work_http1(&mut client_state, Some(dead_line)).await; let is_cancel = is_cancel_error(&res); - report_tx.send_async(res).await.unwrap(); + report_tx.send(res).await.unwrap(); if is_cancel { break; } @@ -1285,7 +1286,7 @@ pub async fn work_until( /// Run until dead_line by n workers limit to qps works in a second pub async fn work_until_with_qps( client: Client, - report_tx: flume::Sender>, + report_tx: AsyncSender>, query_limit: QueryLimit, start: std::time::Instant, dead_line: std::time::Instant, @@ -1294,7 +1295,7 @@ pub async fn work_until_with_qps( ) { let rx = match query_limit { QueryLimit::Qps(qps) => { - let (tx, rx) = flume::bounded(qps); + let (tx, rx) = kanal::bounded_async(qps); tokio::spawn(async move { for i in 0.. { if std::time::Instant::now() > dead_line { @@ -1304,7 +1305,7 @@ pub async fn work_until_with_qps( (start + i as u32 * std::time::Duration::from_secs(1) / qps as u32).into(), ) .await; - if tx.send_async(()).await.is_err() { + if tx.send(()).await.is_err() { break; } } @@ -1313,7 +1314,7 @@ pub async fn work_until_with_qps( rx } QueryLimit::Burst(duration, rate) => { - let (tx, rx) = flume::unbounded(); + let (tx, rx) = kanal::unbounded_async(); tokio::spawn(async move { // Handle via rate till deadline is reached for _ in 0.. { @@ -1323,7 +1324,7 @@ pub async fn work_until_with_qps( tokio::time::sleep(duration).await; for _ in 0..rate { - tx.send_async(()).await.unwrap(); + tx.send(()).await.unwrap(); } } // tx gone @@ -1336,7 +1337,7 @@ pub async fn work_until_with_qps( if client.is_http2() { let futures = (0..n_connections) - .map(|_| { + .map(move |_| { let client = client.clone(); let report_tx = report_tx.clone(); let rx = rx.clone(); @@ -1351,14 +1352,14 @@ pub async fn work_until_with_qps( let rx = rx.clone(); let mut client_state = client_state.clone(); tokio::spawn(async move { - while let Ok(()) = rx.recv_async().await { + while let Ok(()) = rx.recv().await { let mut res = client .work_http2(&mut client_state, Some(dead_line)) .await; let is_cancel = is_cancel_error(&res); let is_reconnect = is_hyper_error(&res); set_connection_time(&mut res, connection_time); - report_tx.send_async(res).await.unwrap(); + report_tx.send(res).await.unwrap(); if is_cancel || is_reconnect { return is_cancel; } @@ -1387,8 +1388,8 @@ pub async fn work_until_with_qps( } Err(err) => { // Consume a task - if rx.recv_async().await.is_ok() { - report_tx.send_async(Err(err)).await.unwrap(); + if rx.recv().await.is_ok() { + report_tx.send(Err(err)).await.unwrap(); } else { return; } @@ -1404,16 +1405,16 @@ pub async fn work_until_with_qps( } } else { let futures = (0..n_connections) - .map(|_| { + .map(move |_| { let client = client.clone(); let mut client_state = ClientStateHttp1::default(); let report_tx = report_tx.clone(); let rx = rx.clone(); tokio::spawn(async move { - while let Ok(()) = rx.recv_async().await { + while let Ok(()) = rx.recv().await { let res = client.work_http1(&mut client_state, Some(dead_line)).await; let is_cancel = is_cancel_error(&res); - report_tx.send_async(res).await.unwrap(); + report_tx.send(res).await.unwrap(); if is_cancel { break; } @@ -1431,14 +1432,14 @@ pub async fn work_until_with_qps( /// Run until dead_line by n workers limit to qps works in a second with latency correction pub async fn work_until_with_qps_latency_correction( client: Client, - report_tx: flume::Sender>, + report_tx: AsyncSender>, query_limit: QueryLimit, start: std::time::Instant, dead_line: std::time::Instant, n_connections: usize, n_http2_parallel: usize, ) { - let (tx, rx) = flume::unbounded(); + let (tx, rx) = kanal::unbounded_async(); match query_limit { QueryLimit::Qps(qps) => { tokio::spawn(async move { @@ -1451,7 +1452,7 @@ pub async fn work_until_with_qps_latency_correction( if now > dead_line { break; } - if tx.send_async(now).await.is_err() { + if tx.send(now).await.is_err() { break; } } @@ -1469,7 +1470,7 @@ pub async fn work_until_with_qps_latency_correction( } for _ in 0..rate { - tx.send_async(now).await.unwrap(); + tx.send(now).await.unwrap(); } } // tx gone @@ -1481,7 +1482,7 @@ pub async fn work_until_with_qps_latency_correction( if client.is_http2() { let futures = (0..n_connections) - .map(|_| { + .map(move |_| { let client = client.clone(); let report_tx = report_tx.clone(); let rx = rx.clone(); @@ -1496,7 +1497,7 @@ pub async fn work_until_with_qps_latency_correction( let rx = rx.clone(); let mut client_state = client_state.clone(); tokio::spawn(async move { - while let Ok(start) = rx.recv_async().await { + while let Ok(start) = rx.recv().await { let mut res = client .work_http2(&mut client_state, Some(dead_line)) .await; @@ -1504,7 +1505,7 @@ pub async fn work_until_with_qps_latency_correction( set_connection_time(&mut res, connection_time); let is_cancel = is_cancel_error(&res); let is_reconnect = is_hyper_error(&res); - report_tx.send_async(res).await.unwrap(); + report_tx.send(res).await.unwrap(); if is_cancel || is_reconnect { return is_cancel; } @@ -1533,8 +1534,8 @@ pub async fn work_until_with_qps_latency_correction( } Err(err) => { - if rx.recv_async().await.is_ok() { - report_tx.send_async(Err(err)).await.unwrap(); + if rx.recv().await.is_ok() { + report_tx.send(Err(err)).await.unwrap(); } else { return; } @@ -1550,17 +1551,17 @@ pub async fn work_until_with_qps_latency_correction( } } else { let futures = (0..n_connections) - .map(|_| { + .map(move |_| { let client = client.clone(); let mut client_state = ClientStateHttp1::default(); let report_tx = report_tx.clone(); let rx = rx.clone(); tokio::spawn(async move { - while let Ok(start) = rx.recv_async().await { + while let Ok(start) = rx.recv().await { let mut res = client.work_http1(&mut client_state, Some(dead_line)).await; set_start_latency_correction(&mut res, start); let is_cancel = is_cancel_error(&res); - report_tx.send_async(res).await.unwrap(); + report_tx.send(res).await.unwrap(); if is_cancel { break; } diff --git a/src/main.rs b/src/main.rs index daf3562f..e965f333 100644 --- a/src/main.rs +++ b/src/main.rs @@ -21,7 +21,7 @@ mod printer; mod timescale; mod url_generator; -#[cfg(unix)] +#[cfg(linux)] #[global_allocator] static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc; @@ -366,7 +366,7 @@ async fn main() -> anyhow::Result<()> { PrintMode::Text }; - let (result_tx, result_rx) = flume::unbounded(); + let (result_tx, result_rx) = kanal::unbounded_async(); // When panics, reset terminal mode and exit immediately. std::panic::set_hook(Box::new(|info| { @@ -419,7 +419,7 @@ async fn main() -> anyhow::Result<()> { // When `--no-tui` is enabled, just collect all data. tokio::spawn( async move { - let (ctrl_c_tx, ctrl_c_rx) = flume::unbounded(); + let (ctrl_c_tx, ctrl_c_rx) = kanal::unbounded_async(); tokio::spawn(async move { if let Ok(()) = tokio::signal::ctrl_c().await { @@ -430,14 +430,14 @@ async fn main() -> anyhow::Result<()> { let mut all: Vec> = Vec::new(); loop { tokio::select! { - report = result_rx.recv_async() => { + report = result_rx.recv() => { if let Ok(report) = report { all.push(report); } else { break; } } - _ = ctrl_c_rx.recv_async() => { + _ = ctrl_c_rx.recv() => { // User pressed ctrl-c. let _ = printer::print_result(&mut std::io::stdout(),print_mode,start, &all, start.elapsed(), opts.disable_color, opts.stats_success_breakdown); std::process::exit(libc::EXIT_SUCCESS); diff --git a/src/monitor.rs b/src/monitor.rs index f9112d17..71d572b6 100644 --- a/src/monitor.rs +++ b/src/monitor.rs @@ -3,7 +3,7 @@ use crossterm::{ event::{Event, KeyCode, KeyEvent, KeyModifiers}, ExecutableCommand, }; -use flume::TryRecvError; +use kanal::AsyncReceiver; use hyper::http; use ratatui::{ backend::CrosstermBackend, @@ -55,7 +55,7 @@ pub struct Monitor { pub print_mode: PrintMode, pub end_line: EndLine, /// All workers sends each result to this channel - pub report_receiver: flume::Receiver>, + pub report_receiver: AsyncReceiver>, // When started pub start: std::time::Instant, // Frame per scond of TUI @@ -99,17 +99,17 @@ impl Monitor { let frame_start = std::time::Instant::now(); loop { match self.report_receiver.try_recv() { - Ok(report) => { + Ok(Some(report)) => { match report.as_ref() { Ok(report) => *status_dist.entry(report.status).or_default() += 1, Err(e) => *error_dist.entry(e.to_string()).or_default() += 1, } all.push(report); } - Err(TryRecvError::Empty) => { + Ok(None) => { break; } - Err(TryRecvError::Disconnected) => { + Err(_) => { // Application ends. break 'outer; }