From b9485732b49eb2387d19a91854806bc15b87e3ee Mon Sep 17 00:00:00 2001 From: Jose Celano Date: Wed, 15 May 2024 16:51:09 +0100 Subject: [PATCH] chore(deps): [#426] add cargo dependencies to use a custom axum server with timeouts Two levels of wrappers for the Axum server: Custom (with timeouts) -> axum-server -> axum --- Cargo.lock | 85 ++++++++++++++++++++++++++++++++++++++++++++--- Cargo.toml | 6 ++++ project-words.txt | 3 ++ 3 files changed, 90 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ba81e0ce..0b8b8edd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -130,6 +130,12 @@ version = "1.0.83" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "25bdb32cbbdce2b519a9cd7df3a678443100e265d5e25ca763b7572a5104f5f3" +[[package]] +name = "arc-swap" +version = "1.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69f7f8c3906b62b754cd5326047894316021dcfe5a194c8ea52bdd94934a3457" + [[package]] name = "argon2" version = "0.5.3" @@ -258,6 +264,29 @@ dependencies = [ "tracing", ] +[[package]] +name = "axum-server" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1ad46c3ec4e12f4a4b6835e173ba21c25e484c9d02b49770bf006ce5367c036" +dependencies = [ + "arc-swap", + "bytes", + "futures-util", + "http", + "http-body", + "http-body-util", + "hyper", + "hyper-util", + "pin-project-lite", + "rustls 0.21.12", + "rustls-pemfile", + "tokio", + "tokio-rustls 0.24.1", + "tower", + "tower-service", +] + [[package]] name = "backtrace" version = "0.3.71" @@ -1435,12 +1464,12 @@ dependencies = [ "nom", "percent-encoding", "quoted_printable", - "rustls", + "rustls 0.23.5", "rustls-pemfile", "socket2", "tokio", "tokio-native-tls", - "tokio-rustls", + "tokio-rustls 0.26.0", "url", "webpki-roots", ] @@ -2258,6 +2287,18 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "rustls" +version = "0.21.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f56a14d1f48b391359b22f731fd4bd7e43c97f3c50eee276f3aa09c94784d3e" +dependencies = [ + "log", + "ring", + "rustls-webpki 0.101.7", + "sct", +] + [[package]] name = "rustls" version = "0.23.5" @@ -2268,7 +2309,7 @@ dependencies = [ "once_cell", "ring", "rustls-pki-types", - "rustls-webpki", + "rustls-webpki 0.102.3", "subtle", "zeroize", ] @@ -2289,6 +2330,16 @@ version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "976295e77ce332211c0d24d92c0e83e50f5c5f046d11082cea19f3df13a3562d" +[[package]] +name = "rustls-webpki" +version = "0.101.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b6275d1ee7a1cd780b64aca7726599a1dbc893b1e64144529e55c3c2f745765" +dependencies = [ + "ring", + "untrusted", +] + [[package]] name = "rustls-webpki" version = "0.102.3" @@ -2361,6 +2412,16 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" +[[package]] +name = "sct" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da046153aa2352493d6cb7da4b6e5c0c057d8a1d0a9aa8560baffdd945acd414" +dependencies = [ + "ring", + "untrusted", +] + [[package]] name = "security-framework" version = "2.11.0" @@ -3099,13 +3160,23 @@ dependencies = [ "tokio", ] +[[package]] +name = "tokio-rustls" +version = "0.24.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c28327cf380ac148141087fbfb9de9d7bd4e84ab5d2c28fbc911d753de8a7081" +dependencies = [ + "rustls 0.21.12", + "tokio", +] + [[package]] name = "tokio-rustls" version = "0.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0c7bc40d0e5a97695bb96e27995cd3a08538541b0a846f65bba7a359f36700d4" dependencies = [ - "rustls", + "rustls 0.23.5", "rustls-pki-types", "tokio", ] @@ -3176,6 +3247,7 @@ dependencies = [ "argon2", "async-trait", "axum", + "axum-server", "binascii", "bytes", "chrono", @@ -3185,15 +3257,19 @@ dependencies = [ "email_address", "fern", "futures", + "futures-util", "hex", "http", + "http-body", "hyper", + "hyper-util", "indexmap", "jsonwebtoken", "lazy_static", "lettre", "log", "pbkdf2", + "pin-project-lite", "rand", "rand_core", "regex", @@ -3214,6 +3290,7 @@ dependencies = [ "tokio", "toml", "torrust-index-located-error", + "tower", "tower-http", "trace", "tracing", diff --git a/Cargo.toml b/Cargo.toml index 7bf8639a..4f3d6b3a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -37,6 +37,7 @@ anyhow = "1.0.81" argon2 = "0" async-trait = "0" axum = { version = "0", features = ["multipart"] } +axum-server = { version = "0", features = ["tls-rustls"] } binascii = "0" bytes = "1" chrono = { version = "0", default-features = false, features = ["clock"] } @@ -46,15 +47,19 @@ derive_more = "0" email_address = "0" fern = "0" futures = "0" +futures-util = "0.3.30" hex = "0" http = "1.1.0" +http-body = "1.0.0" hyper = "1" +hyper-util = { version = "0.1.3", features = ["http1", "http2", "tokio"] } indexmap = "2" jsonwebtoken = "9" lazy_static = "1.4.0" lettre = { version = "0", features = ["builder", "smtp-transport", "tokio1", "tokio1-native-tls", "tokio1-rustls-tls"] } log = "0" pbkdf2 = { version = "0", features = ["simple"] } +pin-project-lite = "0.2" rand = "0" rand_core = { version = "0", features = ["std"] } regex = "1" @@ -74,6 +79,7 @@ thiserror = "1" tokio = { version = "1", features = ["fs", "io-util", "macros", "net", "rt-multi-thread", "signal", "sync", "time"] } toml = "0" torrust-index-located-error = { version = "3.0.0-alpha.3-develop", path = "packages/located-error" } +tower = { version = "0.4", features = ["timeout"] } tower-http = { version = "0", features = ["compression-full", "cors", "propagate-header", "request-id", "trace"] } trace = "0.1.7" tracing = "0.1.40" diff --git a/project-words.txt b/project-words.txt index c6f4a670..d02ab0ca 100644 --- a/project-words.txt +++ b/project-words.txt @@ -25,6 +25,7 @@ Dont dotless dtolnay elif +Eray grcov Grünwald hasher @@ -39,6 +40,7 @@ indexmap infohash Intermodal jsonwebtoken +Karatay leechers Leechers LEECHERS @@ -59,6 +61,7 @@ oneshot openbittorrent opentrackr ppassword +programatik proxied rapppid reqwest