[pbs-devel] [PATCH proxmox 2/2] s3-client: add proxy configuration as optional client option
Christian Ebner
c.ebner at proxmox.com
Thu Jan 22 16:11:21 CET 2026
Allows to set a http proxy configuration for the client to be used for
the traffic from and to the s3 API endpoint.
Signed-off-by: Christian Ebner <c.ebner at proxmox.com>
---
proxmox-s3-client/examples/s3_client.rs | 1 +
proxmox-s3-client/src/client.rs | 10 +++++++++-
2 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/proxmox-s3-client/examples/s3_client.rs b/proxmox-s3-client/examples/s3_client.rs
index ca69971c..df523c75 100644
--- a/proxmox-s3-client/examples/s3_client.rs
+++ b/proxmox-s3-client/examples/s3_client.rs
@@ -40,6 +40,7 @@ async fn run() -> Result<(), anyhow::Error> {
put_rate_limit: None,
provider_quirks: Vec::new(),
rate_limiter_config: None,
+ proxy_config: None,
};
// Creating a client instance and connect to api endpoint
diff --git a/proxmox-s3-client/src/client.rs b/proxmox-s3-client/src/client.rs
index 83176b39..25cc77c0 100644
--- a/proxmox-s3-client/src/client.rs
+++ b/proxmox-s3-client/src/client.rs
@@ -20,7 +20,7 @@ use openssl::x509::X509StoreContextRef;
use tracing::error;
use proxmox_http::client::HttpsConnector;
-use proxmox_http::Body;
+use proxmox_http::{Body, ProxyConfig};
use proxmox_rate_limiter::{RateLimit, RateLimiter, SharedRateLimiter};
use proxmox_schema::api_types::CERT_FINGERPRINT_SHA256_SCHEMA;
@@ -100,6 +100,8 @@ pub struct S3ClientOptions {
pub provider_quirks: Vec<ProviderQuirks>,
/// Configuration options for the shared rate limiter.
pub rate_limiter_config: Option<S3RateLimiterConfig>,
+ /// Proxy configuration to be used by the client.
+ pub proxy_config: Option<ProxyConfig>,
}
impl S3ClientOptions {
@@ -110,6 +112,7 @@ impl S3ClientOptions {
bucket: Option<String>,
common_prefix: String,
rate_limiter_options: Option<S3RateLimiterOptions>,
+ proxy_config: Option<ProxyConfig>,
) -> Self {
let rate_limiter_config = rate_limiter_options.map(|options| S3RateLimiterConfig {
options,
@@ -131,6 +134,7 @@ impl S3ClientOptions {
put_rate_limit: config.put_rate_limit,
provider_quirks: config.provider_quirks.unwrap_or_default(),
rate_limiter_config,
+ proxy_config,
}
}
}
@@ -213,6 +217,10 @@ impl S3Client {
}
}
+ if let Some(proxy_config) = &options.proxy_config {
+ https_connector.set_proxy(proxy_config.clone());
+ }
+
let client = Client::builder(TokioExecutor::new()).build::<_, Body>(https_connector);
let authority_template = if let Some(port) = options.port {
--
2.47.3
More information about the pbs-devel
mailing list