1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
//! gRPC Server Infrastructure
//!
//! This module provides a fluent builder API for configuring and running
//! gRPC servers with support for:
//!
//! - TLS/mTLS encryption
//! - gRPC reflection (service discovery)
//! - Health checking
//! - Graceful shutdown
//!
//! # Quick Start
//!
//! ```rust,ignore
//! use allframe_core::grpc::GrpcServer;
//! use allframe_core::shutdown::GracefulShutdown;
//!
//! // Simple server
//! GrpcServer::builder()
//! .addr("[::1]:50051")
//! .serve(my_service)
//! .await?;
//!
//! // Full-featured server
//! let shutdown = GracefulShutdown::new();
//!
//! GrpcServer::builder()
//! .addr("0.0.0.0:50051")
//! .reflection(FILE_DESCRIPTOR_SET)
//! .health_check()
//! .tls_from_env()
//! .graceful_shutdown(shutdown)
//! .serve(my_service)
//! .await?;
//! ```
//!
//! # TLS Configuration
//!
//! TLS can be configured either directly or from environment variables:
//!
//! ```rust,ignore
//! use allframe_core::grpc::{GrpcServer, TlsConfig};
//!
//! // Direct configuration
//! let tls = TlsConfig::new("cert.pem", "key.pem")
//! .with_client_ca("ca.pem"); // For mTLS
//!
//! GrpcServer::builder()
//! .tls(tls)
//! .serve(my_service)
//! .await?;
//!
//! // From environment variables
//! // GRPC_TLS_CERT, GRPC_TLS_KEY, GRPC_TLS_CLIENT_CA
//! GrpcServer::builder()
//! .tls_from_env()
//! .serve(my_service)
//! .await?;
//! ```
//!
//! # gRPC Reflection
//!
//! Enable service discovery with gRPC reflection:
//!
//! ```rust,ignore
//! // Include the file descriptor set from your build
//! pub const FILE_DESCRIPTOR_SET: &[u8] =
//! include_bytes!(concat!(env!("OUT_DIR"), "/proto_descriptor.bin"));
//!
//! GrpcServer::builder()
//! .reflection(FILE_DESCRIPTOR_SET)
//! .serve(my_service)
//! .await?;
//! ```
//!
//! # Health Checking
//!
//! Enable the standard gRPC health checking protocol:
//!
//! ```rust,ignore
//! GrpcServer::builder()
//! .health_check()
//! .serve(my_service)
//! .await?;
//! ```
pub use ;
pub use ;