pub struct ClientConfig {Show 18 fields
pub endpoint: String,
pub origin: Option<String>,
pub server_name: Option<String>,
pub compression: Option<CompressionType>,
pub rate_limit: Option<String>,
pub tls_setting: TlsClientConfig,
pub keepalive: Option<KeepaliveConfig>,
pub proxy: ProxyConfig,
pub connect_timeout: DurationString,
pub request_timeout: DurationString,
pub buffer_size: Option<usize>,
pub headers: HashMap<String, String>,
pub auth: AuthenticationConfig,
pub backoff: BackoffConfig,
pub metadata: Option<MetadataMap>,
pub link_id: String,
pub require_header_mac: bool,
pub connection_type: ConnType,
}Expand description
Struct for the client configuration.
This struct contains the endpoint, origin, compression type, rate limit,
TLS settings, keepalive settings, proxy settings, timeout settings, buffer size settings,
headers, and auth settings.
The client configuration can be converted to a transport channel via
ClientConfig::to_channel.
Fields§
§endpoint: StringThe target the client will connect to.
The transport protocol is inferred from the endpoint scheme:
ws://,wss://→ WebSocket (TLS whenwss)http://,https://,unix://, barehost:port→ gRPC
origin: Option<String>Origin (HTTP Host authority override) for the client.
server_name: Option<String>Optional TLS SNI server name override. If set, this value is used for TLS server name verification (SNI) instead of the host extracted from endpoint/origin.
compression: Option<CompressionType>Compression type - TODO(msardara): not implemented yet.
rate_limit: Option<String>Rate Limits
tls_setting: TlsClientConfigTLS client configuration.
keepalive: Option<KeepaliveConfig>Keepalive parameters.
proxy: ProxyConfigHTTP Proxy configuration.
connect_timeout: DurationStringTimeout for the connection.
request_timeout: DurationStringTimeout per request.
buffer_size: Option<usize>ReadBufferSize.
headers: HashMap<String, String>The headers associated with gRPC requests.
auth: AuthenticationConfigAuth configuration for outgoing RPCs.
backoff: BackoffConfigBackoff retry configuration.
metadata: Option<MetadataMap>Arbitrary user-provided metadata.
link_id: StringLink identifier for this connection, used during link negotiation. Defaults to a randomly generated UUID v4.
require_header_mac: boolFlag to enforce header integrity validation
connection_type: ConnTypeThe type of connection this client establishes.
Defaults to edge. Set to peer for intra-deployment peer connections,
or remote for control-plane-managed inter-deployment links.
Implementations§
Source§impl ClientConfig
impl ClientConfig
Sourcepub fn with_endpoint(endpoint: &str) -> Self
pub fn with_endpoint(endpoint: &str) -> Self
Creates a new client configuration with the given endpoint. This function will return a ClientConfig with the endpoint set and all other fields set to default.
pub fn with_origin(self, origin: &str) -> Self
pub fn with_server_name(self, server_name: &str) -> Self
pub fn with_rate_limit(self, rate_limit: &str) -> Self
pub fn with_keepalive(self, keepalive: KeepaliveConfig) -> Self
pub fn with_connect_timeout(self, connect_timeout: Duration) -> Self
pub fn with_request_timeout(self, request_timeout: Duration) -> Self
pub fn with_buffer_size(self, buffer_size: usize) -> Self
pub fn with_headers(self, headers: HashMap<String, String>) -> Self
pub fn with_connection_type(self, connection_type: ConnType) -> Self
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 ClientConfig
impl ClientConfig
pub fn merge_server_requirements( &mut self, server: &ServerConnectionConfig, ) -> Result<(), TlsConfigError>
pub fn with_compression(self, compression: CompressionType) -> Self
pub fn with_tls_setting(self, tls_setting: TLSSetting) -> Self
pub fn with_proxy(self, proxy: ProxyConfig) -> Self
pub fn with_auth(self, auth: AuthenticationConfig) -> Self
pub fn with_backoff(self, backoff: BackoffConfig) -> Self
pub fn with_metadata(self, metadata: MetadataMap) -> Self
Sourcepub async fn to_channel(
&self,
) -> Result<TransportChannel<impl GrpcService<Body, Error: Into<StdError> + Send, ResponseBody: Body<Data = Bytes, Error: Into<StdError> + Send> + Send + 'static, Future: Send> + Send + Clone + 'static + use<>>, ConfigError>
pub async fn to_channel( &self, ) -> Result<TransportChannel<impl GrpcService<Body, Error: Into<StdError> + Send, ResponseBody: Body<Data = Bytes, Error: Into<StdError> + Send> + Send + 'static, Future: Send> + Send + Clone + 'static + use<>>, ConfigError>
Build a transport channel from this configuration. The returned
TransportChannel variant matches self.transport.
This is the single public entry point callers should use; the
transport-specific builders (to_grpc_channel / to_websocket_channel)
are crate-private.
Trait Implementations§
Source§impl Clone for ClientConfig
impl Clone for ClientConfig
Source§fn clone(&self) -> ClientConfig
fn clone(&self) -> ClientConfig
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 ClientConfig
impl Configuration for ClientConfig
Source§impl Debug for ClientConfig
impl Debug for ClientConfig
Source§impl Default for ClientConfig
Defaults for ClientConfig
impl Default for ClientConfig
Defaults for ClientConfig
Source§impl<'de> Deserialize<'de> for ClientConfig
impl<'de> Deserialize<'de> for ClientConfig
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 ClientConfig
impl Display for ClientConfig
Source§impl JsonSchema for ClientConfig
impl JsonSchema for ClientConfig
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 ClientConfig
impl PartialEq for ClientConfig
Source§impl Serialize for ClientConfig
impl Serialize for ClientConfig
impl StructuralPartialEq for ClientConfig
Auto Trait Implementations§
impl Freeze for ClientConfig
impl RefUnwindSafe for ClientConfig
impl Send for ClientConfig
impl Sync for ClientConfig
impl Unpin for ClientConfig
impl UnsafeUnpin for ClientConfig
impl UnwindSafe for ClientConfig
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