Expand description
Hyper v1 transport implementation.
This crate provides a production-ready HyperTransport implementation that
integrates hyper v1 with any LaunchDarkly HttpTransport clients.
§Example
use launchdarkly_sdk_transport::HyperTransport;
let transport = HyperTransport::new()?;§Features
This module is only available when the appropriate feature flags are enabled in your Cargo.toml.
§Available Features
§hyper
Enables the hyper v1 transport implementation with HTTP-only support.
Use this when:
- You only need plain HTTP connections
- You’re handling TLS termination elsewhere (e.g., behind a load balancer)
- You want to minimize dependencies
Cargo.toml:
[dependencies]
launchdarkly-sdk-transport = { version = "0.0.1", features = ["hyper"] }§native-tls
Enables HTTPS support using the native TLS library. This feature automatically includes the
hyper feature and adds TLS capabilities. Certificate validation relies on the operating
system’s native certificate store.
Cargo.toml:
[dependencies]
launchdarkly-sdk-transport = { version = "0.0.1", features = ["native-tls"] }§hyper-rustls-native-roots
Use the operating system’s native certificate store for TLS certificate validation, relying on the hyper-rustls crate.
Cargo.toml:
[dependencies]
launchdarkly-sdk-transport = { version = "0.0.1", features = ["hyper-rustls-native-roots"] }§hyper-rustls-webpki-roots
Use Mozilla’s curated WebPKI certificate bundle, compiled into the binary.
Cargo.toml:
[dependencies]
launchdarkly-sdk-transport = { version = "0.0.1", features = ["hyper-rustls-webpki-roots"] }§Timeout Configuration
use launchdarkly_sdk_transport::HyperTransport;
use std::time::Duration;
let transport = HyperTransport::builder()
.connect_timeout(Duration::from_secs(10))
.read_timeout(Duration::from_secs(30))
.build_http()?;
§TLS/HTTPS Configuration
The HTTPS transport requires one root certificate provider to validate server
certificates. The behavior of build_https() depends on which features are enabled:
-
hyper-rustls-native-roots: Uses the OS certificate store. -
hyper-rustls-webpki-roots: Uses Mozilla’s curated certificate bundle compiled into the binary. -
native-tls: Uses the platform’s native TLS implementation.
§TLS Customization
For custom TLS settings (custom CA certificates, client certificates, cipher suites, etc.),
you can create a custom connector and pass it to HyperTransportBuilder::build_with_connector.
use launchdarkly_sdk_transport::HyperTransport;
use hyper_rustls::HttpsConnectorBuilder;
// Create a custom HTTPS connector with specific settings
let https_connector = HttpsConnectorBuilder::new()
.with_webpki_roots() // Use WebPKI roots instead of native
.https_only() // Reject plain HTTP connections
.enable_http1()
.enable_http2()
.build();
let transport = HyperTransport::builder()
.build_with_connector(https_connector)?;§Proxy Configuration
By default, the transport automatically detects proxy settings from environment variables
(HTTP_PROXY, HTTPS_PROXY, NO_PROXY). You can customize this behavior:
use launchdarkly_sdk_transport::HyperTransport;
// Disable proxy completely
let transport = HyperTransport::builder()
.disable_proxy()
.build_http()?;
// Use a custom proxy URL
let transport = HyperTransport::builder()
.proxy_url("http://proxy.example.com:8080".to_string())
.build_http()?;
// Explicitly enable auto-detection (default behavior)
let transport = HyperTransport::builder()
.auto_proxy()
.build_http()?;§Proxy Environment Variables
When using automatic proxy detection (the default), the transport checks these environment variables in order of precedence:
http_proxy/HTTP_PROXY: Proxy URL for HTTP requestshttps_proxy/HTTPS_PROXY: Proxy URL for HTTPS requestsno_proxy/NO_PROXY: Comma-separated list of hosts to bypass the proxy
Note: Lowercase variants take precedence over uppercase.
§Proxy Routing Behavior
- Both proxies set: HTTP requests use
HTTP_PROXY, HTTPS requests useHTTPS_PROXY - Only HTTP_PROXY set: All requests (HTTP and HTTPS) route through
HTTP_PROXY - Only HTTPS_PROXY set: Only HTTPS requests use the proxy, HTTP requests connect directly
- Neither set: All requests connect directly (no proxy)
§NO_PROXY Format
The NO_PROXY variable accepts a comma-separated list of patterns:
- Domain names:
example.com(matches example.com and all subdomains) - IP addresses:
192.168.1.1 - CIDR blocks:
10.0.0.0/8 - Wildcard:
*(disables proxy for all hosts)
§Proxy Authentication
Proxy URLs can include authentication credentials:
use launchdarkly_sdk_transport::HyperTransport;
let transport = HyperTransport::builder()
.proxy_url("http://username:password@proxy.example.com:8080".to_string())
.build_http()?;Or via environment variables:
export HTTP_PROXY="http://username:password@proxy.example.com:8080"Structs§
- Hyper
Transport - A transport implementation using hyper v1.x
- Hyper
Transport Builder - Builder for configuring a
HyperTransport.