[package]
name = "rift-http-proxy"
version.workspace = true
edition.workspace = true
license.workspace = true
authors.workspace = true
repository.workspace = true
homepage.workspace = true
rust-version.workspace = true

# Crate metadata
description = "Rift: high-performance HTTP chaos engineering proxy with Lua/Rhai/JavaScript scripting for fault injection."
readme = "../../README.md"
keywords = ["proxy", "http", "chaos", "fault-injection", "kubernetes"]
categories = ["network-programming", "web-programming::http-server", "development-tools::testing"]

[dependencies]
# Async runtime
tokio = { version = "1.41", features = ["full"] }
async-trait = "0.1"
futures = "0.3"

# HTTP
hyper = { version = "1.5", features = ["full"] }
hyper-util = { version = "0.1", features = ["full"] }
http-body-util = "0.1"
tower = { version = "0.5", features = ["full"] }
# Pin the rustls crypto provider to `ring` everywhere. hyper-rustls/tokio-rustls
# default to the `aws-lc-rs` provider, whose C build (aws-lc-sys) fails to compile
# on the windows-msvc CI runner (C11 atomics). The runtime provider is ring
# (see main.rs), so aws-lc-rs is dead weight; disabling it keeps the build portable.
hyper-rustls = { version = "0.27", default-features = false, features = ["http1", "ring", "native-tokio", "tls12", "logging"] }
rustls = { version = "0.23", default-features = false, features = ["ring", "std", "tls12", "logging"] }
rustls-pemfile = "2.0"
tokio-rustls = { version = "0.26", default-features = false, features = ["ring", "tls12", "logging"] }

# Serialization
serde = { version = "1.0", features = ["derive"] }
serde_yaml = "0.9"
serde_json = "1.0"

# Scripting engines
rhai = { version = "=1.21.0", features = ["sync", "serde"] }
mlua = { version = "0.10", features = ["luajit", "serialize"], optional = true }
boa_engine = { version = "0.20", optional = true }

# State storage (synchronous Redis client for Lua compatibility)
# Using connection-manager feature for basic sync support without TLS complications
redis = { version = "0.26", default-features = false, optional = true }
r2d2 = { version = "0.8", optional = true }

# Logging & Observability
tracing = "0.1"
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
tracing-appender = "0.2"
prometheus = "0.13"
lazy_static = "1.4"

# CLI
clap = { version = "4.5", features = ["derive", "env"] }

# HTTP client (for save command)
reqwest = { version = "0.12", default-features = false, features = ["json", "rustls-tls"] }

# Utils
once_cell = "1.19"
bytes = "1.7"
base64 = "0.22"
chrono = { version = "0.4", features = ["serde"] }
regex = "1.11"
rand = "0.8"
urlencoding = "2.1"
similar = "2.6"
matchit = "0.9"
aho-corasick = "1.1"
anyhow = "1.0"
thiserror = "2.0"
socket2 = "0.5"
num_cpus = "1.16"
libc = "0.2"
parking_lot = "0.12"
crossbeam = "0.8"

# XML/XPath support for Mountebank compatibility
sxd-document = "0.3"
sxd-xpath = "0.4"

# JSONPath RFC 9535 support
serde_json_path = "0.7"

[dev-dependencies]
tempfile = "3.8"
criterion = { version = "0.5", features = ["html_reports"] }

# Integration testing
reqwest = { version = "0.12", features = ["json"] }
tokio-test = "0.4"
testcontainers = "0.23"
testcontainers-modules = { version = "0.11", features = ["redis"] }
uuid = { version = "1.8", features = ["v4"] }
assert-json-diff = "2.0"
serial_test = "3.0"
tracing-test = "0.2"
once_cell = "1.19"
port_check = "0.2"

[features]
default = ["redis-backend", "lua", "javascript"]
redis-backend = ["redis", "r2d2"]
lua = ["mlua"]
javascript = ["boa_engine"]

[[bin]]
name = "rift-verify"
path = "src/bin/verify.rs"

[[bench]]
name = "matcher_bench"
harness = false
