diff --git a/Cargo.lock b/Cargo.lock index a527ee0..6149f91 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1481,6 +1481,12 @@ version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004" +[[package]] +name = "futures-timer" +version = "3.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f288b0a4f20f9a56b5d1da57e2227c661b7b16168e2f72365f57b63326e29b24" + [[package]] name = "futures-util" version = "0.3.30" @@ -1674,6 +1680,7 @@ dependencies = [ "futures-util", "geph5-broker-protocol", "geph5-misc-rpc", + "governor", "hex", "isocountry", "mizaru2", @@ -1682,6 +1689,7 @@ dependencies = [ "nursery_macro", "once_cell", "picomux", + "quanta", "rand", "reqwest", "serde", @@ -1765,6 +1773,26 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "governor" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68a7f542ee6b35af73b06abc0dad1c1bae89964e4e253bc4b587b91c9637867b" +dependencies = [ + "cfg-if", + "dashmap", + "futures", + "futures-timer", + "no-std-compat", + "nonzero_ext", + "parking_lot 0.12.1", + "portable-atomic", + "quanta", + "rand", + "smallvec", + "spinning_top", +] + [[package]] name = "h2" version = "0.3.25" @@ -2422,6 +2450,12 @@ dependencies = [ "thiserror", ] +[[package]] +name = "no-std-compat" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b93853da6d84c2e3c7d730d6473e8817692dd89be387eb01b94d7f108ecb5b8c" + [[package]] name = "nom" version = "7.1.3" @@ -2432,6 +2466,12 @@ dependencies = [ "minimal-lexical", ] +[[package]] +name = "nonzero_ext" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38bf9645c8b145698bb0b18a4637dcacbc421ea49bef2317e4fd8065a387cf21" + [[package]] name = "nu-ansi-term" version = "0.46.0" @@ -2846,6 +2886,12 @@ dependencies = [ "universal-hash", ] +[[package]] +name = "portable-atomic" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7170ef9988bc169ba16dd36a7fa041e5c4cbeb6a35b76d4c03daded371eae7c0" + [[package]] name = "powerfmt" version = "0.2.0" @@ -3655,6 +3701,15 @@ dependencies = [ "lock_api", ] +[[package]] +name = "spinning_top" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d96d2d1d716fb500937168cc09353ffdc7a012be8475ac7308e1bdf0e3923300" +dependencies = [ + "lock_api", +] + [[package]] name = "spki" version = "0.6.0" diff --git a/binaries/geph5-exit/Cargo.toml b/binaries/geph5-exit/Cargo.toml index d99f9dc..75a30c7 100644 --- a/binaries/geph5-exit/Cargo.toml +++ b/binaries/geph5-exit/Cargo.toml @@ -39,4 +39,6 @@ hex = "0.4.3" nursery_macro = "0.1.0" moka = {version="0.12.5", features=["future"]} tachyonix = "0.2.1" -mizaru2={path="../../libraries/mizaru2"} \ No newline at end of file +mizaru2={path="../../libraries/mizaru2"} +governor = "0.6.3" +quanta = "0.12.2" diff --git a/binaries/geph5-exit/src/main.rs b/binaries/geph5-exit/src/main.rs index 7dfd595..b73b80a 100644 --- a/binaries/geph5-exit/src/main.rs +++ b/binaries/geph5-exit/src/main.rs @@ -11,6 +11,7 @@ use tracing_subscriber::{layer::SubscriberExt as _, util::SubscriberInitExt as _ mod broker; mod listen; mod proxy; +mod ratelimit; /// The global config file. static CONFIG_FILE: OnceCell = OnceCell::new();