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 F1C4E1FF170 for ; Thu, 21 Aug 2025 13:46:33 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 8BA281EC4B; Thu, 21 Aug 2025 13:46:34 +0200 (CEST) Date: Thu, 21 Aug 2025 13:46:01 +0200 Message-Id: From: "Lukas Wagner" To: "Proxmox Datacenter Manager development discussion" , "Dominik Csapak" Mime-Version: 1.0 X-Mailer: aerc 0.20.1-0-g2ecb8770224a References: <20250821084229.1523597-1-d.csapak@proxmox.com> <20250821084229.1523597-4-d.csapak@proxmox.com> In-Reply-To: <20250821084229.1523597-4-d.csapak@proxmox.com> X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1755776761227 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.025 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: Re: [pdm-devel] [PATCH datacenter-manager v3 03/23] server: connection: add probe_tls_connection helper X-BeenThere: pdm-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Datacenter Manager development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Proxmox Datacenter Manager development discussion Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pdm-devel-bounces@lists.proxmox.com Sender: "pdm-devel" On Thu Aug 21, 2025 at 10:39 AM CEST, Dominik Csapak wrote: > +/// Checks TLS connection to the given remote > +/// > +/// Returns `Ok(None)` if connecting with the given parameters works > +/// Returns `Ok(Some(cert))` if no fingerprint was given and some certificate could not be validated > +/// Returns `Err(err)` if some other error occurred > +/// > +/// # Example > +/// > +/// ``` > +/// use server::connection::probe_tls_connection; > +/// use pdm_api_types::remotes::RemoteType; > +/// > +/// # async fn function() { > +/// let result = probe_tls_connection(RemoteType::Pve, "192.168.2.100".to_string(), None).await; > +/// match result { > +/// Ok(None) => { /* everything ok */ }, > +/// Ok(Some(cert)) => { /* do something with cert */ }, > +/// Err(err) => { /* do something with error */ }, > +/// } > +/// # } > +/// ``` ^ The doc comment is now outdated > +pub async fn probe_tls_connection( > + remote_type: RemoteType, > + hostname: String, > + fingerprint: Option, > +) -> Result { > + let host_port: Authority = hostname.parse()?; > + > + let uri: http::uri::Uri = format!( > + "https://{}:{}", > + host_port.host(), > + host_port.port_u16().unwrap_or(remote_type.default_port()) > + ) > + .parse()?; _______________________________________________ pdm-devel mailing list pdm-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel