251 lines
14 KiB
TOML
251 lines
14 KiB
TOML
#file: backend/modules/chat_server/Cargo.toml
|
|
|
|
[package]
|
|
name = "chat_server"
|
|
version = "0.2.0"
|
|
edition = "2021"
|
|
authors = ["Veza Team <dev@veza-chat.com>"]
|
|
description = "Serveur de chat WebSocket sécurisé et haute performance"
|
|
repository = "https://github.com/veza/chat-server"
|
|
license = "MIT"
|
|
keywords = ["websocket", "chat", "real-time", "rust", "tokio"]
|
|
categories = ["network-programming", "web-programming::websocket"]
|
|
readme = "README.md"
|
|
|
|
[lib]
|
|
name = "chat_server"
|
|
path = "src/lib.rs"
|
|
|
|
[[bin]]
|
|
name = "chat-server"
|
|
path = "src/main.rs"
|
|
|
|
# Les binaires de test sont dans le dossier target/debug et ne sont pas définis ici
|
|
|
|
[dependencies]
|
|
# ═══════════════════════════════════════════════════════════════════════
|
|
# RUNTIME ASYNCHRONE ET RÉSEAU
|
|
# ═══════════════════════════════════════════════════════════════════════
|
|
tokio = { version = "1.35", features = [
|
|
"full", # Toutes les fonctionnalités
|
|
"tracing", # Support tracing
|
|
"signal", # Signaux système pour shutdown gracieux
|
|
] }
|
|
tokio-tungstenite = "0.21" # WebSocket server/client
|
|
tungstenite = "0.21" # Core WebSocket
|
|
futures-util = "0.3" # Utilitaires futures
|
|
hyper = { version = "1.0", features = ["full"] } # Client HTTP pour webhooks
|
|
axum = { version = "0.8", features = ["macros", "ws"] } # Framework web moderne
|
|
|
|
# ═══════════════════════════════════════════════════════════════════════
|
|
# BASE DE DONNÉES ET CACHE
|
|
# ═══════════════════════════════════════════════════════════════════════
|
|
sqlx = { version = "0.8.6", features = [
|
|
"postgres", # Support PostgreSQL
|
|
"runtime-tokio-native-tls", # Runtime async avec TLS natif
|
|
"chrono", # Support des types de date
|
|
"uuid", # Support UUID
|
|
"json", # Support JSON/JSONB
|
|
"migrate", # Migrations de base de données
|
|
"macros", # Macros query!
|
|
] }
|
|
redis = { version = "0.32", features = [
|
|
"tokio-comp", # Support Tokio
|
|
"connection-manager", # Gestionnaire de connexions
|
|
], optional = true }
|
|
lz4 = "1.24" # Compression pour message storage
|
|
|
|
# ═══════════════════════════════════════════════════════════════════════
|
|
# SÉRIALISATION ET FORMATS
|
|
# ═══════════════════════════════════════════════════════════════════════
|
|
serde = { version = "1.0", features = ["derive"] }
|
|
serde_json = "1.0"
|
|
toml = "0.9" # Configuration TOML
|
|
rmp-serde = "1.1" # MessagePack pour cache efficace
|
|
|
|
# ═══════════════════════════════════════════════════════════════════════
|
|
# AUTHENTIFICATION ET SÉCURITÉ
|
|
# ═══════════════════════════════════════════════════════════════════════
|
|
jsonwebtoken = "9.2" # JWT tokens
|
|
bcrypt = "0.17" # Hachage de mots de passe
|
|
ring = "0.17" # Cryptographie (signatures, HMAC)
|
|
argon2 = "0.5" # Hachage de mots de passe moderne (alternative à bcrypt)
|
|
sha2 = "0.10" # Hachage SHA-2
|
|
totp-rs = { version = "5.4", features = ["qr"] } # TOTP 2FA
|
|
qrcode = "0.14" # Génération QR codes pour 2FA
|
|
|
|
# ═══════════════════════════════════════════════════════════════════════
|
|
# TYPES ET UTILITAIRES
|
|
# ═══════════════════════════════════════════════════════════════════════
|
|
veza-common = { path = "../veza-common" }
|
|
chrono = { version = "0.4", features = ["serde"] }
|
|
uuid = { version = "1.6", features = ["v4", "serde"] }
|
|
url = { version = "2.5", features = ["serde"] } # Parsing d'URLs
|
|
percent-encoding = "2.3" # Encodage URL
|
|
base64 = "0.21" # Encodage base64
|
|
hex = "0.4" # Encodage hexadécimal
|
|
|
|
# ═══════════════════════════════════════════════════════════════════════
|
|
# VALIDATION ET NETTOYAGE
|
|
# ═══════════════════════════════════════════════════════════════════════
|
|
regex = "1.10" # Expressions régulières
|
|
validator = { version = "0.20", features = ["derive"] } # Validation des données
|
|
ammonia = "3.3" # Nettoyage HTML/XSS
|
|
linkify = "0.10" # Détection automatique de liens
|
|
|
|
# ═══════════════════════════════════════════════════════════════════════
|
|
# GESTION D'ERREURS ET LOGGING
|
|
# ═══════════════════════════════════════════════════════════════════════
|
|
thiserror = "2.0" # Macros d'erreurs
|
|
anyhow = "1.0" # Gestion d'erreurs contextuelles
|
|
tracing = "0.1" # Logging structuré
|
|
tracing-subscriber = { version = "0.3", features = [
|
|
"env-filter", # Filtrage par variables d'env
|
|
"fmt", # Formatage console
|
|
"json", # Format JSON pour production
|
|
"ansi", # Couleurs ANSI
|
|
"chrono", # Timestamps
|
|
] }
|
|
tracing-appender = "0.2" # Rotation des logs
|
|
|
|
# ═══════════════════════════════════════════════════════════════════════
|
|
# CONFIGURATION ET ENVIRONNEMENT
|
|
# ═══════════════════════════════════════════════════════════════════════
|
|
dotenvy = "0.15" # Variables d'environnement (.env)
|
|
config = "0.15" # Configuration multi-sources
|
|
clap = { version = "4.4", features = ["derive", "env"] } # CLI arguments
|
|
|
|
# ═══════════════════════════════════════════════════════════════════════
|
|
# PERFORMANCE ET MONITORING
|
|
# ═══════════════════════════════════════════════════════════════════════
|
|
metrics = { version = "0.22", optional = true } # Métriques de performance
|
|
metrics-exporter-prometheus = { version = "0.13", optional = true } # Export Prometheus
|
|
dashmap = "6.1" # HashMap concurrent
|
|
parking_lot = "0.12" # Mutex plus performants
|
|
rayon = "1.10" # Parallel processing pour batching
|
|
bytes = "1.6" # Zero-copy message handling
|
|
once_cell = "1.19" # Initialisation paresseuse thread-safe
|
|
|
|
# ═══════════════════════════════════════════════════════════════════════
|
|
# FONCTIONNALITÉS AVANCÉES
|
|
# ═══════════════════════════════════════════════════════════════════════
|
|
notify = "8.2" # Surveillance système de fichiers
|
|
image = { version = "0.24", features = ["png", "jpeg", "webp"], optional = true } # Traitement d'images
|
|
infer = { version = "0.15", optional = true } # Détection de type de fichier
|
|
mime = "0.3" # Types MIME
|
|
tempfile = { version = "3.8", optional = true } # Fichiers temporaires
|
|
zip = { version = "0.6", optional = true } # Archives ZIP
|
|
|
|
# ═══════════════════════════════════════════════════════════════════════
|
|
# ═══════════════════════════════════════════════════════════════════════
|
|
# gRPC ET COMMUNICATION INTER-SERVICES
|
|
# ═══════════════════════════════════════════════════════════════════════
|
|
tonic = { version = "0.11", features = ["transport", "prost"] }
|
|
prost = "0.12"
|
|
prost-types = "0.14"
|
|
tokio-stream = "0.1"
|
|
|
|
# RabbitMQ client (ORIGIN Architecture - Event Bus)
|
|
lapin = "2.3"
|
|
|
|
# ═══════════════════════════════════════════════════════════════════════
|
|
# INTÉGRATIONS EXTERNES (OPTIONAL)
|
|
# ═══════════════════════════════════════════════════════════════════════
|
|
lettre = { version = "0.11", features = ["tokio1-native-tls"], optional = true } # Envoi d'emails
|
|
reqwest = { version = "0.11", features = ["json", "rustls-tls"], optional = true } # Client HTTP
|
|
webhook = { version = "2.1", optional = true } # Webhooks sortants
|
|
sysinfo = "0.37.2"
|
|
|
|
[dev-dependencies]
|
|
# ═══════════════════════════════════════════════════════════════════════
|
|
# DÉPENDANCES DE TEST ET DÉVELOPPEMENT
|
|
# ═══════════════════════════════════════════════════════════════════════
|
|
tokio-test = "0.4" # Utilitaires de test async
|
|
mockall = "0.12" # Mocking
|
|
proptest = "1.4" # Property testing
|
|
criterion = { version = "0.5", features = ["html_reports"] } # Benchmarks
|
|
insta = "1.34" # Tests de snapshot
|
|
test-log = "0.2" # Logging dans les tests
|
|
pretty_assertions = "1.4" # Assertions plus lisibles
|
|
|
|
[build-dependencies]
|
|
tonic-build = "0.11" # Génération de code protobuf
|
|
|
|
[features]
|
|
# Fonctionnalités par défaut
|
|
default = [
|
|
"redis-cache",
|
|
"file-uploads",
|
|
"webhooks",
|
|
"metrics",
|
|
"email"
|
|
]
|
|
|
|
# Cache Redis (désactivable pour dev/test)
|
|
redis-cache = ["dep:redis"]
|
|
|
|
# Upload de fichiers avec validation
|
|
file-uploads = ["dep:image", "dep:infer", "dep:tempfile", "dep:zip"]
|
|
|
|
# Support des webhooks sortants
|
|
webhooks = ["dep:reqwest", "dep:webhook"]
|
|
|
|
# Métriques et monitoring
|
|
metrics = ["dep:metrics", "dep:metrics-exporter-prometheus"]
|
|
|
|
# Envoi d'emails
|
|
email = ["dep:lettre"]
|
|
|
|
# Mode de développement avec fonctionnalités de debug
|
|
dev = ["tokio/test-util"]
|
|
|
|
# Version sans dépendances optionnelles (pour déploiements légers)
|
|
minimal = []
|
|
|
|
# Tests de base de données (nécessite une DB active)
|
|
test-db = []
|
|
|
|
[profile.dev]
|
|
# Configuration pour le développement
|
|
opt-level = 0 # Pas d'optimisation pour compilation rapide
|
|
debug = true # Symboles de debug complets
|
|
split-debuginfo = "unpacked" # Debug info séparé (macOS/Linux)
|
|
overflow-checks = true # Vérifications d'overflow
|
|
lto = false # Pas de LTO pour compilation rapide
|
|
|
|
[profile.release]
|
|
# Configuration pour la production
|
|
opt-level = 3 # Optimisation maximale
|
|
debug = false # Pas de symboles de debug
|
|
strip = true # Supprimer les symboles
|
|
lto = "fat" # Link Time Optimization complète
|
|
codegen-units = 1 # Compilation en une seule unité pour optimisation
|
|
panic = "abort" # Abort au lieu d'unwind pour performance
|
|
|
|
[profile.bench]
|
|
# Configuration pour les benchmarks
|
|
inherits = "release"
|
|
debug = true # Conserver debug pour profiling
|
|
|
|
# ═══════════════════════════════════════════════════════════════════════
|
|
# MÉTADONNÉES CARGO
|
|
# ═══════════════════════════════════════════════════════════════════════
|
|
|
|
[package.metadata.docs.rs]
|
|
# Configuration pour docs.rs
|
|
all-features = true
|
|
rustdoc-args = ["--cfg", "docsrs"]
|
|
|
|
# Badges pour crates.io
|
|
[badges]
|
|
maintenance = { status = "actively-developed" }
|
|
|
|
# Scripts personnalisés
|
|
[package.metadata.scripts]
|
|
# cargo run-script db-setup
|
|
db-setup = "sqlx database create && sqlx migrate run"
|
|
# cargo run-script test-all
|
|
test-all = "cargo test --all-features --all-targets"
|
|
# cargo run-script security-audit
|
|
security-audit = "cargo audit"
|
|
|