pub struct ServerConfig {
pub listen_addr: String,
pub max_connections: u32,
pub connection_timeout_ms: u64,
pub keepalive_interval_ms: u64,
pub metrics_auth_token: Option<String>,
}Expand description
服务器监听与连接生命周期配置。
Fields§
§listen_addr: String监听地址(ip:port)。
max_connections: u32最大并发连接数上限。
connection_timeout_ms: u64连接建立后的空闲超时(毫秒)。
keepalive_interval_ms: u64Keepalive 探测间隔(毫秒)。
metrics_auth_token: Option<String>/metrics 端点认证令牌(Bearer Token)。
None:/metrics端点不存在(返回 404),防止未显式配置时暴露观测数据。Some(token):请求须携带Authorization: Bearer {token}头(恒定时间比较), 不匹配返回 401。
Implementations§
Source§impl ServerConfig
impl ServerConfig
Trait Implementations§
Source§impl Clone for ServerConfig
impl Clone for ServerConfig
Source§fn clone(&self) -> ServerConfig
fn clone(&self) -> ServerConfig
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ServerConfig
impl Debug for ServerConfig
Source§impl Default for ServerConfig
impl Default for ServerConfig
Source§fn default() -> ServerConfig
fn default() -> ServerConfig
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for ServerConfig
impl<'de> Deserialize<'de> for ServerConfig
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<ServerConfig, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<ServerConfig, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Serialize for ServerConfig
impl Serialize for ServerConfig
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
Auto Trait Implementations§
impl Freeze for ServerConfig
impl RefUnwindSafe for ServerConfig
impl Send for ServerConfig
impl Sync for ServerConfig
impl Unpin for ServerConfig
impl UnsafeUnpin for ServerConfig
impl UnwindSafe for ServerConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more