diff --git a/Cargo.lock b/Cargo.lock index c0a279c..30f1de8 100755 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,6 +2,21 @@ # It is not intended for manual editing. version = 4 +[[package]] +name = "addr2line" +version = "0.24.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dfbe277e56a376000877090da837660b4427aad530e3028d44e0bffe4f89a1c1" +dependencies = [ + "gimli", +] + +[[package]] +name = "adler2" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627" + [[package]] name = "aho-corasick" version = "1.1.3" @@ -66,15 +81,6 @@ version = "1.0.88" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4e1496f8fb1fbf272686b8d37f523dab3e4a7443300055e74cdaa449f3114356" -[[package]] -name = "autocfg" -version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0dde43e75fd43e8a1bf86103336bc699aa8d17ad1be60c76c0bdfd4828e19b78" -dependencies = [ - "autocfg 1.4.0", -] - [[package]] name = "autocfg" version = "1.4.0" @@ -82,29 +88,65 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" [[package]] -name = "base64" -version = "0.9.3" +name = "aws-lc-rs" +version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "489d6c0ed21b11d038c31b6ceccca973e65d73ba3bd8ecb9a2babf5546164643" +checksum = "19b756939cb2f8dc900aa6dcd505e6e2428e9cae7ff7b028c49e3946efa70878" dependencies = [ - "byteorder", - "safemem", + "aws-lc-sys", + "zeroize", ] [[package]] -name = "base64" -version = "0.10.1" +name = "aws-lc-sys" +version = "0.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b25d992356d2eb0ed82172f5248873db5560c4721f564b13cb5193bda5e668e" +checksum = "b9f7720b74ed28ca77f90769a71fd8c637a0137f6fae4ae947e1050229cff57f" dependencies = [ - "byteorder", + "bindgen", + "cc", + "cmake", + "dunce", + "fs_extra", ] [[package]] -name = "bitflags" -version = "1.3.2" +name = "backtrace" +version = "0.3.74" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" +checksum = "8d82cb332cdfaed17ae235a638438ac4d4839913cc2af585c3c6746e8f8bee1a" +dependencies = [ + "addr2line", + "cfg-if", + "libc", + "miniz_oxide", + "object", + "rustc-demangle", + "windows-targets 0.52.6", +] + +[[package]] +name = "bindgen" +version = "0.69.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "271383c67ccabffb7381723dea0672a673f292304fcb45c01cc648c7a8d58088" +dependencies = [ + "bitflags", + "cexpr", + "clang-sys", + "itertools", + "lazy_static", + "lazycell", + "log", + "prettyplease", + "proc-macro2", + "quote", + "regex", + "rustc-hash", + "shlex", + "syn", + "which", +] [[package]] name = "bitflags" @@ -112,63 +154,31 @@ version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" -[[package]] -name = "block-buffer" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0940dc441f31689269e10ac70eb1002a3a1d3ad1390e030043662eb7fe4688b" -dependencies = [ - "block-padding", - "byte-tools", - "byteorder", - "generic-array", -] - -[[package]] -name = "block-padding" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa79dedbb091f449f1f39e53edf88d5dbe95f895dae6135a8d7b881fb5af73f5" -dependencies = [ - "byte-tools", -] - -[[package]] -name = "byte-tools" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3b5ca7a04898ad4bcd41c90c5285445ff5b791899bb1b0abdd2a2aa791211d7" - -[[package]] -name = "byteorder" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" - [[package]] name = "bytes" -version = "0.4.12" +version = "1.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "206fdffcfa2df7cbe15601ef46c813fce0965eb3286db6b56c583b814b51c81c" -dependencies = [ - "byteorder", - "iovec", -] +checksum = "d71b6127be86fdcfddb610f7182ac57211d4b18a3e9c82eb2d17662f2227ad6a" [[package]] name = "cc" -version = "1.1.18" +version = "1.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b62ac837cdb5cb22e10a256099b4fc502b1dfe560cb282963a974d7abd80e476" +checksum = "525046617d8376e3db1deffb079e91cef90a89fc3ca5c185bbf8c9ecdd15cd5c" dependencies = [ + "jobserver", + "libc", "shlex", ] [[package]] -name = "cfg-if" -version = "0.1.10" +name = "cexpr" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" +checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766" +dependencies = [ + "nom", +] [[package]] name = "cfg-if" @@ -177,12 +187,23 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] -name = "cloudabi" -version = "0.0.3" +name = "clang-sys" +version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" +checksum = "0b023947811758c97c59bf9d1c188fd619ad4718dcaa767947df1cadb14f39f4" dependencies = [ - "bitflags 1.3.2", + "glob", + "libc", + "libloading", +] + +[[package]] +name = "cmake" +version = "0.1.54" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7caa3f9de89ddbe2c607f4101924c5abec803763ae9534e4f4d7d8f84aa81f0" +dependencies = [ + "cc", ] [[package]] @@ -193,7 +214,7 @@ checksum = "2c426b7af8d5e0ad79de6713996632ce31f0d68ba84068fb0d654b396e519df0" dependencies = [ "colored", "env_logger", - "log 0.4.27", + "log", ] [[package]] @@ -213,40 +234,16 @@ dependencies = [ ] [[package]] -name = "core-foundation" -version = "0.9.4" +name = "dunce" +version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" -dependencies = [ - "core-foundation-sys", - "libc", -] +checksum = "92773504d58c093f6de2459af4af33faa518c13451eb8f2b5698ed3d36e7c813" [[package]] -name = "core-foundation-sys" -version = "0.8.7" +name = "either" +version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" - -[[package]] -name = "crossbeam-utils" -version = "0.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3c7c73a2d1e9fc0886a08b93e98eb643461230d5f1925e4036204d5f2e261a8" -dependencies = [ - "autocfg 1.4.0", - "cfg-if 0.1.10", - "lazy_static", -] - -[[package]] -name = "digest" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3d0c8c8752312f9713efd397ff63acb9f85585afbf179282e720e7704954dd5" -dependencies = [ - "generic-array", -] +checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719" [[package]] name = "env_filter" @@ -254,21 +251,21 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4f2c92ceda6ceec50f43169f9ee8424fe2db276791afde7b2cd8bc084cb376ab" dependencies = [ - "log 0.4.27", + "log", "regex", ] [[package]] name = "env_logger" -version = "0.11.5" +version = "0.11.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e13fa619b91fb2381732789fc5de83b45675e882f66623b7d8cb4f643017018d" +checksum = "13c863f0904021b108aa8b2f55046443e6b1ebde8fd4a15c399893aae4fa069f" dependencies = [ "anstream", "anstyle", "env_filter", - "humantime", - "log 0.4.27", + "jiff", + "log", ] [[package]] @@ -279,97 +276,70 @@ checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" [[package]] name = "errno" -version = "0.3.9" +version = "0.3.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "534c5cf6194dfab3db3242765c03bbe257cf92f22b38f6bc0c58d59108a820ba" +checksum = "976dd42dc7e85965fe702eb8164f21f450704bdde31faefd6471dba214cb594e" dependencies = [ "libc", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] -[[package]] -name = "fake-simd" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" - -[[package]] -name = "fastrand" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "486f806e73c5707928240ddc295403b1b93c96a02038563881c4a2fd84b81ac4" - [[package]] name = "flowgate" version = "0.1.2" dependencies = [ "colog", - "log 0.4.27", - "openssl", + "ignore-result", + "log", + "rustls", "serde_json", "serde_yml", - "threadpool", - "websocket", - "wildcard_ex", + "tokio", + "tokio-io-timeout", + "tokio-rustls", + "wildmatch", ] [[package]] -name = "fnv" -version = "1.0.7" +name = "fs_extra" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" +checksum = "42703706b716c37f96a77aea830392ad231f44c9e9a67872fa5548707e11b11c" [[package]] -name = "foreign-types" +name = "getrandom" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" +dependencies = [ + "cfg-if", + "libc", + "wasi 0.11.0+wasi-snapshot-preview1", +] + +[[package]] +name = "getrandom" version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" +checksum = "73fea8450eea4bac3940448fb7ae50d91f034f941199fcd9d909a5a07aa455f0" dependencies = [ - "foreign-types-shared", + "cfg-if", + "libc", + "r-efi", + "wasi 0.14.2+wasi-0.2.4", ] [[package]] -name = "foreign-types-shared" -version = "0.1.1" +name = "gimli" +version = "0.31.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" +checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f" [[package]] -name = "fuchsia-cprng" -version = "0.1.1" +name = "glob" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba" - -[[package]] -name = "fuchsia-zircon" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82" -dependencies = [ - "bitflags 1.3.2", - "fuchsia-zircon-sys", -] - -[[package]] -name = "fuchsia-zircon-sys" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" - -[[package]] -name = "futures" -version = "0.1.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a471a38ef8ed83cd6e40aa59c1ffe17db6855c18e3604d9c4ed8c08ebc28678" - -[[package]] -name = "generic-array" -version = "0.12.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffdf9f34f1447443d37393cc6c2b8313aebddcd96906caf34e54c68d8e57d7bd" -dependencies = [ - "typenum", -] +checksum = "a8d1add55171497b4705a648c6b583acafb01d58050a51727785f0b2c8e0a2b2" [[package]] name = "hashbrown" @@ -378,52 +348,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" [[package]] -name = "hermit-abi" -version = "0.3.9" +name = "home" +version = "0.5.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" - -[[package]] -name = "httparse" -version = "1.9.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d71d3574edd2771538b901e6549113b4006ece66150fb69c0fb6d9a2adae946" - -[[package]] -name = "humantime" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" - -[[package]] -name = "hyper" -version = "0.10.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a0652d9a2609a968c14be1a9ea00bf4b1d64e2e1f53a1b51b6fff3a6e829273" +checksum = "589533453244b0995c858700322199b2becb13b627df2851f64a2775d024abcf" dependencies = [ - "base64 0.9.3", - "httparse", - "language-tags", - "log 0.3.9", - "mime", - "num_cpus", - "time", - "traitobject", - "typeable", - "unicase", - "url", + "windows-sys 0.59.0", ] [[package]] -name = "idna" -version = "0.1.5" +name = "ignore-result" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38f09e0f0b1fb55fdee1f17470ad800da77af5186a1a76c026b679358b7e844e" -dependencies = [ - "matches", - "unicode-bidi", - "unicode-normalization", -] +checksum = "665ff4dce8edd10d490641ccb78949832f1ddbff02c584fb1f85ab888fe0e50c" [[package]] name = "indexmap" @@ -435,21 +372,21 @@ dependencies = [ "hashbrown", ] -[[package]] -name = "iovec" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2b3ea6ff95e175473f8ffe6a7eb7c00d054240321b84c57051175fe3c1e075e" -dependencies = [ - "libc", -] - [[package]] name = "is_terminal_polyfill" version = "1.70.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf" +[[package]] +name = "itertools" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569" +dependencies = [ + "either", +] + [[package]] name = "itoa" version = "1.0.11" @@ -457,20 +394,38 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" [[package]] -name = "kernel32-sys" -version = "0.2.2" +name = "jiff" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" +checksum = "c102670231191d07d37a35af3eb77f1f0dbf7a71be51a962dcd57ea607be7260" dependencies = [ - "winapi 0.2.8", - "winapi-build", + "jiff-static", + "log", + "portable-atomic", + "portable-atomic-util", + "serde", ] [[package]] -name = "language-tags" -version = "0.2.2" +name = "jiff-static" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a91d884b6667cd606bb5a69aa0c99ba811a115fc68915e7056ec08a46e93199a" +checksum = "4cdde31a9d349f1b1f51a0b3714a5940ac022976f4b49485fc04be052b183b4c" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "jobserver" +version = "0.1.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38f262f097c174adebe41eb73d66ae9c06b2844fb0da69969647bbddd9b0538a" +dependencies = [ + "getrandom 0.3.2", + "libc", +] [[package]] name = "lazy_static" @@ -479,10 +434,26 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" [[package]] -name = "libc" -version = "0.2.158" +name = "lazycell" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8adc4bb1803a324070e64a98ae98f38934d91957a99cfb3a43dcbc01bc56439" +checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" + +[[package]] +name = "libc" +version = "0.2.171" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c19937216e9d3aa9956d9bb8dfc0b0c8beb6058fc4f7a4dc4d850edf86a237d6" + +[[package]] +name = "libloading" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc2f4eb4bc735547cfed7c0a4922cbd04a4655978c09b54f1f7b228750664c34" +dependencies = [ + "cfg-if", + "windows-targets 0.52.6", +] [[package]] name = "libyml" @@ -491,51 +462,31 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3302702afa434ffa30847a83305f0a69d6abd74293b6554c18ec85c7ef30c980" dependencies = [ "anyhow", - "version_check 0.9.5", + "version_check", ] [[package]] name = "linux-raw-sys" -version = "0.4.14" +version = "0.4.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" +checksum = "d26c52dbd32dccf2d10cac7725f8eae5296885fb5703b261f7d0a0739ec807ab" [[package]] name = "lock_api" -version = "0.3.4" +version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4da24a77a3d8a6d4862d95f72e6fdb9c09a643ecdb402d754004a557f2bec75" +checksum = "07af8b9cdd281b7915f413fa73f29ebd5d55d0d3f0155584dade1ff18cea1b17" dependencies = [ + "autocfg", "scopeguard", ] -[[package]] -name = "log" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e19e8d5c34a3e0e2223db8e060f9e8264aeeb5c5fc64a4ee9965c062211c024b" -dependencies = [ - "log 0.4.27", -] - [[package]] name = "log" version = "0.4.27" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94" -[[package]] -name = "matches" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2532096657941c2fea9c289d370a250971c689d4f143798ff67113ec042024a5" - -[[package]] -name = "maybe-uninit" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60302e4db3a61da70c0cb7991976248362f30319e88850c487b9b95bbf059e00" - [[package]] name = "memchr" version = "2.7.4" @@ -543,315 +494,142 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" [[package]] -name = "mime" -version = "0.2.6" +name = "minimal-lexical" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba626b8a6de5da682e1caa06bdb42a335aee5a84db8e5046a3e8ab17ba0a3ae0" +checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" + +[[package]] +name = "miniz_oxide" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff70ce3e48ae43fa075863cef62e8b43b71a4f2382229920e0df362592919430" dependencies = [ - "log 0.3.9", + "adler2", ] [[package]] name = "mio" -version = "0.6.23" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4afd66f5b91bf2a3bc13fad0e21caedac168ca4c707504e75585648ae80e4cc4" +checksum = "2886843bf800fba2e3377cff24abf6379b4c4d5c6681eaf9ea5b0d15090450bd" dependencies = [ - "cfg-if 0.1.10", - "fuchsia-zircon", - "fuchsia-zircon-sys", - "iovec", - "kernel32-sys", "libc", - "log 0.4.27", - "miow", - "net2", - "slab", - "winapi 0.2.8", + "wasi 0.11.0+wasi-snapshot-preview1", + "windows-sys 0.52.0", ] [[package]] -name = "miow" -version = "0.2.2" +name = "nom" +version = "7.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ebd808424166322d4a38da87083bfddd3ac4c131334ed55856112eb06d46944d" +checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" dependencies = [ - "kernel32-sys", - "net2", - "winapi 0.2.8", - "ws2_32-sys", + "memchr", + "minimal-lexical", ] [[package]] -name = "native-tls" -version = "0.2.12" +name = "object" +version = "0.36.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8614eb2c83d59d1c8cc974dd3f920198647674a0a035e1af1fa58707e317466" +checksum = "62948e14d923ea95ea2c7c86c71013138b66525b86bdc08d2dcc262bdb497b87" dependencies = [ - "libc", - "log 0.4.27", - "openssl", - "openssl-probe", - "openssl-sys", - "schannel", - "security-framework", - "security-framework-sys", - "tempfile", -] - -[[package]] -name = "net2" -version = "0.2.39" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b13b648036a2339d06de780866fbdfda0dde886de7b3af2ddeba8b14f4ee34ac" -dependencies = [ - "cfg-if 0.1.10", - "libc", - "winapi 0.3.9", -] - -[[package]] -name = "num_cpus" -version = "1.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" -dependencies = [ - "hermit-abi", - "libc", + "memchr", ] [[package]] name = "once_cell" -version = "1.20.0" +version = "1.21.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33ea5043e58958ee56f3e15a90aee535795cd7dfd319846288d93c5b57d85cbe" - -[[package]] -name = "opaque-debug" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2839e79665f131bdb5782e51f2c6c9599c133c6098982a54c794358bf432529c" - -[[package]] -name = "openssl" -version = "0.10.72" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fedfea7d58a1f73118430a55da6a286e7b044961736ce96a16a17068ea25e5da" -dependencies = [ - "bitflags 2.6.0", - "cfg-if 1.0.0", - "foreign-types", - "libc", - "once_cell", - "openssl-macros", - "openssl-sys", -] - -[[package]] -name = "openssl-macros" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "openssl-probe" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" - -[[package]] -name = "openssl-sys" -version = "0.9.107" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8288979acd84749c744a9014b4382d42b8f7b2592847b5afb2ed29e5d16ede07" -dependencies = [ - "cc", - "libc", - "pkg-config", - "vcpkg", -] +checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" [[package]] name = "parking_lot" -version = "0.9.0" +version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f842b1982eb6c2fe34036a4fbfb06dd185a3f5c8edfaacdf7d1ea10b07de6252" +checksum = "f1bf18183cf54e8d6059647fc3063646a1801cf30896933ec2311622cc4b9a27" dependencies = [ "lock_api", "parking_lot_core", - "rustc_version", ] [[package]] name = "parking_lot_core" -version = "0.6.3" +version = "0.9.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bda66b810a62be75176a80873726630147a5ca780cd33921e0b5709033e66b0a" +checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8" dependencies = [ - "cfg-if 0.1.10", - "cloudabi", + "cfg-if", "libc", "redox_syscall", - "rustc_version", "smallvec", - "winapi 0.3.9", + "windows-targets 0.52.6", ] [[package]] -name = "percent-encoding" -version = "1.0.1" +name = "pin-project-lite" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31010dd2e1ac33d5b46a5b413495239882813e0369f8ed8a5e266f173602f831" +checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b" [[package]] -name = "pkg-config" -version = "0.3.30" +name = "portable-atomic" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec" +checksum = "350e9b48cbc6b0e028b0473b114454c6316e57336ee184ceab6e53f72c178b3e" + +[[package]] +name = "portable-atomic-util" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8a2f0d8d040d7848a709caf78912debcc3f33ee4b3cac47d73d1e1069e83507" +dependencies = [ + "portable-atomic", +] + +[[package]] +name = "prettyplease" +version = "0.2.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64d1ec885c64d0457d564db4ec299b2dae3f9c02808b8ad9c3a089c591b18033" +dependencies = [ + "proc-macro2", + "syn", +] [[package]] name = "proc-macro2" -version = "1.0.86" +version = "1.0.94" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" +checksum = "a31971752e70b8b2686d7e46ec17fb38dad4051d94024c88df49b667caea9c84" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.37" +version = "1.0.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" +checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d" dependencies = [ "proc-macro2", ] [[package]] -name = "rand" -version = "0.6.5" +name = "r-efi" +version = "5.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d71dacdc3c88c1fde3885a3be3fbab9f35724e6ce99467f7d9c5026132184ca" -dependencies = [ - "autocfg 0.1.8", - "libc", - "rand_chacha", - "rand_core 0.4.2", - "rand_hc", - "rand_isaac", - "rand_jitter", - "rand_os", - "rand_pcg", - "rand_xorshift", - "winapi 0.3.9", -] - -[[package]] -name = "rand_chacha" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "556d3a1ca6600bfcbab7c7c91ccb085ac7fbbcd70e008a98742e7847f4f7bcef" -dependencies = [ - "autocfg 0.1.8", - "rand_core 0.3.1", -] - -[[package]] -name = "rand_core" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b" -dependencies = [ - "rand_core 0.4.2", -] - -[[package]] -name = "rand_core" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c33a3c44ca05fa6f1807d8e6743f3824e8509beca625669633be0acbdf509dc" - -[[package]] -name = "rand_hc" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b40677c7be09ae76218dc623efbf7b18e34bced3f38883af07bb75630a21bc4" -dependencies = [ - "rand_core 0.3.1", -] - -[[package]] -name = "rand_isaac" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ded997c9d5f13925be2a6fd7e66bf1872597f759fd9dd93513dd7e92e5a5ee08" -dependencies = [ - "rand_core 0.3.1", -] - -[[package]] -name = "rand_jitter" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1166d5c91dc97b88d1decc3285bb0a99ed84b05cfd0bc2341bdf2d43fc41e39b" -dependencies = [ - "libc", - "rand_core 0.4.2", - "winapi 0.3.9", -] - -[[package]] -name = "rand_os" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b75f676a1e053fc562eafbb47838d67c84801e38fc1ba459e8f180deabd5071" -dependencies = [ - "cloudabi", - "fuchsia-cprng", - "libc", - "rand_core 0.4.2", - "rdrand", - "winapi 0.3.9", -] - -[[package]] -name = "rand_pcg" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "abf9b09b01790cfe0364f52bf32995ea3c39f4d2dd011eac241d2914146d0b44" -dependencies = [ - "autocfg 0.1.8", - "rand_core 0.4.2", -] - -[[package]] -name = "rand_xorshift" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cbf7e9e623549b0e21f6e97cf8ecf247c1a8fd2e8a992ae265314300b2455d5c" -dependencies = [ - "rand_core 0.3.1", -] - -[[package]] -name = "rdrand" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2" -dependencies = [ - "rand_core 0.3.1", -] +checksum = "74765f6d916ee2faa39bc8e68e4f3ed8949b48cccdac59983d287a7cb71ce9c5" [[package]] name = "redox_syscall" -version = "0.1.57" +version = "0.5.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce" +checksum = "d2f103c6d277498fbceb16e84d317e2a400f160f46904d5f5410848c829511a3" +dependencies = [ + "bitflags", +] [[package]] name = "regex" @@ -883,25 +661,75 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b" [[package]] -name = "rustc_version" -version = "0.2.3" +name = "ring" +version = "0.17.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" +checksum = "a4689e6c2294d81e88dc6261c768b63bc4fcdb852be6d1352498b114f61383b7" dependencies = [ - "semver", + "cc", + "cfg-if", + "getrandom 0.2.15", + "libc", + "untrusted", + "windows-sys 0.52.0", ] [[package]] -name = "rustix" -version = "0.38.37" +name = "rustc-demangle" +version = "0.1.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8acb788b847c24f28525660c4d7758620a7210875711f79e7f663cc152726811" +checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" + +[[package]] +name = "rustc-hash" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" + +[[package]] +name = "rustix" +version = "0.38.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fdb5bc1ae2baa591800df16c9ca78619bf65c0488b41b96ccec5d11220d8c154" dependencies = [ - "bitflags 2.6.0", + "bitflags", "errno", "libc", "linux-raw-sys", - "windows-sys 0.52.0", + "windows-sys 0.59.0", +] + +[[package]] +name = "rustls" +version = "0.23.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "822ee9188ac4ec04a2f0531e55d035fb2de73f18b41a63c70c2712503b6fb13c" +dependencies = [ + "aws-lc-rs", + "log", + "once_cell", + "rustls-pki-types", + "rustls-webpki", + "subtle", + "zeroize", +] + +[[package]] +name = "rustls-pki-types" +version = "1.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "917ce264624a4b4db1c364dcc35bfca9ded014d0a958cd47ad3e960e988ea51c" + +[[package]] +name = "rustls-webpki" +version = "0.103.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fef8b8769aaccf73098557a87cd1816b4f9c7c16811c9c77142aa695c16f2c03" +dependencies = [ + "aws-lc-rs", + "ring", + "rustls-pki-types", + "untrusted", ] [[package]] @@ -910,79 +738,26 @@ version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" -[[package]] -name = "safemem" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef703b7cb59335eae2eb93ceb664c0eb7ea6bf567079d843e09420219668e072" - -[[package]] -name = "schannel" -version = "0.1.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f29ebaa345f945cec9fbbc532eb307f0fdad8161f281b6369539c8d84876b3d" -dependencies = [ - "windows-sys 0.59.0", -] - [[package]] name = "scopeguard" version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" -[[package]] -name = "security-framework" -version = "2.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "897b2245f0b511c87893af39b033e5ca9cce68824c4d7e7630b5a1d339658d02" -dependencies = [ - "bitflags 2.6.0", - "core-foundation", - "core-foundation-sys", - "libc", - "security-framework-sys", -] - -[[package]] -name = "security-framework-sys" -version = "2.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa39c7303dc58b5543c94d22c1766b0d31f2ee58306363ea622b10bbc075eaa2" -dependencies = [ - "core-foundation-sys", - "libc", -] - -[[package]] -name = "semver" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" -dependencies = [ - "semver-parser", -] - -[[package]] -name = "semver-parser" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" - [[package]] name = "serde" -version = "1.0.210" +version = "1.0.219" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8e3592472072e6e22e0a54d5904d9febf8508f65fb8552499a1abc7d1078c3a" +checksum = "5f0e2c6ed6606019b4e29e69dbaba95b11854410e5347d525002456dbbb786b6" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.210" +version = "1.0.219" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "243902eda00fad750862fc144cea25caca5e20d615af0a81bee94ca738f1df1f" +checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00" dependencies = [ "proc-macro2", "quote", @@ -1013,19 +788,7 @@ dependencies = [ "memchr", "ryu", "serde", - "version_check 0.9.5", -] - -[[package]] -name = "sha-1" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7d94d0bede923b3cea61f3f1ff57ff8cdfd77b400fb8f9998949e0cf04163df" -dependencies = [ - "block-buffer", - "digest", - "fake-simd", - "opaque-debug", + "version_check", ] [[package]] @@ -1035,28 +798,41 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" [[package]] -name = "slab" -version = "0.4.9" +name = "signal-hook-registry" +version = "1.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" +checksum = "a9e9e0b4211b72e7b8b6e85c807d36c212bdb33ea8587f7569562a84df5465b1" dependencies = [ - "autocfg 1.4.0", + "libc", ] [[package]] name = "smallvec" -version = "0.6.14" +version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b97fcaeba89edba30f044a10c6a3cc39df9c3f17d7cd829dd1446cab35f890e0" +checksum = "8917285742e9f3e1683f0a9c4e6b57960b7314d0b08d30d1ecd426713ee2eee9" + +[[package]] +name = "socket2" +version = "0.5.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4f5fd57c80058a56cf5c777ab8a126398ece8e442983605d280a44ce79d0edef" dependencies = [ - "maybe-uninit", + "libc", + "windows-sys 0.52.0", ] [[package]] -name = "syn" -version = "2.0.87" +name = "subtle" +version = "2.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25aa4ce346d03a6dcd68dd8b4010bcb74e54e62c90c573f394c46eae99aba32d" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" + +[[package]] +name = "syn" +version = "2.0.100" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b09a44accad81e1ba1cd74a32461ba89dee89095ba17b32f5d03683b1b1fc2a0" dependencies = [ "proc-macro2", "quote", @@ -1064,172 +840,54 @@ dependencies = [ ] [[package]] -name = "tempfile" -version = "3.13.0" +name = "tokio" +version = "1.44.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0f2c9fc62d0beef6951ccffd757e241266a2c833136efbe35af6cd2567dca5b" -dependencies = [ - "cfg-if 1.0.0", - "fastrand", - "once_cell", - "rustix", - "windows-sys 0.59.0", -] - -[[package]] -name = "threadpool" -version = "1.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d050e60b33d41c19108b32cea32164033a9013fe3b46cbd4457559bfbf77afaa" -dependencies = [ - "num_cpus", -] - -[[package]] -name = "time" -version = "0.1.45" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b797afad3f312d1c66a56d11d0316f916356d11bd158fbc6ca6389ff6bf805a" +checksum = "e6b88822cbe49de4185e3a4cbf8321dd487cf5fe0c5c65695fef6346371e9c48" dependencies = [ + "backtrace", + "bytes", "libc", - "wasi", - "winapi 0.3.9", -] - -[[package]] -name = "tinyvec" -version = "1.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "445e881f4f6d382d5f27c034e25eb92edd7c784ceab92a0937db7f2e9471b938" -dependencies = [ - "tinyvec_macros", -] - -[[package]] -name = "tinyvec_macros" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" - -[[package]] -name = "tokio-codec" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25b2998660ba0e70d18684de5d06b70b70a3a747469af9dea7618cc59e75976b" -dependencies = [ - "bytes", - "futures", - "tokio-io", -] - -[[package]] -name = "tokio-executor" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb2d1b8f4548dbf5e1f7818512e9c406860678f29c300cdf0ebac72d1a3a1671" -dependencies = [ - "crossbeam-utils", - "futures", -] - -[[package]] -name = "tokio-io" -version = "0.1.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57fc868aae093479e3131e3d165c93b1c7474109d13c90ec0dda2a1bbfff0674" -dependencies = [ - "bytes", - "futures", - "log 0.4.27", -] - -[[package]] -name = "tokio-reactor" -version = "0.1.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09bc590ec4ba8ba87652da2068d150dcada2cfa2e07faae270a5e0409aa51351" -dependencies = [ - "crossbeam-utils", - "futures", - "lazy_static", - "log 0.4.27", "mio", - "num_cpus", "parking_lot", - "slab", - "tokio-executor", - "tokio-io", - "tokio-sync", + "pin-project-lite", + "signal-hook-registry", + "socket2", + "tokio-macros", + "windows-sys 0.52.0", ] [[package]] -name = "tokio-sync" -version = "0.1.8" +name = "tokio-io-timeout" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "edfe50152bc8164fcc456dab7891fa9bf8beaf01c5ee7e1dd43a397c3cf87dee" +checksum = "30b74022ada614a1b4834de765f9bb43877f910cc8ce4be40e89042c9223a8bf" dependencies = [ - "fnv", - "futures", + "pin-project-lite", + "tokio", ] [[package]] -name = "tokio-tcp" -version = "0.1.4" +name = "tokio-macros" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "98df18ed66e3b72e742f185882a9e201892407957e45fbff8da17ae7a7c51f72" +checksum = "6e06d43f1345a3bcd39f6a56dbb7dcab2ba47e68e8ac134855e7e2bdbaf8cab8" dependencies = [ - "bytes", - "futures", - "iovec", - "mio", - "tokio-io", - "tokio-reactor", + "proc-macro2", + "quote", + "syn", ] [[package]] -name = "tokio-tls" -version = "0.2.1" +name = "tokio-rustls" +version = "0.26.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "354b8cd83825b3c20217a9dc174d6a0c67441a2fae5c41bcb1ea6679f6ae0f7c" +checksum = "8e727b36a1a0e8b74c376ac2211e40c2c8af09fb4013c60d910495810f008e9b" dependencies = [ - "futures", - "native-tls", - "tokio-io", + "rustls", + "tokio", ] -[[package]] -name = "traitobject" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "efd1f82c56340fdf16f2a953d7bda4f8fdffba13d93b00844c25572110b26079" - -[[package]] -name = "typeable" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1410f6f91f21d1612654e7cc69193b0334f909dcf2c790c4826254fbb86f8887" - -[[package]] -name = "typenum" -version = "1.17.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" - -[[package]] -name = "unicase" -version = "1.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f4765f83163b74f957c797ad9253caf97f103fb064d3999aea9568d09fc8a33" -dependencies = [ - "version_check 0.1.5", -] - -[[package]] -name = "unicode-bidi" -version = "0.3.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ab17db44d7388991a428b2ee655ce0c212e862eff1768a455c58f9aad6e7893" - [[package]] name = "unicode-ident" version = "1.0.13" @@ -1237,24 +895,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" [[package]] -name = "unicode-normalization" -version = "0.1.24" +name = "untrusted" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5033c97c4262335cded6d6fc3e5c18ab755e1a3dc96376350f3d8e9f009ad956" -dependencies = [ - "tinyvec", -] - -[[package]] -name = "url" -version = "1.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd4e7c0d531266369519a4aa4f399d748bd37043b00bde1e4ff1f60a120b355a" -dependencies = [ - "idna", - "matches", - "percent-encoding", -] +checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" [[package]] name = "utf8parse" @@ -1262,18 +906,6 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" -[[package]] -name = "vcpkg" -version = "0.2.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" - -[[package]] -name = "version_check" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "914b1a6776c4c929a602fafd8bc742e06365d4bcbe48c30f9cca5824f70dc9dd" - [[package]] name = "version_check" version = "0.9.5" @@ -1282,90 +914,36 @@ checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" [[package]] name = "wasi" -version = "0.10.0+wasi-snapshot-preview1" +version = "0.11.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f" +checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] -name = "websocket" -version = "0.27.1" +name = "wasi" +version = "0.14.2+wasi-0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "319bacd7682c7dfe1444e7cb1aed23bf5b1d837d722925f531e1665bd21a4603" +checksum = "9683f9a5a998d873c0d21fcbe3c083009670149a8fab228644b8bd36b2c48cb3" dependencies = [ - "bytes", - "futures", - "hyper", - "native-tls", - "rand", - "tokio-codec", - "tokio-io", - "tokio-reactor", - "tokio-tcp", - "tokio-tls", - "unicase", - "url", - "websocket-base", + "wit-bindgen-rt", ] [[package]] -name = "websocket-base" -version = "0.26.5" +name = "which" +version = "4.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49aec794b07318993d1db16156d5a9c750120597a5ee40c6b928d416186cb138" +checksum = "87ba24419a2078cd2b0f2ede2691b6c66d8e47836da3b6db8265ebad47afbfc7" dependencies = [ - "base64 0.10.1", - "bitflags 1.3.2", - "byteorder", - "bytes", - "futures", - "native-tls", - "rand", - "sha-1", - "tokio-codec", - "tokio-io", - "tokio-tcp", - "tokio-tls", + "either", + "home", + "once_cell", + "rustix", ] [[package]] -name = "wildcard_ex" -version = "0.1.2" +name = "wildmatch" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1151cb658d7ce4148afb8eb0376af7c91baef7f60810e257e8fc76742a03f147" - -[[package]] -name = "winapi" -version = "0.2.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" - -[[package]] -name = "winapi" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" -dependencies = [ - "winapi-i686-pc-windows-gnu", - "winapi-x86_64-pc-windows-gnu", -] - -[[package]] -name = "winapi-build" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" - -[[package]] -name = "winapi-i686-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" - -[[package]] -name = "winapi-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +checksum = "68ce1ab1f8c62655ebe1350f589c61e505cf94d385bc6a12899442d9081e71fd" [[package]] name = "windows-sys" @@ -1516,11 +1094,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" [[package]] -name = "ws2_32-sys" -version = "0.2.1" +name = "wit-bindgen-rt" +version = "0.39.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e" +checksum = "6f42320e61fe2cfd34354ecb597f86f413484a798ba44a8ca1165c58d42da6c1" dependencies = [ - "winapi 0.2.8", - "winapi-build", + "bitflags", ] + +[[package]] +name = "zeroize" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" diff --git a/Cargo.toml b/Cargo.toml index 070bae4..cde7246 100755 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,11 +4,13 @@ version = "0.1.2" edition = "2021" [dependencies] -openssl = "0.10.72" +tokio = { version = "1.44.2", features = ["full"] } +tokio-io-timeout = "1.2.0" +tokio-rustls = "0.26.2" +rustls = "0.23.25" +wildmatch = "2.4.0" serde_yml = "0.0.12" +serde_json = "1.0.140" log = "0.4.27" colog = "1.3.0" -threadpool = "1.8.1" -wildcard_ex = "0.1.2" -websocket = "0.27.1" -serde_json = "1.0.140" +ignore-result = "0.2.0" \ No newline at end of file diff --git a/shell.nix b/shell.nix new file mode 100755 index 0000000..cefd016 --- /dev/null +++ b/shell.nix @@ -0,0 +1,8 @@ +with import { }; + +mkShell { + nativeBuildInputs = [ + openssl + pkg-config + ]; +} \ No newline at end of file diff --git a/src/flowgate.rs b/src/flowgate.rs index 8d563bd..0f679f4 100755 --- a/src/flowgate.rs +++ b/src/flowgate.rs @@ -1,3 +1,3 @@ pub mod config; pub mod server; -pub mod ssl_cert; \ No newline at end of file +pub mod tls; \ No newline at end of file diff --git a/src/flowgate/config.rs b/src/flowgate/config.rs index c32385f..a22cce4 100755 --- a/src/flowgate/config.rs +++ b/src/flowgate/config.rs @@ -1,15 +1,17 @@ -use std::{fs, net::TcpStream, time::Duration}; +use std::{fs, time::Duration}; + +use tokio::net::TcpStream; use serde_yml::{Number, Value}; -use wildcard_ex::is_match_simple; +use wildmatch::WildMatch; -use super::ssl_cert::SslCert; +use super::tls::TlsCertificate; -#[derive(Clone)] +#[derive(Clone, Debug)] pub struct SiteConfig { - pub domain: String, + pub domain: WildMatch, pub host: String, - pub ssl: Option, + pub ssl: Option, pub enable_keep_alive: bool, pub support_keep_alive: bool, pub ip_forwarding: IpForwarding, @@ -17,12 +19,12 @@ pub struct SiteConfig { } impl SiteConfig { - pub fn connect(&self) -> Option { - TcpStream::connect(self.host.clone()).ok() + pub async fn connect(&self) -> Option { + TcpStream::connect(self.host.clone()).await.ok() } } -#[derive(Clone)] +#[derive(Clone, Debug)] pub enum IpForwarding { Simple, Header(String), @@ -46,7 +48,7 @@ impl IpForwarding { } } -#[derive(Clone)] +#[derive(Clone, Debug)] pub struct Config { pub sites: Vec, pub http_host: String, @@ -80,12 +82,12 @@ impl Config { let sites_yaml = doc["sites"].as_sequence()?; for s in sites_yaml { - let mut cert: Option = None; + let mut cert: Option = None; let s = s.as_mapping()?; if s.contains_key("ssl_cert") { cert = Some( - SslCert::new( + TlsCertificate::new( s.get("ssl_cert")?.as_str()?, s.get("ssl_key")?.as_str()?, )?, @@ -93,7 +95,7 @@ impl Config { } let site = SiteConfig { - domain: s.get("domain")?.as_str()?.to_string(), + domain: WildMatch::new(&s.get("domain")?.as_str()?.to_string()), host: s.get("host")?.as_str()?.to_string(), ssl: cert, enable_keep_alive: s.get("enable_keep_alive") @@ -126,7 +128,7 @@ impl Config { pub fn get_site(&self, domain: &str) -> Option<&SiteConfig> { for i in &self.sites { - if is_match_simple(&i.domain, domain) { + if i.domain.matches(domain) { return Some(i); } } diff --git a/src/flowgate/server.rs b/src/flowgate/server.rs index 05ff6d9..68b01da 100755 --- a/src/flowgate/server.rs +++ b/src/flowgate/server.rs @@ -1,30 +1,23 @@ use std::{ - io::{ - Read, - Write - }, - net::{ - IpAddr, - Ipv4Addr, - Ipv6Addr, - SocketAddr, - SocketAddrV4, - SocketAddrV6, - TcpListener, - TcpStream - }, + error::Error, + net::{IpAddr, Ipv4Addr, Ipv6Addr, SocketAddr, SocketAddrV4, SocketAddrV6}, str::FromStr, - sync::{ - Arc, - RwLock - }, - thread, - time::Duration + sync::Arc +}; + +use tokio::sync::RwLock; + +use ignore_result::Ignore; +use tokio::{ + io::{AsyncReadExt, AsyncWriteExt}, + net::{TcpListener, TcpStream} }; use log::info; -use openssl::ssl::SslStream; -use threadpool::ThreadPool; +use tokio_io_timeout::TimeoutStream; +use tokio_rustls::TlsAcceptor; + +use crate::tls::create_server_config; use super::config::{ Config, @@ -40,15 +33,9 @@ pub trait Closeable { fn close(&mut self); } -impl Closeable for SslStream { - fn close(&mut self) { - let _ = self.shutdown(); - } -} - impl Closeable for TcpStream { fn close(&mut self) { - let _ = self.shutdown(std::net::Shutdown::Both); + let _ = self.shutdown(); } } @@ -64,199 +51,374 @@ impl FlowgateServer { FlowgateServer { config } } - pub fn start(&self) { - let pool = ThreadPool::new(self.config.read().unwrap().threadpool_size); - let pool = Arc::new(pool); + pub async fn start(&self) { + tokio::spawn({ + let config = self.config.clone(); - thread::spawn({ - let config = Arc::clone(&self.config); - let pool = Arc::clone(&pool); - - move || { - Self::run_http(config, pool) - } + async move { + Self::run_http(config).await.ignore(); + } }); - thread::spawn({ - let config = Arc::clone(&self.config); - let pool = Arc::clone(&pool); - - move || { - Self::run_https(config, pool) - } + tokio::spawn({ + let config = self.config.clone(); + + async move { + Self::run_https(config).await.ignore(); + } }); } - pub fn run_http( - config: Arc>, - pool: Arc - ) -> Option<()> { - let listener = TcpListener::bind(&config.read().ok()?.http_host).ok()?; + pub async fn run_http( + config: Arc> + ) -> Result<(), Box> { + let listener = TcpListener::bind(&config.read().await.http_host).await?; - info!("HTTP server runned on {}", &config.read().ok()?.http_host); + info!("HTTP server runned on {}", &config.read().await.http_host); - for stream in listener.incoming() { - pool.execute({ - let config = config.clone(); + loop { + let Ok((stream, addr)) = listener.accept().await else { break }; - move || { - let Ok(mut stream) = stream else { return }; + let config = config.clone(); - let Ok(_) = stream.set_write_timeout(Some(Duration::from_secs(10))) else { return }; - let Ok(_) = stream.set_read_timeout(Some(Duration::from_secs(10))) else { return }; + tokio::spawn(async move { + let mut stream = TimeoutStream::new(stream); - let Ok(addr) = stream.peer_addr() else { return }; + stream.set_write_timeout(Some(config.read().await.connection_timeout)); + stream.set_read_timeout(Some(config.read().await.connection_timeout)); - Self::accept_stream( - config, - &mut stream, - addr, - false - ); - } + let mut stream = Box::pin(stream); + + Self::accept_stream( + config, + &mut stream, + addr, + false + ).await; }); } - Some(()) + Ok(()) } - pub fn run_https( - config: Arc>, - pool: Arc - ) -> Option<()> { - use openssl::ssl::{NameType, SniError, SslAcceptor, SslAlert, SslMethod, SslRef}; + pub async fn run_https( + config: Arc> + ) -> Result<(), Box> { + let listener = TcpListener::bind(&config.read().await.https_host).await?; + let acceptor = TlsAcceptor::from(Arc::new(create_server_config(config.clone()).await)); - let listener = TcpListener::bind(&config.read().ok()?.https_host).ok()?; + info!("HTTPS server runned on {}", &config.read().await.http_host); - let mut cert = SslAcceptor::mozilla_intermediate(SslMethod::tls()).ok()?; + loop { + let Ok((stream, addr)) = listener.accept().await else { break }; - cert.set_servername_callback(Box::new({ - let config = config.clone(); + let config = config.clone(); + let acceptor = acceptor.clone(); - move |ssl: &mut SslRef, _: &mut SslAlert| -> Result<(), SniError> { - let servname = ssl.servername(NameType::HOST_NAME).ok_or(SniError::NOACK)?; - let c = config.read().unwrap(); - let cert = c.get_site(servname).ok_or(SniError::NOACK)?; - ssl.set_ssl_context(&cert.ssl.as_ref().ok_or(SniError::NOACK)?.get_context()).ok().ok_or(SniError::NOACK) - } - } - )); + tokio::spawn(async move { + let mut stream = TimeoutStream::new(stream); - let cert = cert.build(); + stream.set_write_timeout(Some(config.read().await.connection_timeout)); + stream.set_read_timeout(Some(config.read().await.connection_timeout)); - info!("HTTPS server runned on {}", &config.read().ok()?.https_host); + let Ok(mut stream) = acceptor.accept(Box::pin(stream)).await else { return }; - for stream in listener.incoming() { - pool.execute({ - let config = config.clone(); - let cert = cert.clone(); - - move || { - let Ok(stream) = stream else { return }; - - let Ok(_) = stream.set_write_timeout(Some(config.read().unwrap().connection_timeout)) else { return }; - let Ok(_) = stream.set_read_timeout(Some(config.read().unwrap().connection_timeout)) else { return }; - - let Ok(addr) = stream.peer_addr() else { return }; - - let Ok(mut stream) = cert.accept(stream) else { return }; - - Self::accept_stream( - config, - &mut stream, - addr, - true - ); - } + Self::accept_stream( + config, + &mut stream, + addr, + false + ).await; }); } - Some(()) + Ok(()) } - pub fn accept_stream( + pub async fn accept_stream( config: Arc>, - stream: &mut (impl Read + Write + Closeable), + stream: &mut (impl AsyncReadExt + AsyncWriteExt + Unpin), addr: SocketAddr, https: bool ) -> Option<()> { - let mut conn = Self::read_request(config.clone(), stream, addr, https, None)?; + let mut conn = read_request(config.clone(), stream, addr, https, None).await?; if conn.keep_alive && conn.config.enable_keep_alive { loop { if !conn.config.support_keep_alive { conn.stream.close(); - conn.stream = conn.config.connect()?; + conn.stream = conn.config.connect().await?; } - conn = Self::read_request(config.clone(), stream, addr, https, Some(conn))?; + conn = read_request(config.clone(), stream, addr, https, Some(conn)).await?; } } conn.stream.close(); - stream.close(); + stream.shutdown().await.ok()?; Some(()) } +} - fn read_request( - config: Arc>, - stream: &mut (impl Read + Write + Closeable), - addr: SocketAddr, - https: bool, - conn: Option - ) -> Option { - let mut addr = addr; +async fn read_request( + config: Arc>, + stream: &mut (impl AsyncReadExt + AsyncWriteExt + Unpin), + addr: SocketAddr, + https: bool, + conn: Option +) -> Option { + let mut addr = addr; - match &config.read().ok()?.incoming_ip_forwarding { - IpForwarding::Simple => { - let mut header = Vec::new(); + match &config.read().await.incoming_ip_forwarding { + IpForwarding::Simple => { + let mut header = Vec::new(); - { - let mut buf = [0; 1]; + { + let mut buf = [0; 1]; - while let Ok(1) = stream.read(&mut buf) { - let byte = buf[0]; - if byte == b'\n' { break } - header.push(byte); - } + while let Ok(1) = stream.read(&mut buf).await { + let byte = buf[0]; + if byte == b'\n' { break } + header.push(byte); } + } - addr = SocketAddr::from_str(&String::from_utf8(header).ok()?).ok()?; - }, - IpForwarding::Modern => { - let mut ipver = [0; 1]; - stream.read(&mut ipver).ok()?; - addr = match ipver[0] { - 0x01 => { - let mut octets = [0; 4]; - stream.read(&mut octets).ok()?; - let mut port = [0; 2]; - stream.read(&mut port).ok()?; - let port = u16::from_be_bytes(port); - SocketAddr::V4(SocketAddrV4::new(Ipv4Addr::from(octets), port)) - }, 0x02 => { - let mut octets = [0; 16]; - stream.read(&mut octets).ok()?; - let mut port = [0; 2]; - stream.read(&mut port).ok()?; - let port = u16::from_be_bytes(port); - SocketAddr::V6(SocketAddrV6::new(Ipv6Addr::from(octets), port, 0, 0)) - }, _ => { return None }, - }; - }, - _ => { } + addr = SocketAddr::from_str(&String::from_utf8(header).ok()?).ok()?; + }, + IpForwarding::Modern => { + let mut ipver = [0; 1]; + stream.read(&mut ipver).await.ok()?; + addr = match ipver[0] { + 0x01 => { + let mut octets = [0; 4]; + stream.read(&mut octets).await.ok()?; + let mut port = [0; 2]; + stream.read(&mut port).await.ok()?; + let port = u16::from_be_bytes(port); + SocketAddr::V4(SocketAddrV4::new(Ipv4Addr::from(octets), port)) + }, 0x02 => { + let mut octets = [0; 16]; + stream.read(&mut octets).await.ok()?; + let mut port = [0; 2]; + stream.read(&mut port).await.ok()?; + let port = u16::from_be_bytes(port); + SocketAddr::V6(SocketAddrV6::new(Ipv6Addr::from(octets), port, 0, 0)) + }, _ => { return None }, + }; + }, + _ => { } + } + + let mut head = Vec::new(); + + { + let mut buf = [0; 1]; + let mut counter = 0; + + while let Ok(1) = stream.read(&mut buf).await { + let byte = buf[0]; + head.push(byte); + + counter = match (counter, byte) { + (0, b'\r') => 1, + (1, b'\n') => 2, + (2, b'\r') => 3, + (3, b'\n') => break, + _ => 0, + }; } + head.truncate(head.len() - 4); + } + + if head.is_empty() { return None; } + + let head_str = String::from_utf8(head.clone()).ok()?; + let head_str = head_str.trim_matches(char::from(0)).to_string(); + + let mut head_lines = head_str.split("\r\n"); + + let status = head_lines.next()?; + let status_seq: Vec<&str> = status.split(" ").collect(); + + let headers: Vec<(&str, &str)> = head_lines + .filter(|l| l.contains(": ")) + .map(|l| l.split_once(": ").unwrap()) + .collect(); + + let is_chunked = headers.iter() + .find(|o| o.0.to_lowercase() == "transfer-encoding") + .map(|o| o.1.split(",").map(|x| x.trim_matches(' ').to_string()).collect::>()) + .map(|o| o.contains(&"chunked".to_string())) + .unwrap_or(false); + + if let IpForwarding::Header(header) = &config.read().await.incoming_ip_forwarding { + if let Some(ip) = headers.iter().find(|o| o.0 == header).map(|o| o.1) { + addr = SocketAddr::from_str(ip).ok()?; + } + } + + let mut conn: Connection = if conn.is_none() { + let mut host = String::new(); + let mut keep_alive = false; + + for (key, value) in &headers { + match key.to_lowercase().as_str() { + "host" => host = value.to_string(), + "connection" => keep_alive = *value == "keep-alive", + _ => {} + } + } + + let site = config.read().await.get_site(&host)?.clone(); + + Connection { + stream: site.connect().await?, + config: site, + keep_alive, + host + } + } else { + conn? + }; + + let content_length = headers + .iter() + .filter(|(k, _)| k.to_lowercase() == "content-length") + .next() + .map(|o| o.1.parse().ok()) + .flatten() + .unwrap_or(0usize); + + let mut reqbuf: Vec = Vec::new(); + + if let Some(replace_host) = conn.config.replace_host.clone() { + let mut new_head = Vec::new(); + let mut is_status = true; + + for line in head_str.split("\r\n") { + if is_status { + new_head.append(&mut line.as_bytes().to_vec()); + is_status = false; + } else { + new_head.append(&mut b"\r\n".to_vec()); + let (key, _) = line.split_once(": ")?; + if key.to_lowercase() == "host" { + new_head.append(&mut key.as_bytes().to_vec()); + new_head.append(&mut b": ".to_vec()); + new_head.append(&mut replace_host.as_bytes().to_vec()); + } else { + new_head.append(&mut line.as_bytes().to_vec()); + } + } + } + + head = new_head; + } + + match &conn.config.ip_forwarding { + IpForwarding::Header(header) => { + reqbuf.append(&mut status.to_string().as_bytes().to_vec()); + reqbuf.append(&mut b"\r\n".to_vec()); + for (key, value) in String::from_utf8(head.clone()).ok()? + .split("\r\n") + .skip(1) + .filter_map(|o| o.split_once(": ")) { + if *key.to_lowercase() == header.to_lowercase() { continue } + reqbuf.append(&mut key.to_string().as_bytes().to_vec()); + reqbuf.append(&mut b": ".to_vec()); + reqbuf.append(&mut value.to_string().as_bytes().to_vec()); + reqbuf.append(&mut b"\r\n".to_vec()); + } + reqbuf.append(&mut header.as_bytes().to_vec()); + reqbuf.append(&mut b": ".to_vec()); + reqbuf.append(&mut addr.to_string().as_bytes().to_vec()); + reqbuf.append(&mut b"\r\n\r\n".to_vec()); + }, + IpForwarding::Simple => { + reqbuf.append(&mut addr.to_string().as_bytes().to_vec()); + reqbuf.push(b'\n'); + reqbuf.append(&mut head.clone()); + reqbuf.append(&mut b"\r\n\r\n".to_vec()); + }, + IpForwarding::Modern => { + reqbuf.push(if addr.is_ipv4() { 0x01 } else { 0x02 }); + match addr.ip() { + IpAddr::V4(ip) => { + reqbuf.append(&mut ip.octets().to_vec()); + }, IpAddr::V6(ip) => { + reqbuf.append(&mut ip.octets().to_vec()); + } + } + reqbuf.append(&mut addr.port().to_be_bytes().to_vec()); + reqbuf.append(&mut head.clone()); + reqbuf.append(&mut b"\r\n\r\n".to_vec()); + }, + IpForwarding::None => { + reqbuf.append(&mut head.clone()); + reqbuf.append(&mut b"\r\n\r\n".to_vec()); + } + } + + conn.stream.write_all(&reqbuf).await.ok()?; + + if content_length > 0 { + let mut read = 0usize; + let mut buf = vec![0; 4096]; + while let Ok(size) = stream.read(&mut buf).await { + if size == 0 { break } + read += size; + buf.truncate(size); + conn.stream.write_all(&buf).await.ok()?; + buf = vec![0; 4096]; + if read >= content_length { break } + } + } else if is_chunked { + loop { + let mut length = Vec::new(); + { + let mut buf = [0; 1]; + let mut counter = 0; + + while let Ok(1) = stream.read(&mut buf).await { + let byte = buf[0]; + length.push(byte); + + counter = match (counter, byte) { + (0, b'\r') => 1, + (1, b'\n') => break, + _ => 0, + }; + } + conn.stream.write_all(&length).await.ok()?; + + length.truncate(length.len() - 2); + } + let length = String::from_utf8(length).ok()?; + let length = usize::from_str_radix(length.as_str(), 16).ok()?; + let mut data = vec![0u8; length+2]; + stream.read_exact(&mut data).await.ok()?; + + conn.stream.write_all(&data).await.ok()?; + if length == 0 { + break; + } + } + } + + if conn.config.support_keep_alive { let mut head = Vec::new(); { let mut buf = [0; 1]; let mut counter = 0; - while let Ok(1) = stream.read(&mut buf) { + while let Ok(1) = conn.stream.read(&mut buf).await { let byte = buf[0]; head.push(byte); + stream.write_all(&buf).await.ok()?; + counter = match (counter, byte) { (0, b'\r') => 1, (1, b'\n') => 2, @@ -272,154 +434,46 @@ impl FlowgateServer { if head.is_empty() { return None; } let head_str = String::from_utf8(head.clone()).ok()?; - let head_str = head_str.trim_matches(char::from(0)).to_string(); + let head_str = head_str.trim_matches(char::from(0)); - let mut head_lines = head_str.split("\r\n"); - - let status = head_lines.next()?; - let status_seq: Vec<&str> = status.split(" ").collect(); - - let headers: Vec<(&str, &str)> = head_lines + let headers = head_str.split("\r\n") + .skip(1) .filter(|l| l.contains(": ")) .map(|l| l.split_once(": ").unwrap()) - .collect(); + .map(|(k,v)| (k.to_lowercase(),v.to_string())) + .collect::>(); + let content_length = headers.iter() + .find(|(k, _)| k == "content-length") + .map(|o| o.1.parse().ok()) + .flatten() + .unwrap_or(0usize); + let is_chunked = headers.iter() .find(|o| o.0.to_lowercase() == "transfer-encoding") .map(|o| o.1.split(",").map(|x| x.trim_matches(' ').to_string()).collect::>()) .map(|o| o.contains(&"chunked".to_string())) .unwrap_or(false); - if let IpForwarding::Header(header) = &config.read().ok()?.incoming_ip_forwarding { - if let Some(ip) = headers.iter().find(|o| o.0 == header).map(|o| o.1) { - addr = SocketAddr::from_str(ip).ok()?; - } - } - - let mut conn: Connection = if conn.is_none() { - let mut host = String::new(); - let mut keep_alive = false; - - for (key, value) in &headers { - match key.to_lowercase().as_str() { - "host" => host = value.to_string(), - "connection" => keep_alive = *value == "keep-alive", - _ => {} - } - } - - let site = config.read().ok()?.get_site(&host)?.clone(); - - Connection { - stream: site.connect()?, - config: site, - keep_alive, - host - } - } else { - conn? - }; - - let content_length = headers - .iter() - .filter(|(k, _)| k.to_lowercase() == "content-length") - .next() - .map(|o| o.1.parse().ok()) - .flatten() - .unwrap_or(0usize); - - let mut reqbuf: Vec = Vec::new(); - - if let Some(replace_host) = conn.config.replace_host.clone() { - let mut new_head = Vec::new(); - let mut is_status = true; - - for line in head_str.split("\r\n") { - if is_status { - new_head.append(&mut line.as_bytes().to_vec()); - is_status = false; - } else { - new_head.append(&mut b"\r\n".to_vec()); - let (key, _) = line.split_once(": ")?; - if key.to_lowercase() == "host" { - new_head.append(&mut key.as_bytes().to_vec()); - new_head.append(&mut b": ".to_vec()); - new_head.append(&mut replace_host.as_bytes().to_vec()); - } else { - new_head.append(&mut line.as_bytes().to_vec()); - } - } - } - - head = new_head; - } - - match &conn.config.ip_forwarding { - IpForwarding::Header(header) => { - reqbuf.append(&mut status.to_string().as_bytes().to_vec()); - reqbuf.append(&mut b"\r\n".to_vec()); - for (key, value) in String::from_utf8(head.clone()).ok()? - .split("\r\n") - .skip(1) - .filter_map(|o| o.split_once(": ")) { - if *key.to_lowercase() == header.to_lowercase() { continue } - reqbuf.append(&mut key.to_string().as_bytes().to_vec()); - reqbuf.append(&mut b": ".to_vec()); - reqbuf.append(&mut value.to_string().as_bytes().to_vec()); - reqbuf.append(&mut b"\r\n".to_vec()); - } - reqbuf.append(&mut header.as_bytes().to_vec()); - reqbuf.append(&mut b": ".to_vec()); - reqbuf.append(&mut addr.to_string().as_bytes().to_vec()); - reqbuf.append(&mut b"\r\n\r\n".to_vec()); - }, - IpForwarding::Simple => { - reqbuf.append(&mut addr.to_string().as_bytes().to_vec()); - reqbuf.push(b'\n'); - reqbuf.append(&mut head.clone()); - reqbuf.append(&mut b"\r\n\r\n".to_vec()); - }, - IpForwarding::Modern => { - reqbuf.push(if addr.is_ipv4() { 0x01 } else { 0x02 }); - match addr.ip() { - IpAddr::V4(ip) => { - reqbuf.append(&mut ip.octets().to_vec()); - }, IpAddr::V6(ip) => { - reqbuf.append(&mut ip.octets().to_vec()); - } - } - reqbuf.append(&mut addr.port().to_be_bytes().to_vec()); - reqbuf.append(&mut head.clone()); - reqbuf.append(&mut b"\r\n\r\n".to_vec()); - }, - IpForwarding::None => { - reqbuf.append(&mut head.clone()); - reqbuf.append(&mut b"\r\n\r\n".to_vec()); - } - } - - conn.stream.write_all(&reqbuf).ok()?; - if content_length > 0 { let mut read = 0usize; let mut buf = vec![0; 4096]; - while let Ok(size) = stream.read(&mut buf) { + while let Ok(size) = conn.stream.read(&mut buf).await { if size == 0 { break } read += size; buf.truncate(size); - conn.stream.write_all(&buf).ok()?; + stream.write_all(&buf).await.ok()?; buf = vec![0; 4096]; - if read >= content_length { break } + if read == content_length { break } } } else if is_chunked { - loop { let mut length = Vec::new(); { let mut buf = [0; 1]; let mut counter = 0; - while let Ok(1) = stream.read(&mut buf) { + while let Ok(1) = conn.stream.read(&mut buf).await { let byte = buf[0]; length.push(byte); @@ -429,126 +483,32 @@ impl FlowgateServer { _ => 0, }; } - conn.stream.write_all(&length).ok()?; + stream.write_all(&length).await.ok()?; length.truncate(length.len() - 2); } let length = String::from_utf8(length).ok()?; let length = usize::from_str_radix(length.as_str(), 16).ok()?; let mut data = vec![0u8; length+2]; - stream.read_exact(&mut data).ok()?; + conn.stream.read_exact(&mut data).await.ok()?; - conn.stream.write_all(&data).ok()?; + stream.write_all(&data).await.ok()?; if length == 0 { break; } } } - - if conn.config.support_keep_alive { - let mut head = Vec::new(); - - { - let mut buf = [0; 1]; - let mut counter = 0; - - while let Ok(1) = conn.stream.read(&mut buf) { - let byte = buf[0]; - head.push(byte); - - stream.write_all(&buf).ok()?; - - counter = match (counter, byte) { - (0, b'\r') => 1, - (1, b'\n') => 2, - (2, b'\r') => 3, - (3, b'\n') => break, - _ => 0, - }; - } - - head.truncate(head.len() - 4); - } - - if head.is_empty() { return None; } - - let head_str = String::from_utf8(head.clone()).ok()?; - let head_str = head_str.trim_matches(char::from(0)); - - let headers = head_str.split("\r\n") - .skip(1) - .filter(|l| l.contains(": ")) - .map(|l| l.split_once(": ").unwrap()) - .map(|(k,v)| (k.to_lowercase(),v.to_string())) - .collect::>(); - - let content_length = headers.iter() - .find(|(k, _)| k == "content-length") - .map(|o| o.1.parse().ok()) - .flatten() - .unwrap_or(0usize); - - let is_chunked = headers.iter() - .find(|o| o.0.to_lowercase() == "transfer-encoding") - .map(|o| o.1.split(",").map(|x| x.trim_matches(' ').to_string()).collect::>()) - .map(|o| o.contains(&"chunked".to_string())) - .unwrap_or(false); - - if content_length > 0 { - let mut read = 0usize; - let mut buf = vec![0; 4096]; - while let Ok(size) = conn.stream.read(&mut buf) { - if size == 0 { break } - read += size; - buf.truncate(size); - stream.write_all(&buf).ok()?; - buf = vec![0; 4096]; - if read == content_length { break } - } - } else if is_chunked { - loop { - let mut length = Vec::new(); - { - let mut buf = [0; 1]; - let mut counter = 0; - - while let Ok(1) = conn.stream.read(&mut buf) { - let byte = buf[0]; - length.push(byte); - - counter = match (counter, byte) { - (0, b'\r') => 1, - (1, b'\n') => break, - _ => 0, - }; - } - stream.write_all(&length).ok()?; - - length.truncate(length.len() - 2); - } - let length = String::from_utf8(length).ok()?; - let length = usize::from_str_radix(length.as_str(), 16).ok()?; - let mut data = vec![0u8; length+2]; - conn.stream.read_exact(&mut data).ok()?; - - stream.write_all(&data).ok()?; - if length == 0 { - break; - } - } - } - } else { - let mut buf = vec![0;1024]; - while let Ok(n) = conn.stream.read(&mut buf) { - if n == 0 { break } - buf.truncate(n); - stream.write_all(&buf).ok()?; - buf = vec![0;1024]; - } + } else { + let mut buf = vec![0;1024]; + while let Ok(n) = conn.stream.read(&mut buf).await { + if n == 0 { break } + buf.truncate(n); + stream.write_all(&buf).await.ok()?; + buf = vec![0;1024]; } - - info!("{addr} > {} {}://{}{}", status_seq[0], if https { "https" } else { "http" }, conn.host, status_seq[1]); - - Some(conn) } + + info!("{addr} > {} {}://{}{}", status_seq[0], if https { "https" } else { "http" }, conn.host, status_seq[1]); + + Some(conn) } \ No newline at end of file diff --git a/src/flowgate/ssl_cert.rs b/src/flowgate/ssl_cert.rs deleted file mode 100755 index d2172cb..0000000 --- a/src/flowgate/ssl_cert.rs +++ /dev/null @@ -1,28 +0,0 @@ -use openssl::ssl::SslContext; - -#[derive(Clone)] -pub struct SslCert { - context: SslContext, -} - -fn generate_ctx(cert_file: &str, key_file: &str) -> Option { - use openssl::ssl::{SslFiletype, SslMethod}; - - let mut ctx = SslContext::builder(SslMethod::tls()).ok().unwrap(); - ctx.set_private_key_file(&key_file, SslFiletype::PEM).ok().unwrap(); - ctx.set_certificate_file(&cert_file, SslFiletype::PEM).ok().unwrap(); - ctx.check_private_key().ok()?; - Some(ctx.build()) -} - -impl SslCert { - pub fn new(cert_file: &str, key_file: &str) -> Option { - Some(SslCert { - context: generate_ctx(cert_file, key_file)? - }) - } - - pub fn get_context(&self) -> SslContext { - self.context.clone() - } -} \ No newline at end of file diff --git a/src/flowgate/tls.rs b/src/flowgate/tls.rs new file mode 100755 index 0000000..ba75bc5 --- /dev/null +++ b/src/flowgate/tls.rs @@ -0,0 +1,66 @@ +use std::sync::Arc; + +use rustls::{ + crypto::aws_lc_rs::sign::any_supported_type, + pki_types::{pem::PemObject, CertificateDer, PrivateKeyDer}, + server::{ClientHello, ResolvesServerCert}, + sign::CertifiedKey, + ServerConfig +}; + +use tokio::{runtime::Handle, sync::RwLock}; + +use super::config::Config; + + +#[derive(Clone, Debug)] +pub struct TlsCertificate { + key: CertifiedKey +} + +impl TlsCertificate { + pub fn new(cert_file: &str, key_file: &str) -> Option { + let certs = CertificateDer::pem_file_iter(cert_file) + .unwrap() + .map(|cert| cert.unwrap()) + .collect(); + let private_key = PrivateKeyDer::from_pem_file(key_file).unwrap(); + let key = CertifiedKey::new(certs, any_supported_type(&private_key).ok()?); + + Some(Self { key }) + } + + pub fn get_key(&self) -> CertifiedKey { + self.key.clone() + } +} + +#[derive(Debug)] +struct ResolvesServerCertWildcard { + config: Arc>, + handle: Handle +} + +impl ResolvesServerCertWildcard { + pub async fn new(config: Arc>) -> Self { + Self { config, handle: Handle::current() } + } +} + +impl ResolvesServerCert for ResolvesServerCertWildcard { + fn resolve(&self, client_hello: ClientHello<'_>) -> Option> { + if let Some(cert) = client_hello.server_name() + .and_then(|name| self.handle.block_on(self.config.read()).get_site(name).cloned()) + .and_then(|site| site.ssl) { + Some(Arc::new(cert.get_key())) + } else { + None + } + } +} + +pub async fn create_server_config(config: Arc>) -> ServerConfig { + ServerConfig::builder() + .with_no_client_auth() + .with_cert_resolver(Arc::new(ResolvesServerCertWildcard::new(config).await)) +} \ No newline at end of file diff --git a/src/main.rs b/src/main.rs index 9111011..289e275 100755 --- a/src/main.rs +++ b/src/main.rs @@ -1,16 +1,19 @@ -use std::{fs, path::Path, sync::{Arc, RwLock}}; +use std::{fs, path::Path, sync::Arc}; use flowgate::{config::Config, server::FlowgateServer}; +use ignore_result::Ignore; +use tokio::sync::RwLock; -fn main() { +#[tokio::main] +async fn main() { colog::init(); if !Path::new("conf.yml").exists() { - let _ = fs::write("conf.yml", include_bytes!("../conf.yml")); + fs::write("conf.yml", include_bytes!("../conf.yml")).ignore(); } let config = Arc::new(RwLock::new(Config::parse("conf.yml").unwrap())); let server = FlowgateServer::new(config.clone()); - server.start(); + server.start().await; } \ No newline at end of file