pub struct ServerConfig {Show 14 fields
pub endpoint: String,
pub tls_setting: TlsServerConfig,
pub http2_only: bool,
pub max_frame_size: Option<u32>,
pub max_concurrent_streams: Option<u32>,
pub max_header_list_size: Option<u32>,
pub read_buffer_size: Option<usize>,
pub write_buffer_size: Option<usize>,
pub keepalive: KeepaliveServerParameters,
pub auth: AuthenticationConfig,
pub metadata: Option<MetadataMap>,
pub require_header_mac: bool,
pub negotiation_timeout_secs: u64,
pub link_hmac_poll_interval_ms: u64,
}Fields§
§endpoint: StringEndpoint is the address to listen on.
The transport protocol is inferred from the endpoint scheme:
ws://,wss://→ WebSocket (TLS whenwss)http://,https://,unix://, barehost:port→ gRPC
tls_setting: TlsServerConfigConfigures the protocol to use TLS.
http2_only: boolUse HTTP 2 only.
max_frame_size: Option<u32>Maximum size (in MiB) of messages accepted by the server.
max_concurrent_streams: Option<u32>MaxConcurrentStreams sets the limit on the number of concurrent streams to each ServerTransport.
max_header_list_size: Option<u32>Max header list size
read_buffer_size: Option<usize>ReadBufferSize for gRPC server.
write_buffer_size: Option<usize>WriteBufferSize for gRPC server.
keepalive: KeepaliveServerParametersKeepalive anchor for all the settings related to keepalive.
auth: AuthenticationConfigAuth for this receiver.
metadata: Option<MetadataMap>Arbitrary user-provided metadata.
require_header_mac: boolFlag to enforce header integrity validation
By default it is true
negotiation_timeout_secs: u64Timeout (in seconds) for link negotiation to complete. By default it is 5 seconds.
link_hmac_poll_interval_ms: u64Polling interval (in milliseconds) to wait between HMAC existence checks. By default it is 5 milliseconds.
Implementations§
Source§impl ServerConfig
impl ServerConfig
Sourcepub async fn to_server_future<S>(
&self,
svc: &[S],
) -> Result<ServerFuture, ConfigError>
pub async fn to_server_future<S>( &self, svc: &[S], ) -> Result<ServerFuture, ConfigError>
Build the gRPC server future that drives the underlying tonic server.
Returns ConfigError::GrpcServerUnsupportedTransport when invoked on
a config whose transport != Grpc.
Sourcepub async fn to_server_future_with_routes(
&self,
routes: Routes,
) -> Result<ServerFuture, ConfigError>
pub async fn to_server_future_with_routes( &self, routes: Routes, ) -> Result<ServerFuture, ConfigError>
Routes-based variant of Self::to_server_future. This is the
canonical entry point — the slice-based overload is kept as a thin
compat wrapper used by the gRPC-only run_grpc_server API.
Sourcepub async fn run_grpc_server<S>(
&self,
svc: &[S],
drain_rx: Watch,
) -> Result<CancellationToken, ConfigError>
pub async fn run_grpc_server<S>( &self, svc: &[S], drain_rx: Watch, ) -> Result<CancellationToken, ConfigError>
Spawn the gRPC server and return a CancellationToken that can be
used to stop it. The server is also driven by the supplied drain
watch for cooperative shutdown.
Generic over a slice of tonic services for backwards compatibility;
the unified entry point is Self::run_server (uses Routes via
the crate::ServerHandler trait).
Sourcepub async fn run_grpc_server_with_routes(
&self,
routes: Routes,
drain_rx: Watch,
) -> Result<CancellationToken, ConfigError>
pub async fn run_grpc_server_with_routes( &self, routes: Routes, drain_rx: Watch, ) -> Result<CancellationToken, ConfigError>
Routes-based variant of Self::run_grpc_server. Used internally
by Self::run_server.
Source§impl ServerConfig
impl ServerConfig
pub fn with_endpoint(endpoint: &str) -> Self
pub fn with_tls_settings(self, tls_setting: TLSSetting) -> Self
pub fn with_http2_only(self, http2_only: bool) -> Self
pub fn with_max_frame_size(self, max_frame_size: Option<u32>) -> Self
pub fn with_max_concurrent_streams( self, max_concurrent_streams: Option<u32>, ) -> Self
pub fn with_max_header_list_size( self, max_header_list_size: Option<u32>, ) -> Self
pub fn with_read_buffer_size(self, read_buffer_size: Option<usize>) -> Self
pub fn with_write_buffer_size(self, write_buffer_size: Option<usize>) -> Self
pub fn with_keepalive(self, keepalive: KeepaliveServerParameters) -> Self
pub fn with_auth(self, auth: AuthenticationConfig) -> Self
Sourcepub async fn run_server<H: ServerHandler>(
&self,
watch: Watch,
handler: Arc<H>,
) -> Result<CancellationToken, ConfigError>
pub async fn run_server<H: ServerHandler>( &self, watch: Watch, handler: Arc<H>, ) -> Result<CancellationToken, ConfigError>
Transport-agnostic server entry point. Dispatches on self.transport
and calls into the matching transport-specific run helper, requesting
the appropriate adapter from handler. Returns
ConfigError::HandlerMissingGrpcSupport /
ConfigError::HandlerMissingWebSocketSupport when the handler does
not implement the method for the configured transport.
Sourcepub fn resolved_transport(&self) -> TransportProtocol
pub fn resolved_transport(&self) -> TransportProtocol
Resolve the transport protocol for this configuration by inspecting
the endpoint URI scheme. See TransportProtocol::from_endpoint.
Source§impl ServerConfig
impl ServerConfig
pub async fn run_websocket_server( &self, drain_rx: Watch, on_accepted: OnAcceptedWebSocket, ) -> Result<CancellationToken, ConfigError>
Trait Implementations§
Source§impl Clone for ServerConfig
impl Clone for ServerConfig
Source§fn clone(&self) -> ServerConfig
fn clone(&self) -> ServerConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Configuration for ServerConfig
impl Configuration for ServerConfig
Source§impl Debug for ServerConfig
impl Debug for ServerConfig
Source§impl Default for ServerConfig
Default values for ServerConfig
impl Default for ServerConfig
Default values for ServerConfig
Source§impl<'de> Deserialize<'de> for ServerConfig
impl<'de> Deserialize<'de> for ServerConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Display for ServerConfig
Display implementation for ServerConfig
impl Display for ServerConfig
Display implementation for ServerConfig
Source§impl JsonSchema for ServerConfig
impl JsonSchema for ServerConfig
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read moreSource§impl PartialEq for ServerConfig
impl PartialEq for ServerConfig
Source§impl Serialize for ServerConfig
impl Serialize for ServerConfig
impl StructuralPartialEq for ServerConfig
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> AnyExt for T
impl<T> AnyExt for T
Source§fn downcast_ref<T>(this: &Self) -> Option<&T>where
T: Any,
fn downcast_ref<T>(this: &Self) -> Option<&T>where
T: Any,
T behind referenceSource§fn downcast_mut<T>(this: &mut Self) -> Option<&mut T>where
T: Any,
fn downcast_mut<T>(this: &mut Self) -> Option<&mut T>where
T: Any,
T behind mutable referenceSource§fn downcast_rc<T>(this: Rc<Self>) -> Result<Rc<T>, Rc<Self>>where
T: Any,
fn downcast_rc<T>(this: Rc<Self>) -> Result<Rc<T>, Rc<Self>>where
T: Any,
T behind Rc pointerSource§fn downcast_arc<T>(this: Arc<Self>) -> Result<Arc<T>, Arc<Self>>where
T: Any,
fn downcast_arc<T>(this: Arc<Self>) -> Result<Arc<T>, Arc<Self>>where
T: Any,
T behind Arc pointerSource§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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T, X> CoerceTo<T> for Xwhere
T: CoerceFrom<X> + ?Sized,
impl<T, X> CoerceTo<T> for Xwhere
T: CoerceFrom<X> + ?Sized,
fn coerce_rc_to(self: Rc<X>) -> Rc<T>
fn coerce_box_to(self: Box<X>) -> Box<T>
fn coerce_ref_to(&self) -> &T
fn coerce_mut_to(&mut self) -> &mut T
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request