pub enum TransportConfig {
Tls {
ca_cert_path: Option<String>,
client_cert_path: Option<String>,
client_key_path: Option<String>,
allow_invalid_certificates: bool,
allow_invalid_hostnames: bool,
},
Plaintext,
RustlsConfig {
config: RustlsClientConfig,
},
}Expand description
Transport configuration for a connector instance.
Variants§
Tls
Use TLS transport.
Set ca_cert_path to verify the server against a custom CA bundle;
set client_cert_path + client_key_path to enable mutual TLS (mTLS).
Fields
ca_cert_path: Option<String>Optional PEM-encoded CA certificate file used to verify the server. When absent the system trust store is used.
client_cert_path: Option<String>Optional PEM-encoded client certificate file for mTLS authentication.
Must be paired with client_key_path.
client_key_path: Option<String>Optional PEM-encoded client private key file for mTLS authentication.
Must be paired with client_cert_path.
Plaintext
Use plaintext (unencrypted) transport.
§Security Warning
Plaintext transport transmits credentials and data in the clear. Only use this for localhost or fully-trusted private-network deployments (e.g., VPC-internal clusters) where all traffic is already isolated. Do not use plaintext over public or shared networks.
RustlsConfig
Use a fully-constructed rustls::ClientConfig injected at runtime.
This variant is intended for advanced use-cases where the caller needs
complete control over TLS configuration that cannot be expressed through
the file-path-based TransportConfig::Tls variant — for example:
- Custom certificate verifiers or pinning logic.
- Client certificates loaded from a hardware security module (HSM).
- Integration tests that generate ephemeral CA certificates in-process.
Because rustls::ClientConfig is not serializable, this variant
serializes as the string "<RustlsClientConfig>" and cannot be
round-tripped through a config file. Inject it programmatically only.
Requires the tls Cargo feature.
Fields
config: RustlsClientConfigThe pre-built rustls client configuration.
Implementations§
Source§impl TransportConfig
impl TransportConfig
Sourcepub fn tls() -> Self
pub fn tls() -> Self
Construct a TLS transport configuration using the system trust store and no client certificate (server-auth-only TLS).
Sourcepub fn tls_with_ca_cert_path(ca_cert_path: Option<String>) -> Self
pub fn tls_with_ca_cert_path(ca_cert_path: Option<String>) -> Self
Construct a TLS transport configuration with an optional CA bundle.
Sourcepub fn mtls(
ca_cert_path: Option<String>,
client_cert_path: String,
client_key_path: String,
) -> Self
pub fn mtls( ca_cert_path: Option<String>, client_cert_path: String, client_key_path: String, ) -> Self
Construct a mutual TLS (mTLS) configuration.
Both client_cert_path and client_key_path are required.
ca_cert_path is optional and falls back to the system trust store.
Sourcepub fn tls_insecure_skip_verify() -> Self
pub fn tls_insecure_skip_verify() -> Self
Construct TLS transport that skips certificate and hostname validation.
Use only for local testing or tightly controlled private environments.
Sourcepub const fn plaintext() -> Self
pub const fn plaintext() -> Self
Construct a plaintext (unencrypted) transport configuration.
See the TransportConfig::Plaintext variant for security guidance.
Sourcepub fn rustls_config(config: Arc<ClientConfig>) -> Self
pub fn rustls_config(config: Arc<ClientConfig>) -> Self
Inject a pre-built rustls::ClientConfig directly.
Use this when the file-path-based TransportConfig::Tls variant does
not provide the level of control you need (custom verifiers, HSM keys,
ephemeral in-process CAs, etc.).
Requires the tls Cargo feature.
Sourcepub fn is_mtls(&self) -> bool
pub fn is_mtls(&self) -> bool
Return true when mutual TLS (mTLS) is configured (client cert + key both set).
Sourcepub fn ca_cert_path(&self) -> Option<&str>
pub fn ca_cert_path(&self) -> Option<&str>
Return the configured CA bundle path, if any.
Sourcepub fn allow_invalid_certificates(&self) -> bool
pub fn allow_invalid_certificates(&self) -> bool
Return true when TLS certificate verification is disabled.
Always returns false for TransportConfig::RustlsConfig — the
injected ClientConfig is assumed to already encode the desired
verification policy.
Sourcepub fn allow_invalid_hostnames(&self) -> bool
pub fn allow_invalid_hostnames(&self) -> bool
Return true when TLS hostname verification is disabled.
Always returns false for TransportConfig::RustlsConfig — the
injected ClientConfig is assumed to already encode the desired
hostname policy.
Sourcepub fn client_cert_path(&self) -> Option<&str>
pub fn client_cert_path(&self) -> Option<&str>
Return the configured client certificate path, if any.
Sourcepub fn client_key_path(&self) -> Option<&str>
pub fn client_key_path(&self) -> Option<&str>
Return the configured client private key path, if any.
Sourcepub fn warn_if_insecure(&self, source_label: &str)
pub fn warn_if_insecure(&self, source_label: &str)
Emit tracing::warn! events for any insecure TLS flags.
Call this once per connection attempt. When allow_invalid_certificates
or allow_invalid_hostnames is set, a structured warning is emitted so
that log-aggregation pipelines and alerting rules can detect accidental
production use of insecure TLS configuration.
Trait Implementations§
Source§impl Clone for TransportConfig
impl Clone for TransportConfig
Source§fn clone(&self) -> TransportConfig
fn clone(&self) -> TransportConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for TransportConfig
impl Debug for TransportConfig
Source§impl Default for TransportConfig
impl Default for TransportConfig
Source§impl<'de> Deserialize<'de> for TransportConfig
impl<'de> Deserialize<'de> for TransportConfig
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>,
impl Eq for TransportConfig
Source§impl PartialEq for TransportConfig
impl PartialEq for TransportConfig
Source§fn eq(&self, other: &TransportConfig) -> bool
fn eq(&self, other: &TransportConfig) -> bool
self and other values to be equal, and is used by ==.