pub struct BaseServerBuilderConfig {
pub config: ServerConfig,
pub authenticator: Option<Arc<dyn Authenticator>>,
}Expand description
服务端构建器基类
提供所有构建器共享的配置方法 使用组合模式,让各个构建器可以复用这些配置逻辑
Fields§
§config: ServerConfig§authenticator: Option<Arc<dyn Authenticator>>Implementations§
Source§impl BaseServerBuilderConfig
impl BaseServerBuilderConfig
Sourcepub fn with_authenticator(self, authenticator: Arc<dyn Authenticator>) -> Self
pub fn with_authenticator(self, authenticator: Arc<dyn Authenticator>) -> Self
设置认证器(如果启用认证,必须提供)
Sourcepub fn enable_auth(self) -> Self
pub fn enable_auth(self) -> Self
启用认证
Sourcepub fn with_auth_timeout(self, timeout: Duration) -> Self
pub fn with_auth_timeout(self, timeout: Duration) -> Self
设置认证超时时间
Sourcepub fn with_protocol(self, protocol: TransportProtocol) -> Self
pub fn with_protocol(self, protocol: TransportProtocol) -> Self
设置传输协议
Sourcepub fn with_protocols(self, protocols: Vec<TransportProtocol>) -> Self
pub fn with_protocols(self, protocols: Vec<TransportProtocol>) -> Self
启用多协议监听
Sourcepub fn with_protocol_address(
self,
protocol: TransportProtocol,
address: String,
) -> Self
pub fn with_protocol_address( self, protocol: TransportProtocol, address: String, ) -> Self
为特定协议设置监听地址
Sourcepub fn with_max_connections(self, max: usize) -> Self
pub fn with_max_connections(self, max: usize) -> Self
设置最大连接数
Sourcepub fn with_handshake_timeout(self, timeout: Duration) -> Self
pub fn with_handshake_timeout(self, timeout: Duration) -> Self
设置握手超时时间
Sourcepub fn with_max_handshake_concurrency(self, max: usize) -> Self
pub fn with_max_handshake_concurrency(self, max: usize) -> Self
设置最大并发握手数
Sourcepub fn with_write_timeout(self, timeout: Duration) -> Self
pub fn with_write_timeout(self, timeout: Duration) -> Self
设置单次连接写入超时时间
Sourcepub fn with_fanout_concurrency(self, max: usize) -> Self
pub fn with_fanout_concurrency(self, max: usize) -> Self
设置 fanout 发送最大并发度
Sourcepub fn with_connection_timeout(self, timeout: Duration) -> Self
pub fn with_connection_timeout(self, timeout: Duration) -> Self
设置连接超时
Sourcepub fn with_heartbeat(self, heartbeat: HeartbeatConfig) -> Self
pub fn with_heartbeat(self, heartbeat: HeartbeatConfig) -> Self
设置心跳配置
Sourcepub fn with_default_format(self, format: SerializationFormat) -> Self
pub fn with_default_format(self, format: SerializationFormat) -> Self
设置默认序列化格式(用于协商,默认 Protobuf)
Sourcepub fn with_default_compression(self, compression: CompressionAlgorithm) -> Self
pub fn with_default_compression(self, compression: CompressionAlgorithm) -> Self
设置默认压缩算法(用于协商,默认 None)
Sourcepub fn with_default_encryption(self, encryption: EncryptionAlgorithm) -> Self
pub fn with_default_encryption(self, encryption: EncryptionAlgorithm) -> Self
设置默认加密算法(用于协商,默认 None)
Sourcepub fn with_device_conflict_strategy(
self,
strategy: DeviceConflictStrategy,
) -> Self
pub fn with_device_conflict_strategy( self, strategy: DeviceConflictStrategy, ) -> Self
设置设备冲突策略
Auto Trait Implementations§
impl !RefUnwindSafe for BaseServerBuilderConfig
impl !UnwindSafe for BaseServerBuilderConfig
impl Freeze for BaseServerBuilderConfig
impl Send for BaseServerBuilderConfig
impl Sync for BaseServerBuilderConfig
impl Unpin for BaseServerBuilderConfig
impl UnsafeUnpin for BaseServerBuilderConfig
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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