Skip to content

Commit

Permalink
Add rustls support when using Redis
Browse files Browse the repository at this point in the history
Via `redis_storage_rustls` feature.

This doesn't affect default usage.
  • Loading branch information
reneklacan committed Dec 11, 2024
1 parent 5a2fccf commit aaa018b
Show file tree
Hide file tree
Showing 2 changed files with 140 additions and 12 deletions.
101 changes: 101 additions & 0 deletions Cargo.lock

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

51 changes: 39 additions & 12 deletions limitador/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
[package]
name = "limitador"
version = "0.8.0-dev"
authors = ["David Ortiz <[email protected]>", "Eguzki Astiz Lezaun <[email protected]>", "Alex Snaps <[email protected]>"]
authors = [
"David Ortiz <[email protected]>",
"Eguzki Astiz Lezaun <[email protected]>",
"Alex Snaps <[email protected]>",
]
license = "Apache-2.0"
keywords = ["rate-limiting", "rate", "limiter"]
categories = ["web-programming"]
Expand All @@ -15,8 +19,31 @@ edition = "2021"
[features]
default = ["disk_storage", "redis_storage"]
disk_storage = ["rocksdb"]
distributed_storage = ["tokio", "tokio-stream", "h2", "base64", "uuid", "tonic", "tonic-reflection", "prost", "prost-types"]
redis_storage = ["redis", "r2d2", "tokio"]
distributed_storage = [
"tokio",
"tokio-stream",
"h2",
"base64",
"uuid",
"tonic",
"tonic-reflection",
"prost",
"prost-types",
]
redis_storage = [
"r2d2",
"tokio",
"redis",
"redis/tls-native-tls",
"redis/tokio-native-tls-comp",
]
redis_storage_rustls = [
"r2d2",
"tokio",
"redis",
"redis/tls-rustls",
"redis/tokio-rustls-comp",
]

[dependencies]
moka = { version = "0.12", features = ["sync"] }
Expand All @@ -30,12 +57,12 @@ tracing = "0.1.40"
metrics = "0.24"

# Optional dependencies
rocksdb = { version = "0.22", optional = true, features = ["multi-threaded-cf"] }
rocksdb = { version = "0.22", optional = true, features = [
"multi-threaded-cf",
] }
redis = { version = "0.27", optional = true, features = [
"connection-manager",
"tokio-comp",
"tls-native-tls",
"tokio-native-tls-comp",
"script",
] }
r2d2 = { version = "0.8", optional = true }
Expand All @@ -53,7 +80,11 @@ tonic = { version = "0.12.3", optional = true }
tonic-reflection = { version = "0.12.3", optional = true }
prost = { version = "0.13.3", optional = true }
prost-types = { version = "0.13.3", optional = true }
cel-interpreter = { git = "https://github.com/clarkmcc/cel-rust", rev = "5b02b08", features = ["json", "regex", "chrono"] }
cel-interpreter = { git = "https://github.com/clarkmcc/cel-rust", rev = "5b02b08", features = [
"json",
"regex",
"chrono",
] }
cel-parser = { git = "https://github.com/clarkmcc/cel-rust", rev = "5b02b08" }

[dev-dependencies]
Expand All @@ -69,11 +100,7 @@ redis = { version = "0.27", features = [
paste = "1"
rand = "0.8"
tempfile = "3.5.0"
tokio = { version = "1", features = [
"rt-multi-thread",
"macros",
"time",
] }
tokio = { version = "1", features = ["rt-multi-thread", "macros", "time"] }

[build-dependencies]
tonic-build = "0.12"
Expand Down

0 comments on commit aaa018b

Please sign in to comment.