From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id 334CF1FF145 for ; Thu, 22 Jan 2026 16:11:50 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 75BEA19E04; Thu, 22 Jan 2026 16:12:09 +0100 (CET) From: Christian Ebner To: pbs-devel@lists.proxmox.com Date: Thu, 22 Jan 2026 16:11:21 +0100 Message-ID: <20260122151125.832787-3-c.ebner@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260122151125.832787-1-c.ebner@proxmox.com> References: <20260122151125.832787-1-c.ebner@proxmox.com> MIME-Version: 1.0 X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1769094638129 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.048 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 Subject: [pbs-devel] [PATCH proxmox 2/2] s3-client: add proxy configuration as optional client option X-BeenThere: pbs-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Backup Server development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Proxmox Backup Server development discussion Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pbs-devel-bounces@lists.proxmox.com Sender: "pbs-devel" 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 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, /// 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 _______________________________________________ pbs-devel mailing list pbs-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel