Skip to content

Commit

Permalink
🔖 Release v0.2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
iota9star committed May 7, 2024
1 parent eca8b44 commit 1e3d23c
Show file tree
Hide file tree
Showing 3 changed files with 127 additions and 34 deletions.
134 changes: 112 additions & 22 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 10 additions & 10 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,45 +1,45 @@
[package]
name = "elex-proxy"
version = "0.2.0"
version = "0.2.1"
edition = "2021"
build = "build.rs"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
axum = { version = "^0.7.5", features = ["http2"] }
futures = "^0"
serde = { version = "^1.0.197", features = ["derive"] }
serde_json = "^1.0.115"
serde = { version = "^1", features = ["derive"] }
serde_json = "^1"
tokio = { version = "^1.37.0", features = ["full"] }
tokio-stream = "^0.1.15"
tungstenite = "^0"
tokio-tungstenite = { version = "^0", features = ["native-tls"] }
openssl = { version = "^0.10.64", features = ["vendored"] }
url = "^2"
time = { version = "^0.3.34", features = [] }
time = { version = "^0.3", features = [] }
tower = { version = "^0", features = ["full"] }
tower-http = { version = "^0.5.2", features = ["cors", "trace", "catch-panic"] }
tower-http = { version = "^0.5.2", features = ["cors", "trace", "catch-panic", "compression-br", "async-compression", "tokio"] }
once_cell = "^1"
tracing = "^0"
tracing-subscriber = "^0"
anyhow = "^1.0.81"
tower_governor = "^0.3.2"
anyhow = "^1"
tower_governor = "0.4.2"
bytes = "^1.6.0"
http-body-util = "^0.1.1"
dotenv = "^0"
regex = "^1.10.4"
headers = "0.4.0"
forwarded-header-value = "0.1.1"
rand = "0.8.5"
bitcoin = "0.31.2"
bitcoin = "0.32.0"
hex = "0.4.3"
moka = { version = "0.12.5", features = ["future"] }
moka = { version = "0.12", features = ["future"] }
ciborium = "0.2.2"
mime_guess = "2.0.4"

[build-dependencies]
vergen = { version = "9.0.0-beta.2", features = ["build", "cargo", "rustc"] }
anyhow = "^1.0.81"
anyhow = "^1"

[profile.release]
strip = true
Expand Down
7 changes: 5 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,10 @@ use tower_governor::governor::GovernorConfigBuilder;
use tower_governor::key_extractor::SmartIpKeyExtractor;
use tower_governor::GovernorLayer;
use tower_http::catch_panic::CatchPanicLayer;
use tower_http::compression::CompressionLayer;
use tower_http::cors::CorsLayer;
use tower_http::trace::TraceLayer;
use tower_http::CompressionLevel;
use tracing::{debug, error, info, warn};

use crate::cache::to_cache_key;
Expand Down Expand Up @@ -256,7 +258,7 @@ fn handle_panic(err: Box<dyn Any + Send + 'static>) -> http::Response<Full<Bytes
async fn main() {
dotenv().ok();
tracing_subscriber::fmt::init();
let governor_conf = Box::new(
let governor_conf = Arc::new(
GovernorConfigBuilder::default()
.per_millisecond(*IP_LIMIT_PER_MILLS)
.burst_size(*IP_LIMIT_BURST_SIZE)
Expand Down Expand Up @@ -292,8 +294,9 @@ async fn main() {
.route("/proxy/health", get(handle_health).post(handle_health))
.route("/proxy/:method", get(handle_get).post(handle_post))
.layer(GovernorLayer {
config: Box::leak(governor_conf),
config: governor_conf,
})
.layer(CompressionLayer::new().quality(CompressionLevel::Best))
.layer(ConcurrencyLimitLayer::new(*CONCURRENCY_LIMIT))
.layer(CatchPanicLayer::custom(handle_panic))
.layer(TraceLayer::new_for_http())
Expand Down

0 comments on commit 1e3d23c

Please sign in to comment.