[package]
name = "flare-core"
version = "1.0.1"
edition = "2024"
rust-version = "1.94.0"
description = "A high-performance, reliable long-connection communication toolkit for Rust, supporting WebSocket and QUIC protocols with features like authentication, device management, serialization negotiation, and protocol racing."
keywords = ["websocket", "quic", "tokio", "realtime", "instant-messaging"]
categories = ["network-programming", "asynchronous", "web-programming"]
authors = ["Flare Team"]
license = "MIT"
repository = "https://github.com/flare-im/flare-core"
homepage = "https://github.com/flare-im/flare-core"
documentation = "https://docs.rs/flare-core"
readme = "README.md"
exclude = [
    "target/",
    "Cargo.lock",
    "examples/",
    "scripts/",
    "doc/",
    "certs/",
    ".git/",
    ".github/",
    "*.md",
    "!README.md",
]

[package.metadata.docs.rs]
all-features = true
targets = ["x86_64-unknown-linux-gnu", "wasm32-unknown-unknown"]

[dependencies]
futures-util = "0.3"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
prost = "0.14"
bytes = "1"
async-trait = "0.1"
thiserror = "2.0"
chrono = { version = "0.4", features = ["serde"] }
flate2 = { version = "1.0", optional = true }
lazy_static = "1.4"
url = "2.5"
base64 = "0.22"
tracing = "0.1"
sha2 = "0.10"
hex = "0.4"
base32 = "0.4"
aes-gcm = { version = "0.10", optional = true }
rand = "0.8"
anyhow = "1.0"

[build-dependencies]
prost-build = "0.14"

[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
rustls-pemfile = "2"
tracing-subscriber = { version = "0.3", features = ["env-filter", "fmt"] }
rcgen = "0.14"
tokio = { version = "1", features = ["full"] }
tokio-tungstenite = { version = "0.28.0", features = ["rustls-tls-webpki-roots"] }
quinn = "0.11"
rustls = { version = "0.23", features = ["ring"] }
x509-parser = "0.17"
webpki-roots = "0.26"
ulid = "1.1"

[target.'cfg(target_arch = "wasm32")'.dependencies]
futures-channel = "0.3"
futures-util = { version = "0.3", default-features = false, features = ["std", "async-await"] }
getrandom = { version = "0.2", features = ["js"] }
js-sys = "0.3"
tokio = { version = "1", default-features = false, features = ["sync", "macros", "rt", "time"] }
wasmtimer = "0.4"
web-time = "1.1"
wasm-bindgen = "0.2"
wasm-bindgen-futures = "0.4"
web-sys = { version = "0.3", features = [
    "WebSocket",
    "BinaryType",
    "MessageEvent",
    "CloseEvent",
    "ErrorEvent",
    "Blob",
    "console",
] }

[dev-dependencies]

[features]
default = [
    "client",
    "server",
    "websocket",
    "quic",
    "compression-gzip",
    "encryption-aes-gcm",
]
full = [
    "client",
    "server",
    "websocket",
    "quic",
    "tcp",
    "compression-gzip",
    "encryption-aes-gcm",
]

# Public stack surfaces.
client = []
server = []

# Transport capabilities.
websocket = []
quic = []
tcp = []

# wasm32 客户端栈（WebSocket only）；构建时配合 --target wasm32-unknown-unknown
wasm = ["client", "websocket", "compression-gzip", "encryption-aes-gcm"]

# Codec / crypto capabilities.
compression-gzip = ["dep:flate2"]
encryption-aes-gcm = ["dep:aes-gcm"]

[[example]]
name = "tcp_client"
required-features = ["tcp"]

[[bench]]
name = "perf_baseline"
harness = false
required-features = ["server", "compression-gzip"]
