From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) by lore.proxmox.com (Postfix) with ESMTPS id 988FA1FF13B for ; Wed, 11 Mar 2026 11:00:04 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 99149143C0; Wed, 11 Mar 2026 10:59:59 +0100 (CET) From: Christian Ebner To: pbs-devel@lists.proxmox.com Subject: [PATCH proxmox v2 2/2] s3-client: add proxy configuration as optional client option Date: Wed, 11 Mar 2026 10:59:02 +0100 Message-ID: <20260311095906.202410-3-c.ebner@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260311095906.202410-1-c.ebner@proxmox.com> References: <20260311095906.202410-1-c.ebner@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1773223127943 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.056 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: ZK5I4DTBPYEP6533USDC2V6Y63ANIKGE X-Message-ID-Hash: ZK5I4DTBPYEP6533USDC2V6Y63ANIKGE X-MailFrom: c.ebner@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox Backup Server development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: 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 --- 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 81645716..9944a505 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, /// Configuration options for the shared rate limiter. pub rate_limiter_config: Option, + /// Proxy configuration to be used by the client. + pub proxy_config: Option, } impl S3ClientOptions { @@ -110,6 +112,7 @@ impl S3ClientOptions { bucket: Option, common_prefix: String, rate_limiter_options: Option, + proxy_config: Option, ) -> 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